patch_stick.sh 595 Bytes
Newer Older
Lars Beckers's avatar
Lars Beckers committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#/bin/bash

set -e

DEVICE=$(blkid -t LABEL=MULTIBOOT -odevice)
MPOINT=/mnt
UPDATE_SCRIPT="./scripts/update_stick.sh"

if [ ! $EUID -eq 0 ]; then
    echo "You are not root..."
    exit 1
fi

if [ -z $DEVICE ]; then
    echo "No stick found..."
    exit 1
fi

mount "$DEVICE" "$MPOINT"
pushd "$MPOINT" > /dev/null

if [ -e "$UPDATE_SCRIPT" ]; then
    echo "Using $UPDATE_SCRIPT."
    bash ./scripts/update_stick.sh
else
    echo "No $UPDATE_SCRIPT avaiable."
    echo "Falling back to plain git commands."
    git checkout master
    git pull
fi

popd > /dev/null

umount "$MPOINT"
sync
exit 0