raspi backup and restore
This commit is contained in:
31
raspbmc-restore.sh
Executable file
31
raspbmc-restore.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
#backup a raspbmc host:
|
||||
MNT=/mnt
|
||||
SRC=/dev/mmcblk0
|
||||
TO=~do/Documents/Backups/${1}
|
||||
TSTAMP=${2}
|
||||
|
||||
TAR="/bin/tar --wildcards --sparse --same-owner --preserve-permissions \
|
||||
-C $MNT --use-compress-program /usr/bin/pbzip2 -xv"
|
||||
|
||||
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} --exclude=".xbmc/temp/*" -f ${TO}/${TSTAMP}_home_pi.tar.bz2 home/pi
|
||||
${TAR} -f ${TO}/${TSTAMP}_boot.tar.bz2 boot/*config*
|
||||
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc/passwd
|
||||
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc/group
|
||||
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc/ssh/*
|
||||
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc/apt/*
|
||||
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc/dpkg/*
|
||||
${TAR} -f ${TO}/${TSTAMP}_etc.tar.bz2 etc/host*
|
||||
|
||||
# finish
|
||||
umount /mnt/boot
|
||||
umount /mnt
|
||||
Reference in New Issue
Block a user