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: Select all
#!/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
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