27 lines
650 B
Bash
27 lines
650 B
Bash
#!/bin/bash
|
|
|
|
#backup a raspbmc host:
|
|
MNT=/mnt
|
|
SRC=/dev/mmcblk0
|
|
TO=~do/Documents/Backups/${1}
|
|
TSTAMP=$(date +%Y-%m-%d)
|
|
|
|
TAR="/bin/tar --sparse --same-owner --preserve-permissions \
|
|
-C $MNT --use-compress-program /usr/bin/pbzip2 -c"
|
|
|
|
mount ${SRC}p2 /mnt
|
|
mount ${SRC}p1 /mnt/boot
|
|
|
|
#prep ENV!
|
|
cp -uv /usr/bin/qemu-arm-static ${MNT}/usr/bin
|
|
#get selections
|
|
chroot ${MNT} dpkg --get-selections |grep -v deinstall >${MNT}/etc/dpkg/package-selections
|
|
|
|
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc
|
|
${TAR} -f ${TO}/${TSTAMP}_boot.tar.bz2 boot
|
|
${TAR} --exclude=".xbmc/temp/*" -f ${TO}/${TSTAMP}_home_pi.tar.bz2 home/pi
|
|
|
|
# finish
|
|
umount /mnt/boot
|
|
umount /mnt
|