restore apps in one easy step after upgrade..kinda

Posted by: image

restore apps in one easy step after upgrade..kinda - 17/10/2002 00:01

ok, i was thinking about this during work. if you take time to set it up correctly, then this should work.

say you reapply the b13 upgrade file and hijack. the next step is to use wfaulk's preinit ftp script, with the additions of mkdir /programs0 and /programs1 (so it will automount right afterwards). in /programs0/preinit.d, have a M99reupgrade shell script that checks if a certain file is in the root partition. if not, it copies whatever needs to be in the partition(index.html, rsync, libraries, ntptime, modified mtab/fstab, etc.) and the file that it will check for next time. last command is a reboot -f, and then thats it. you're back to what you were before you reflashed. the problem is that you have to keep track of what you modify in the / partition. what i've done is just have /programs0/base with all files, and do a cp /programs0/base / -r.

sound good?
Posted by: Roger

Re: restore apps in one easy step after upgrade..kinda - 17/10/2002 03:15

I just keep a base.tar.gz and configs.tar.gz in /drive0. After an upgrade, it's a simple matter of untarring them.

Works for me. However, I don't use preinit or anything like that, so it might get complicated.
Posted by: image

Re: restore apps in one easy step after upgrade..kinda - 17/10/2002 09:10

borrowing from your method...

install.ftp for preinit should be this:

quote site rw
cd /
quote mkd programs0
quote mkd programs1
cd /bin
bin
put empeg-preinit hijack
quote site chmod 755 hijack
quote site ro
quit

i keep a base.tar.gz in my /programs0 dir, and have the M99firstrun script in /programs0/preinit.d which consists of:

if [ -s /firstrun ]; then
echo "base.tar.gz already applied"
else
rw
cd /
tar zxvf /programs0/base.tar.gz
ro
reboot -f
fi

firstrun is a file in base.tar.gz of course.
Posted by: jaharkes

Re: restore apps in one easy step after upgrade..k - 17/10/2002 09:42

You could just add
> /firstrun

In the script. It creates an empty file named /firstrun, so if the base tarball is missing it the player won't try to extract the tarball on every run.

Combine that with extracting all tarballs in a given directory, and we have a basic installer that can even deal with upgrading applications by uploading a new tarball and then rebooting the player.

M00firstrun:
#!/bin/bash
cd /
for tgz in *.tgz ; do
base=`basename "$tgz"
stamp="/firstrun.$base"
if [ ! -e "$stamp" -o "$stamp" -ot "$tgz" ] ; then
rw ; rwm ; rwp
tar -xzf "$tgz"
> "$stamp"
rop; rom; ro
fi
done

Although if applications just limit themselves to /programs0 all of this isn't necessary. Just install preinit as /sbin/hijack after an upgrade and we're done.