Skip to content

Instantly share code, notes, and snippets.

@NicholasTD07
Forked from likuku/backup.sh
Created May 16, 2013 04:33
Show Gist options
  • Save NicholasTD07/5589425 to your computer and use it in GitHub Desktop.
Save NicholasTD07/5589425 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Warning!
# if you DIY a stage package like this,
# you must use the Stage3`s /etc/udev/*
# or rm /etc/udev/rules.d/70*
# Warning!
# last edited by likuku on 2012.03.29
DATE=`date +%Y_%m_%d_%H_%M_%S`
ARCH=`uname -m`
HOSTNAME=`uname -n`
ROOTFS_TYPE=`df -T / | awk '{print $2}' | grep -v "Type"`
BACKUP_PATH=`pwd`
STAGE5NAME="stage5_${ARCH}_${ROOTFS_TYPE}_${HOSTNAME}.${DATE}.tgz"
cd /;
tar czpvf ${BACKUP_PATH}/${STAGE5NAME} . \
--exclude=.${BACKUP_PATH}/*.tgz \
--exclude=.${BACKUP_PATH}/*.md5 \
--exclude=./etc/udev/rules.d/30* \
--exclude=./etc/udev/rules.d/61* \
--exclude=./etc/udev/rules.d/70* \
--exclude=./etc/udev/rules.d/80* \
--exclude=./etc/udev/rules.d/90* \
--exclude=./etc/ssh/ssh_host* \
--exclude=./proc/* \
--exclude=./sys/* \
--exclude=./var/log/dmesg \
--exclude=./var/log/*log \
--exclude=./var/log/messages* \
--exclude=./var/log/wtmp* \
--exclude=./var/log/portage/elog/* \
--exclude=./var/tmp/* \
--exclude=./usr/portage/distfiles/* \
--exclude=./o/* \
--exclude=./export/* \
--exclude=./tmp/*
#--exclude=./home/* \
#--exclude=./usr/portage/* \
wait;
cd ${BACKUP_PATH};
md5sum ${STAGE5NAME} >${STAGE5NAME}.md5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment