PDA

View Full Version : Script for saving changes to a live usb stick / sdcard


cleguevara
04-15-2008, 07:24 PM
I've written a little script for my eee in order to save the changes to my sd-card... (the merging issue mentioned in the BT-HowTo is integrated, too)


#!/bin/bash
#Author: cleguevara
#Version: 0.2


#-------determine on which device the flash-storage is---------
FLASHSTORAGE=""
#(I know the following is VERY inefficient and especially SLOW...)
slocate -u
FLASHSTORAGE=$(slocate BT3 |grep sd |grep live |grep root.lzm |cut -d '/' -f 5)

#to set the flash-storage manually comment the above lines and uncomment the following one after typing in your device
#FLASHSTORAGE=


#--------------------save the changes----------------------
dir2lzm /mnt/live/memory/changes new-changes.lzm
mkdir /tmp/changestmp
lzm2dir /mnt/$FLASHSTORAGE/BT3/modules/changes.lzm /tmp/changestmp
lzm2dir new-changes.lzm /tmp/changestmp
dir2lzm /tmp/changestmp changes.lzm
mv /mnt/$FLASHSTORAGE/BT3/modules/changes.lzm /mnt/$FLASHSTORAGE/BT3/changes.lzm.bak
mv changes.lzm /mnt/$FLASHSTORAGE/BT3/modules/


Don't forget to chmod 755 the script ;)
It would be great if anyone points me to a simpler solution for determining the device name of the usb-stick/sd-card/flash-storage

pureh@te
04-15-2008, 07:30 PM
Why not make a save changes partition like every one else?

cleguevara
04-15-2008, 07:36 PM
It's nice to get back to a working BT3 after realizing that all got screwed up ;-).
And with the changes module it's simpler to make an exact copy of the configuration by just copying the file to another media where BT3 is installed

pureh@te
04-15-2008, 07:41 PM
When you have two partitions, one with the bt3 base install and a second with all your changes, what could be easier than wiping out the whole save changes partition and rebooting. Simply copy your changes partition every now and then for a back up. Don't get me wrong I appreciate you sharing your script however I was just wondering why not do it the way backtrack was designed to do it.

cleguevara
04-15-2008, 07:45 PM
I thought about "screwing it up" before running the script that time... so you're just start at the point of your last reboot. But while I' think about it, it would make sense to backup the old changes.lzm before copying the new one... I'll edit it accordingly

pureh@te
04-15-2008, 07:56 PM
I think your missing my point. There is no need for the .lzm at all if you have a separate partition for changes.

cleguevara
04-15-2008, 08:09 PM
I know... a dedicated partition for changes is just much more transparent than the lzm-method.

My way should only by an alternative.
The advantage is that it' can be done without much configuration issues.