Last active
August 29, 2015 14:14
-
-
Save paolodina/e4decf215bfb1a82a4e0 to your computer and use it in GitHub Desktop.
dump livecd customizations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# used to backup a live cd session without persistence possibility | |
# (just forgot to run the live cd in persistent mode) | |
set -e | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
# http://askubuntu.com/a/99151/18140 | |
USB_DEV=/dev/sdb1 | |
SYSTEM_DIR=$HOME/system | |
PACKAGES_DIR=$SYSTEM_DIR/packages | |
mkdir -p $SYSTEM_DIR | |
mkdir -p $PACKAGES_DIR | |
# mounted usb disk | |
MNT_DIR=$SYSTEM_DIR/mnt | |
mkdir -p $MNT_DIR | |
MNT_HOME_DIR=$MNT_DIR/xubuntu | |
mount $USB_DEV $MNT_DIR | |
mkdir -p $MNT_HOME_DIR | |
echo "packages.list..." | |
dpkg --get-selections > $PACKAGES_DIR/Package.list | |
#echo "sources.list..." | |
#sudo cp -R /etc/apt/sources.list* $PACKAGES_DIR | |
echo "Repo.keys..." | |
sudo apt-key exportall > $PACKAGES_DIR/Repo.keys | |
echo "/etc..." | |
rsync -avh -W --inplace /etc ./mnt/ --exclude mnt/ >> rsync.log | |
echo "/home..." | |
rsync -avh -W --inplace $HOME ./mnt/ --exclude mnt/ >> rsync.log | |
umount $MNT_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment