aboutsummaryrefslogtreecommitdiffstats
path: root/freedom-maker/copy2card.sh
blob: 807502f0ce25d6d9f827790b4e3cb909ab003061 (plain)
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
37
38
39
40
41
42
43
#!/bin/sh

set -e

if [ -n "`mount | grep 'mnt'`" ]
then
    echo "/mnt mount point is in use?"
    exit 1
fi

if ! [ -b "$1" ]
then
    echo "need to specify a target boot partition (/dev/sdb1)"
    exit 1
else
    BOOTDEV=$1
fi

if ! [ -b "$2" ]
then
    echo "need to specify a target root partition (/dev/sdb2)"
    exit 1
else
    ROOTDEV=$2
fi

echo "mounting rootdev..."
mount $ROOTDEV /mnt
echo "rsyncing over rootfs"
rsync -atv --progress --delete --exclude=boot build/armhf/ /mnt/
echo "sync filesystems..."
sync
echo "un-mounting rootdev..."
umount /mnt

echo "mounting bootdev..."
mount $BOOTDEV /mnt
echo "copying boot files..."
cp -v build/armhf/boot/* /mnt
echo "sync filesystems..."
sync
echo "un-mounting bootdev..."
umount /mnt