patch_stick.sh 595 Bytes
Newer Older
Daniel Schulte's avatar
Daniel Schulte committed
1
2
3
4
5
6
#/bin/bash

set -e

DEVICE=$(blkid -t LABEL=MULTIBOOT -odevice)
MPOINT=/mnt
7
UPDATE_SCRIPT="./scripts/update_stick.sh"
Daniel Schulte's avatar
Daniel Schulte committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21

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

22
23
24
25
26
27
28
29
30
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
Daniel Schulte's avatar
Daniel Schulte committed
31
32
33
34

popd > /dev/null

umount "$MPOINT"
Daniel Schulte's avatar
Daniel Schulte committed
35
sync
Daniel Schulte's avatar
Daniel Schulte committed
36
exit 0