The time now is Thu 20 Jun 2013, 05:07
All times are UTC - 4 |
| Author |
Message |
maxerro

Joined: 10 Oct 2010 Posts: 65
|
Posted: Sat 12 Nov 2011, 08:31 Post subject:
command-line sfsloader/unloader Subject description: currently aufs-only (Slacko/Lucid/Wary) |
|
Here's a small command-line SFS loading/unloading script that works on aufs-based Puppies.
Not meant to compete with the currently wide-accepted shinobar's SFS-Load.
Written without grep/sed/awk/cat/df/losetup with hard-coded sfsfile paths to be easily-readable, and to test if many of the system-checks can be avoided and at what price.
Usage: sfsload (you can rename it to whatever) /drive[/path]/sfsfile
In this case "drive" is considered to be anything down your /mnt branch.
e.g. sfsload /sda1/* /sdb5/Libr* /home/OOo* /sr1/db???
Accepts up to 9 arguments and assumes an sfs extension (hardcoded), so do not type an extension. Use wildcards to load much more SFSs.
'sfsload -u' will unload all SFSs that it loaded up until that point (intentionally), if no other process complains about it. It won't mess-up conventionally loaded SFSs (or at least is not supposed to).
Unionfs-unmount-testing was unsatisfactory (not always 1st attempt and too slow in ms), so support for Racy is dropped and will be on hold for a while, but I'm very happy with its behavior in Slacko and hope it goes as well in Lucid/Wary.
Feel free to improve the script (modify/post-your-version/point-to-overlooked-disaster-scenario) and help someone find their potentially perfect cli-sfsloader.
| Code: | #!/bin/sh
case "$1" in
"") echo "Command-line SFS loader/unloader for Puppy Linux.
Usage: ${0##*/} [-u] /drive[/path]/sfsfile
e.g. ${0##*/} /sda1/* /sdb5/Libr* /sdc2/db??? (up to 9 args)" ;;
"-u") set /initrd/sfse*
i=1
while [ "${!i}" ] ; do
if [ -d "${!i}" ] ; then
busybox mount -o remount,del:"${!i}" / 2>/dev/null
busybox umount -d "${!i}" 2>/dev/null
[ $? -ne 0 ] && echo "${!i##*sfse} won't unload." || echo "${!i##*sfse} unloaded."
rmdir "${!i}" 2>/dev/null
fi
i=$(($i+1))
done;;
*) set /mnt$1.sfs /mnt$2.sfs /mnt$3.sfs /mnt$4.sfs /mnt$5.sfs /mnt$6.sfs /mnt$7.sfs /mnt$8.sfs /mnt$9.sfs
i=1
while [ "${!i}" ]; do
if [ -f "${!i}" ]; then
mkdir -p "/initrd/sfse${!i##*/}"
busybox mount -t squashfs "${!i}" "/initrd/sfse${!i##*/}" 2>/dev/null
busybox mount -o remount,append:"/initrd/sfse${!i##*/}" / 2>/dev/null
if [ $? -ne 0 ]; then
echo "${!i##*/} won't load."
rmdir "/initrd/sfse${!i##*/}" 2>/dev/null
else
echo "${!i##*/} loaded."
if [ -d "/initrd/sfse${!i##*/}/usr/share/applications" ];then
for PROG in "/initrd/sfse${!i##*/}"/usr/share/applications/*.desktop; do
while read LINE || [ "$LINE" ]; do
case $LINE in Exec=*)echo " ${LINE#*=}";; esac
done <${PROG}
done
fi
fi
fi
i=$(($i+1))
done;;
esac |
Also prints menu-entry-command-lines (if any), below every successfully loaded SFS.
Combine it with other commands if you like. To refresh menu try:
sfsload /sda1/* && fixmenus && jwm -restart
or, to simulate load-execute-unload behavior, type:
sfsload /sdb5/OOo* && soffice && sfsload -u
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Sun 13 Nov 2011, 01:01 Post subject:
|
|
the shabang should be !#/bin/bash (due to bashisms) or you could check out my sfs linker in jwm_tools if you want to make it compatible with non-bash shells (its is a similar concept but uses symlinks instead of a layered filesystem and can do files other than sfs and isn't dependant on non-vanilla kernel modules like unionfs/aufs in order to go with jwm to other distros)
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
maxerro

Joined: 10 Oct 2010 Posts: 65
|
Posted: Sun 13 Nov 2011, 04:33 Post subject:
|
|
well, i don't like your shabang either...
i'm not even gonna change that.
seriously techno, i'm complaining about unionfs .1s delays, and you're porting me to the versatile 2minute-mount approach? did you clock the devx-linking? and it needs recursion in the unmounting part too, if you wanna do it like that.
now, come up with a blazing unionfs-unmount solution.
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|
[ Time: 0.0597s ][ Queries: 12 (0.0164s) ][ GZIP on ] |