#!/bin/sh # Check UID if [ ${EUID} -ne 0 ]; then echo "Must run this command under sudo" exit; fi # Test existence of previous image if [ -f ~/Desktop/BackupDVD.dmg ]; then echo "BackupDVD.dmg already exists. Please remove." exit; fi # Play nice with the other processes renice +1 $$ # Create image echo "Creating DVD image" hdiutil create ~/Desktop/BackupDVD.dmg -sectors 9179656 -volname BackupDVD -type UDIF -fs HFS+ # Mount image echo "Mounting DVD image" MOUNTPOINT=`hdiutil attach ~/Desktop/BackupDVD.dmg -readwrite | grep BackupDVD | awk '{print $1}'` if [ ! -d /Volumes/BackupDVD ]; then echo "BackupDVD did not mount where expected." exit; fi # Copy files echo "Copying /var/cvs" mkdir -p /Volumes/BackupDVD/var/cvs cp -R /var/cvs/* /Volumes/BackupDVD/var/cvs echo "Building homedir manifest" # Movies, Music, Pictures (multimedia) get backed up separately (by hand) # Data (disk images and large temp files) gets backed up separately, if at all # Certivo Code is in cvs # No trash folders # No cache # Public is just stuff from other folders shared out to P2P find . \! -name BackupDVD.dmg -and \ \! -path './Data/*' -and \ \! -path './Code/Certivo*' -and \ \! -path './.Trash/*' -and \ \! -path '*/Warez/*' -and \ \! -path './Movies/*' -and \ \! -path './Library/Caches/*' -and \ \! -path './Music/*' -and \ \! -path './Pictures/*' -and \ \! -path './Public/*' \ > manifest.txt mkdir -p /Volumes/BackupDVD/Users/enigma echo "Copying homedir files" hfstar -c -T manifest.txt --no-recursion -f - | hfstar -xv -C /Volumes/BackupDVD/Users/enigma # Unmount image echo "Dismounting image" hdiutil detach ${MOUNTPOINT} > /dev/null echo "Done"