Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Not backing up to a bad device< Next Oldest | Next Newest >
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Sep. 30 2005,16:41 QUOTE

If you enter a non-existent device name in the backup/restore widget, backup/restore fails but the garbage name gets stored in /opt/.backup_device anyway.

If you forget and reboot, the automated backup from powerdown.sh tries to backup to this non-existent device and fails --> work lost.

One fix is to:

1. Test for a bad device name at the beginning of filetool.sh (eg)
Code Sample

# Get the device name from argument $3 or  /opt/.backup_device
DEVICE="$3" || DEVICE="$(cat /opt/.backup_device 2>/dev/null)"

# Exit if no device specified or if DEVICE is not a valid block device
[ "x$DEVICE" = x  -o ! -b "/dev/$DEVICE" ] && exit 1


2. Change filetool.sh so that it only stores the device name if backup/restore is successful eg a "clean-up" function including:
Code Sample

# Only store device name if backup/restore successful
[ $1 -eq 0 ] && echo $(basename $DEVICE) >/opt/.backup_device
# Remove password file if decryption fails
[ $1 -eq 98 ] && rm -f /etc/sysconfig/des


3. Remove the write to /opt/.backup_device from dsl-restore.sh. Also, filetool.sh can do the mount test on the device name etc

4. filetool.lua can then be simplified:
Code Sample

  w = Window{320,75, "Filetool"}
  input = Input{60,10,210,25,"Device:"}
  readfrom("/opt/.backup_device")
  input.value = read()

  cancel = Button{60,40,70,25,"&Cancel"}
  function cancel:callback()
    exit(0)
  end

  backup = Button{130,40,70,25,"&Backup"}
  function backup:callback()
t = {"filetool.sh backup noprompt ".. input.value}
call(execute, t)
exit(0)
  end
 
  [ and ditto for the restore function ]
 
  etc

 
I tried these ideas in the updated fast backup scripts posted
here today.
(lzop does not have to be used)
Back to top
Profile PM 
0 replies since Sep. 30 2005,16:41 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Not backing up to a bad device

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code