Save to CDForum: User Feedback Topic: Save to CD started by: bmsleight Posted by bmsleight on June 24 2004,23:44
Hi,Thanks for Damn Small linux. I am normally a www.Morphix.org user/developer, but wanted a Small linux to fit in my wallet. Anyway I looked at the Save configuration tool, <filetool.sh>. I also have developed an application from Morphix, cd-persistent. Which allows you to save everything to a multi-session CD. Last night I modified/hacked this work with Damn Small. Script is below, also available at < filetool_cdrom.sh > Alas, my dsl line is being fixed at the moment, so full script is below. As the line is up and down like a yo-yo. Anyway if you record DSL on to a multisession cd using cdrecord :- cdrecord -multi -data damsmall.iso (adding -dev=0,0,0 or whatever your device is ) You can then use filetool_cdrom.sh to restore/backup as per the original filetool, to the mutlisession cd itself. Rather than use a flopy/usb stick / HD. I had some problems using the restore last night as X had been ran before I restored the setting, as I could not run the restore script at boot time. It really needs a remaster, but it was only a quick hack. Thanks for Damn Small. Regards, Brendan Sleight #!/bin/bash # # Script to add tar-balls to multi-session Damn Small CD # and extract them. # By Brendan M. Sleight - 2004-06-23 # Licenced under the GNU GPL v2 (www.gnu.org) # # Based on Brendan's cd-persistent for Morphix.org # Parts taken from filetool.sh # by Robert Shingledecker for John Andrews Damn Small Linux # # # # # Globals # version=0-1-0 cd_home_root=/ cd_rom_location=/cdrom fs_home=/home/damnsmall extra_data=extra.raw temp_root=/tmp tmp_dir=/tmp/add_to_cd backup_cd(){ cd_confirm=$(cdrecord --scanbus 2>/dev/null| grep '0,0,0' ) echo "Version " $version echo "We are assuming that the following is your cd-writter" echo $cd_confirm echo "This is important that assumption is correct as " echo " YOU could fry your hard disk if incorrect" echo -"Is " $cd_confirm echo -n "Your cd-writter ? y/n " read OK if [ " $OK" = " y" -o " $OK" = " Y" ] then echo "Is your multi-sesion CD a CD-Re-writable, " echo " if so, and you have saved files before, " echo " shall we wipe the last session ? " echo " (If this is the first save don't wipe the last session)" echo -n "(answer W - for wipe) " read WIPE if [ " $WIPE" = " w" -o " $WIPE" = " W" ] then echo "blanking last session" echo " Last chance is " echo " $cd_confirm " echo -n " Your cd-writter ? y/n " read OK_RW if [ " $OK_RW" = " Y" -o " $OK_RW" = " y" ] then cdrecord -dev=0,0,0 blank=session fi fi fi mkdir $tmp_dir 2>/dev/null # # Store as a text files the date, so that on next save only # files modified on or after this date will saved # # # Ugly script - use a tar that is command the same each time - to fix # echo "Tarring files" cat $fs_home/filetool.lst | sudo xargs tar -cvf - | gzip > $tmp_dir/backup.tar.gz echo "OK, we are tar-ed up" # # # Use cdrecord to get track info, use mkisofs to make the track on local fs # the use cdrecord to burn # note we ask about dev=0,0,0 need to put in option to change this. # echo "Get multi-sesion infomation from CD" NEXTTRACK=`cdrecord -msinfo dev=0,0,0` echo "We know were to put it lets make the data in the correct format for the CD ..." mkisofs -r -o $temp_root/$extra_data -m '.*' -m root -C $NEXTTRACK -M /dev/cdrom \ -graft-points $cd_home_root/=$tmp_dir/ echo "If the above number of Mb is getting near the max size of your" echo " CD it is time to start a new CD" echo " " echo " Last chance is" echo " " $cd_confirm echo -n " Your cd-writter ? y/n " read OK_TWO if [ " $OK_TWO" = " y" -o " $OK_TWO" = " Y" ] then cdrecord -v -multi -dev=0,0,0 -data $temp_root/$extra_data echo "The files have been stored on to the CD," echo " further files _can not_ be stored on CD " echo " until reboot has been completed" echo " enter will close window" read END else echo "Not saved to CD" echo " enter will close window" read END fi } #Begin Main if [ -z $1 ] ; then echo "Usage: filetool_cdrom.sh {backup|restore}" echo -n "Press enter to coninue:" ; read ans exit 1 fi if [ $1 == "backup" ] ; then backup_cd exit 1 fi if [ $1 == "restore" ] ; then gzip -dc $cd_rom_location/backup.tar.gz | sudo tar -xvf - -C / exit 1 fi |