Hi everyone
I have just use tiny core for few days and I hated backups taking so long, so I wrote this. Now, I dont tell anyone to use it, but it works find for me. Configuring tiny core the way backups are not needed is good idea tough.
filetool.sh:
#!/bin/sh
FILETLIST="/opt/.filetool.lst"
XFILELIST="/opt/.xfiletool.lst"
BACKUPDIR="/mnt/sda1/backup"
MOUNT_DEV="/dev/sda1"
abort(){
echo "Usage: filetool.sh options device"
echo "Where options are:"
echo "-b backup"
echo "-r restore"
exit 1
}
[ -z $1 ] && abort
while getopts br OPTION
do
case ${OPTION} in
b) BACKUP=TRUE ;;
r) RESTORE=TRUE ;;
*) abort ;;
esac
done
# $MOUNT_DEV needs /etc/fstab line
if [ ! "$(cat /proc/mounts | grep $MOUNT_DEV)" ]; then
echo "$MOUNT_DEV not mounted ..mounting"
mount $MOUNT_DEV
if [ "$?" != 0 ]; then
echo "Unable to mount $MOUNT_DEV"
exit 1
fi
fi
if [ ! -d $BACKUPDIR ]; then
echo "Creating nonexistent backup directory ($BACKUPDIR)"
mkdir -p $BACKUPDIR
if [ "$?" != 0 ]; then
echo "Unable to create $BACKUPDIR"
exit 1
fi
fi
if [ "$BACKUP" ]; then
echo "Running rsync"
rsync -ar --delete --delete-excluded --exclude-from "$XFILELIST" --files-from "$FILETLIST" / "$BACKUPDIR"
fi
if [ "$RESTORE" ]; then
echo "Running rsync"
rsync -ar "$BACKUPDIR/" /
fi
echo "done."
exit 0