Loading a SFS to a top Layer

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
ITSMERSH

Loading a SFS to a top Layer

#1 Post by ITSMERSH »

Hi.

To load a SFS to a top Layer I've used a modified version of a script by mikeb for years, in Puppies from Lucid up to Tahr. To load a SFS to a top Layer is the only way to update scripts/programs in main SFS without to install a PET package.

Nowadays, e.g. in Bionic Beaver Puppy this doesn't work anymore.

The code used (the line causing the trouble is marked in red color):
#!/bin/bash -a
#------------------------------------------------------------------------------
# Simple but useful Script to load/unload SFS Modules - original by: mikeb
# Modified for compatibility to shinobar's sfs_load
# 2016-10-19 RSH for T.O.P.L.E.S.S., Scripting Library and LazY Puppy
#------------------------------------------------------------------------------

# Sort out submitted commands to be compatible to shinobar's sfs_load
DOFIXMENUS="true"
QUIET="false"
ACTION="load"

# Taken from my modified sfs_load version 1.3.9
while [ "$1" ] ; do
case "$1" in
-s|--skip-fixmenus) DOFIXMENUS="false" ;;
-u|--un*) ACTION="unload" ;;
-c|--cli) GUI="" ;;
-q|--quiet) QUIET="true" ;;
*) break;;
esac
shift
done

MODULE="$1"
MODE="$ACTION"
NAME="`basename $MODULE | tr ' ' '_' `" # Remove spaces for later...easier life

#if [[ "`mount | grep "$NAME "`" = "" && "$ACTION" = "load" ]]; then
if [[ "$ACTION" = "load" ]]; then
# Makes nodes if all used
NEXT=$(losetup -f 2>/dev/null)
if [ "$NEXT" = "" ]; then
NR=$(find /dev/loop* | cut -b 10- | sort -n | tail -1)
NR=$(expr $NR + 1)
NEXT=/dev/loop$NR
mknod $NEXT b 7 $NR 2>/dev/null
fi
mkdir -p /initrd/$NAME
mount-FULL -o loop -t squashfs "$MODULE" /initrd/$NAME
busybox mount -t aufs -o remount,add:1:/initrd/$NAME=ro unionfs /
if [ $? -eq 0 ]; then
if [ "$DOFIXMENUS" = "true" ]; then
[ "`pidof X`" != "" ] && fixmenus
[ "`pidof X`" != "" ] && touch /root/.config/xfce4/desktop/menu.xml
if [ "$QUIET" = "false" ]; then
[ "`pidof X`" != "" ]&& Xdialog --timeout 3 --msgbox "Inserted $NAME" 5 40
fi
echo "Inserted $NAME"
fi
exit
fi
########################################################################
#elif [[ "`mount | grep "$NAME "`" != "" || "$ACTION" = "unload" ]]; then
elif [[ "$ACTION" = "unload" ]]; then
########################################################################
busybox mount -t aufs -o remount,del:/initrd/$NAME unionfs /
busybox umount /initrd/$NAME
rmdir /initrd/$NAME
if [ $? -eq 0 ]; then
if [ "$DOFIXMENUS" = "true" ]; then
[ "`pidof X`" != "" ] && fixmenus
[ "`pidof X`" != "" ] && touch /root/.config/xfce4/desktop/menu.xml
if [ "$QUIET" = "false" ]; then
[ "`pidof X`" != "" ]&& Xdialog --timeout 3 --msgbox "Removed $NAME" 5 40
fi
echo "Removed $NAME"
fi
exit
fi
fi

if [ "$QUIET" = "false" ]; then
[ "`pidof X`" != "" ]&& Xdialog --timeout 3 --msgbox "Unable to $MODE $NAME" 5 40
fi
echo "Unable to $MODE $NAME"

exit 0
It complains about the argument / when trying to mount unionfs to /.

I need this for real, so how can I fix this?

Thanks

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#2 Post by s243a »

Maybey neither the busybox or the unionfs / in the statement is required. From the /initrd/init script:

Code: Select all

 if [ "$ONE_PREP" ];then
  echo "mount -o remount,add:1:$ONE_LAYER /pup_new" #debug
  mount -o remount,add:1:$ONE_LAYER /pup_new
  [ $? -eq 0 ] || return 5
 else
https://github.com/puppylinux-woof-CE/w ... /init#L421

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#3 Post by fredx181 »

ITSMERSH wrote:The code used (the line causing the trouble is marked in red color):
.....
busybox mount -t aufs -o remount,add:1:/initrd/$NAME=ro unionfs /
Maybe try this instead:

Code: Select all

mount-FULL -n -o remount,add:1:/initrd/$NAME=rr+wh aufs /
Or:

Code: Select all

mount-FULL -n -o remount,add:1:/initrd/$NAME=rr aufs /
Fred

Post Reply