Page 1 of 1
What is the great Rox 'Unmount ALL partitions' command?
Posted: Sun May 23, 2021 1:20 am
by JASpup
I was digging through a shutdown script and I found this, I think attributed to 01micko:
Code: Select all
umount-FULL -a -t cifs,smbfs,nfs,sshfs
Not understand the -t types I just entered the part before, and it tried to unmount EVERYTHING -- basically dismantle the Puppy system. Fortunately it is protected.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Mon May 24, 2021 7:21 pm
by JASpup
-t vfstype
Indicate that the actions should only be taken on file systems of the specified type. More than one type may be specified in a comma separated list. The list of file system types can be prefixed with no to specify the file system types on which no action should be taken.
https://linux.die.net/man/8/umount
yet the file system types on linux.die.net are still assumed. hmmmm
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Mon May 24, 2021 7:41 pm
by williams2
-t cifs,smbfs,nfs,sshfs all refer to file systems that work over a network.
So that command unmounts only those network file systems.
For example, you might be using samba sharing to access files on another computer.
Without -t, all the file systems that are mounted would try to be unmounted, including ext2, ext3, ext4, ntfs, vfat, fat32, ISO9660, sfs, aufs, tmpfs, etc etc
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Tue May 25, 2021 2:36 am
by JASpup
It seems odd to me that a command is scanning the entire system to unmount volumes by file format. I've noticed the system unmounts at shutdown, so went looking there. Some menus are customizable, thus fairly easy to decipher, but I'm not sure where to look for the partition menus, one of Rox's best features.
I'm guessing the command I want is:
all the compatible, common use storage partitions.
not sure -FULL
or not
I'll update after I try it. There is no such menu option in XFCE, so it should be an interesting experiment.
williams2 wrote: ↑Mon May 24, 2021 7:41 pm
-t cifs,smbfs,nfs,sshfs all refer to file systems that work over a network.
So that command unmounts only those network file systems.
For example, you might be using samba sharing to access files on another computer.
Without -t, all the file systems that are mounted would try to be unmounted, including ext2, ext3, ext4, ntfs, vfat, fat32, ISO9660, sfs, aufs, tmpfs, etc etc
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Tue May 25, 2021 10:12 am
by taersh
I'm not sure where to look for the partition menus, one of Rox's best features
In newer Puppies, the right-click menus of a Rox Drive/Partition icon is created by script:
/usr/local/pup_event/frontend_rox_funcs.
Can't recall where this is located in older Puppies.
But searching for frontend_rox_funcs using pfind will find it.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Tue May 25, 2021 3:53 pm
by JASpup
taersh wrote: ↑Tue May 25, 2021 10:12 am
In newer Puppies, the right-click menus of a Rox Drive/Partition icon is created by script:
/usr/local/pup_event/frontend_rox_funcs.
I guess it is the same without "_rox".
Difficult part is seeing the command:
Code: Select all
#v424 add item to unmount all partitions...
MOREITEMS="<Item option=\"unmount\" icon=\"gtk-harddisk\"><Label>$(eval_gettext 'Unmount ${ONEDRVNAME} (if currently mounted)')</Label></Item><Item option=\"unmountall\" icon=\"gtk-harddisk\"><Label>$(gettext 'Unmount ALL mounted partitions')</Label></Item>"
create_appinfo_func #needs INFO, DRV_CATEGORY, MOREITEMS, ONEDRVNAME
fi
MNTSTATUS="`df | grep "$drvPATTERN"`"
if [ "$MNTSTATUS" = "" ];then
icon_unmounted_func $ONEDRVNAME $DRV_CATEGORY #see functions4puppy4.
else
icon_mounted_func $ONEDRVNAME $DRV_CATEGORY #see functions4puppy4.
fi
add_pinboard_func #needs ONEDRVNAME, DRV_CATEGORY, FSTYPE.
done
unmountall is maybe just a label.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Tue May 25, 2021 7:33 pm
by taersh
The unmountall from your above part of script is a parameter submitted to a script. If unmountall is submitted all partitions will unmount. If unmount is submitted, only the selected partition will unmount. The script /usr/local/pup_event/frontend_rox_funcs creates the right-click menu of a Rox drive icon. See those parts:
Code: Select all
<Item option=\"unmount\" icon=\"gtk-harddisk\"><Label>$(eval_gettext 'Unmount ${ONEDRVNAME} (if currently mounted)')</Label></Item>
<Item option=\"unmountall\" icon=\"gtk-harddisk\"><Label>$(gettext 'Unmount ALL mounted partitions')</Label></Item>
Each <Item>...</Item> creates one entry of the right-click menu / context menu.
There's more entries to be created by /usr/local/pup_event/frontend_rox_funcs.
Below screenshot shows modification of right-click menu in my ArtStudio64. I'm doing this in all my Puppies.
- Screenshot.jpg (83.37 KiB) Viewed 771 times
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Tue May 25, 2021 11:53 pm
by JASpup
taersh wrote: ↑Tue May 25, 2021 7:33 pm
The unmountall from your above part of script is a parameter submitted to a script. If unmountall is submitted all partitions will unmount.
So we are looking at the menu.
Where do I find the script greeting the menu parameter?
I am seeking either the command entry, or multiple lines of code forming the more sophisticated script if that is the case.
I will call it with a desktop launcher when partitions are not on the desktop.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Wed May 26, 2021 12:52 pm
by taersh
Ok, I explained something similar already in another topic. Like in the other topic, the Rox desktop partition icons in fact are RoxApps. A RoxApp is a self-contained and executable directory. It's main parts are two files:
AppInfo.xml
AppRun
Where AppInfo.xml ist the file that holds the menu and sends its OPTIONS (like unmountall) to the AppRun file, which is a shell script.
So, holding shift down and left-clicking a desktop partition icon will open its directory wherein you will find these two above listed files.
This is the content of the AppInfo.xml file of my desktop partition icon sda1:
Code: Select all
<?xml version="1.0"?>
<AppInfo>
<Summary>Dateisystem: ext3 Größe: 234.7G, Free: 101G - [ATA WDC WD10EZEX-60W]</Summary>
<About>
<Purpose>Laufwerkssymbole sind Teil des Puppy-Ereignismanagers, siehe Menü > System</Purpose>
<Authors>Barry Kauler LGPL 2008</Authors>
</About>
<AppMenu>
<Item option="pmount_drive" icon="gtk-harddisk"><Label>Starte pmount, Laufwerke ein-/aushängen</Label><Label xml:lang="de">Starte PMount Drive Mounter</Label></Item><Item option="eventmanager" icon="gtk-execute"><Label>Desktop-Laufwerk-Symbol-Manager starten</Label><Label xml:lang="de">Starte Laufwerksikonen-Verwaltung</Label></Item> <Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="DEFPRTMANAGER" icon="gparted">
<Label xml:lang="en">Run Partition Manager</Label>
<Label xml:lang="de">Starte Partition Manager</Label>
</Item>
<Item option="DEFBOOTMANAGER" icon="gnibbles">
<Label xml:lang="en">Run Boot Config Manager</Label>
<Label xml:lang="de">Starte Boot Config Manager</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="unmount" icon="drives48">
<Label xml:lang="en">Unmount LinuxMain (sda1)</Label>
<Label xml:lang="de">Partition LinuxMain (sda1) aushängen</Label>
</Item>
<Item option="MOUNT" icon="drives48">
<Label xml:lang="en">Mount LinuxMain (sda1)</Label>
<Label xml:lang="de">Partition LinuxMain (sda1) einhängen</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="REFRESHFREEMEM" icon="drives48">
<Label xml:lang="en">Refresh free memory of LinuxMain (sda1)</Label>
<Label xml:lang="de">Information zu LinuxMain (sda1) auffrischen</Label>
</Item>
<Item option="REFRESHALLFREEMEM" icon="drives48">
<Label xml:lang="en">Refresh free memory of all drives</Label>
<Label xml:lang="de">Informationen zu allen Laufwerken auffrischen</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="SHOWSPACEUSAGE" icon="gdmap_icon">
<Label xml:lang="en">Show usage of the LinuxMain (sda1)Drive's Space</Label>
<Label xml:lang="de">Aufteilung des Speichers für LinuxMain (sda1) anzeigen</Label>
</Item>
<Item option="SEARCHINPFIND" icon="pfind">
<Label xml:lang="en">Search partition LinuxMain (sda1) for files and directories</Label>
<Label xml:lang="de">Partition LinuxMain (sda1) nach Dateien durchsuchen</Label>
</Item>
<Item option="OPENINXFE" icon="xfe">
<Label xml:lang="en">Open partition LinuxMain (sda1) in File Commander</Label>
<Label xml:lang="de">Partition LinuxMain (sda1) im Dateicommander öffnen</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="unmountall" icon="drives48">
<Label xml:lang="en">Unmount ALL partitions</Label>
<Label xml:lang="de">Alle Partitionen aushängen</Label>
</Item>
<Item option="MOUNTALL" icon="drives48">
<Label xml:lang="en">Mount ALL partitions</Label>
<Label xml:lang="de">Alle Partitionen einhängen</Label>
</Item>
<Item option="REDRAWALL" icon="drives48">
<Label xml:lang="en">Redraw ALL partitions</Label>
<Label xml:lang="de">Alle Partitionen neuzeichnen</Label>
</Item>
<Item option="OPENALLINROX" icon="drives48">
<Label xml:lang="en">Open ALL partitions in Rox Filer</Label>
<Label xml:lang="de">Alle Partitionen im Rox Dateimanager öffnen</Label>
</Item>
<Item option="CLOSEALLINROX" icon="drives48">
<Label xml:lang="en">Close ALL Rox Filer Windows</Label>
<Label xml:lang="de">Alle Fenster des Rox Dateimanagers schließen</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<AppMenu icon="shutdown48">
<Label xml:lang="en">Shutdown</Label>
<Label xml:lang="de">Ausschalten</Label>
<Item option="IMMEDIATEJMWRESTARTPC" icon="jwm">
<Label xml:lang="en">Restart Window Manager</Label>
<Label xml:lang="de">Fensterverwaltung neustarten</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="IMMEDIATEXRESTARTPC" icon="xrefresh">
<Label xml:lang="en">Restart X Server</Label>
<Label xml:lang="de">X Server neustarten</Label>
</Item>
<Item option="IMMEDIATEXEXITPC" icon="xshutdown">
<Label xml:lang="en">Exit X Server</Label>
<Label xml:lang="de">X Server verlassen</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="IMMEDIATEREBOOTPC" icon="reboot48">
<Label xml:lang="en">Reboot Computer immediately</Label>
<Label xml:lang="de">Computer sofort neustarten</Label>
</Item>
<Item option="IMMEDIATESHUTDOWNPC" icon="shutdown48">
<Label xml:lang="en">Shutdown Computer immediately</Label>
<Label xml:lang="de">Computer sofort herunterfahren</Label>
</Item>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
<Item option="SHUTDOWNPC" icon="shutdown48">
<Label xml:lang="en">Shutdown Computer</Label>
<Label xml:lang="de">Computer herunterfahren</Label>
</Item>
</AppMenu>
<Item option="nooption" icon="noicon">
<Label></Label>
</Item>
</AppMenu>
</AppInfo>
This is the content of the AppRun script of my desktop partition icon sda1:
Code: Select all
#!/bin/sh
exec /usr/local/pup_event/drive_all sda1 $@
From within /usr/local/pup_event/drive_all the script frontend_rox_funcs is called again where $@ may contain e.g. the OPTION unmountall.
So, everything that needs to be edited to modify the context-menu and its related functions of a desktop partition icon is in: frontend_rox_funcs
Edit: Puppies before Bionic may differ...
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Thu May 27, 2021 2:49 am
by JASpup
Erudite knowledge, Barry Kauler 2008. Alles übersetzt. O-kay. Partition menus sind a RoxApp.
If you just wanted to execute the command on the desktop or by script, how would you do it?
taersh wrote: ↑Wed May 26, 2021 12:52 pm
Ok, I explained something similar already in another topic. Like in the other topic, the Rox desktop partition icons in fact are RoxApps. A RoxApp is a self-contained and executable directory. It's main parts are two files:
AppInfo.xml
AppRun
Where AppInfo.xml ist the file that holds the menu and sends its OPTIONS (like unmountall) to the AppRun file, which is a shell script.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Thu May 27, 2021 3:44 am
by taersh
Assuming you want to have a script for the unmountall OPTION of the drive icon / RoxApp I would suggest to examine the script frontend_rox_funcs.
OPTION unmountall is examined/executed at the end of the script:
Code: Select all
unmountall)
# "Unmount ALL mounted partitions"
for MNTPT in `mount | grep '^/dev/' | grep -vE '^/dev/loop|^/dev/ram' | cut -f 3 -d ' ' | grep -v '^/initrd/' | grep -v '^/$' | tr '\n' ' '`
do
unmount_func
done
exit
;;
The mean part is function unmount_func which is also present in frontend_rox_funcs.
This is the modified version of my modified frontend_rox_funcs.
Code: Select all
unmount_func() {
rox -D $MNTPT
sync
# 2014-03-02 RSH unmount SFS, Save Files and ISOs first, then unmounts the drives
if [ -f /usr/sbin/ceelab/tools/unload-all-mntd-sfs-quiet ]; then
if [ "$MNTPT" = "$MYBOOTPRT" ]; then
# Unload all SFS Modules in use
/usr/sbin/ceelab/tools/unload-all-mntd-sfs-quiet
#/usr/sbin/ceelab/lazy-sfs-unload/unload_all_mntd_sfs
sleep .2
# Unmount all mounted Save Files in /mnt (sfs 2fs, 3fs, 4fs, iso)
/usr/sbin/ceelab/tools/unmount-all-iso-files
#/usr/sbin/ceelab/tools/UnMount_all_ISO_files
sleep .2
fi
fi
sync
while [ 1 ]
do
umount.crypto_LUKS "$MNTPT" || umount "$MNTPT"
umVAL=$?
#fix zombie process prevents partition unmount, invisible to fuser...
if [ $umVAL -ne 0 ];then
#120129 karl godt: fix ZOMBIES, see http://murga-linux.com/puppy/viewtopic.php?t=71767&start=420 ...
ZOMBIES="`ps -H -A | grep '<defunct>' | sed 's/^[[:blank:]]*//;s/ /|/g' | grep -v '|||' | cut -f 1 -d ' ' | tr '\n' ' '`"
for ONEZOMBIE in $ZOMBIES
do
echo "Killing parentless zombie process $ONEZOMBIE"
kill $ONEZOMBIE
done
umount $MNTPT ; umVAL=$?
fi
#rare ocassion, partition got unmounted before umount runs above...
mount | grep -q " ${MNTPT} " || {
umVAL=0 #not mounted
}
if [ $umVAL -ne 0 ];then
EXTRAMSG0="`fuser -v -m $MNTPT`"
if [ "$EXTRAMSG0" = "" ];then
/usr/lib/gtkdialog/box_ok "$(gettext 'Puppy drive manager')" error "$(gettext 'FAILURE! In the case of removable media, the most
common reason is the media is not currently inserted.
If so, please remedy.')"
else
xmessage -bg "#ff99ff" -title "$(gettext 'Puppy drive manager: FAIL')" -center -buttons "$(gettext 'KILL')":10,"$(gettext 'EXIT')":20 "$(gettext 'FAILURE!')
$(gettext 'One or more processes (programs) are currently
using the partition. Here they are:')
${EXTRAMSG0}
$(gettext "If you press the 'KILL' button, Puppy will attempt to
kill the offending programs for you. Only do this as a
last resort.")
$(gettext "Firstly you should try to close the programs
manually, so do not press 'KILL'.")
$(gettext "PLEASE PRESS THE 'EXIT' BUTTON!")"
if [ $? -eq 10 ];then
fuser -k -m $MNTPT
continue
fi
fi
else
[ "$DRV_CATEGORY" = "optical" ] && eject /dev/$ONEDRVNAME
fi
break
done
}
You could copy the related code into your own script to execute unmountall.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Fri May 28, 2021 3:52 am
by JASpup
I will study this and hopefully get it to work. Thanks for taking the time to explain it. I was expecting it would be simpler, but the function is probably a more robust implementation of unmounting.
Reality is, it's easy wind up with too many partitions on the desktop. Unlike JWM 'remove item', my XFCE are all partitions or none.
Settings are:
I might be able to copy individual partition launchers to the desktop, but either way, when you limit visible partitions, or accidentally mount them in Thunar, it is nice to have a way to unmount them all at once.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Fri May 28, 2021 11:05 am
by taersh
I have two entries in menu Filesystem.
One is for mounting all drives, the other is for un-mounting all drives.
Mounting all drives is easy to use, but un-mounting all drives might not work at all the time.
I used exactly that code presented. But there could be .sfs, .iso or even save files mounted on a partition.
So, if that's the case the drive/partition won't un-mount unless all .sfs, .iso and .2fs, .3fs, .4fs being unmounted.
That's why I wrote two additional scripts to unmount .sfs and .iso (including save files).
These scripts are called from within my un-mount-all script before un-mounting partitions.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Sun May 30, 2021 4:12 am
by JASpup
taersh wrote: ↑Fri May 28, 2021 11:05 am
I used exactly that code presented. But there could be .sfs, .iso or even save files mounted on a partition.
I am unable to do what you do without more experience.
What I'm trying to accomplish is the basic implementation of the rox menu option via script (or script via launcher).
I run into the checks stopping unmounting all the time, z.B., a loaded .sfs on the partition, the boot save partition as you mention, usw. They are enforced also on the command line.
That is why it seemed to me the menu option could be a single line command. The function is not too sophisticated.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Mon May 31, 2021 12:57 am
by taersh
I am unable to do what you do without more experience.
I could make a package of my scripts for you...
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Mon May 31, 2021 2:59 am
by JASpup
taersh wrote: ↑Mon May 31, 2021 12:57 am
I could make a package of my scripts for you...
That might be helpful for the school stuff you did.
I need to have an idea of what is going on and to learn what a script is doing. If something goes wrong taking shortcuts I am dependent on whomever made them. I would take instructions on how to make this one script from the built-in system files, adapted for distro.
I'm generally of the mind the best help is how-to's and creations for the masses (e.g., new .pet threads, new ppm items). It is safer and the best use of anyone's time.
I boot an old 32 pc in X-Tahr or mainline Xenial, and one 64 machine in mainline Xenial or XFCE puplet almost always now... ever since my last experiment trying to customize 32 LxPup Xenial for both LXDE and JWM.
You've given me pointers for unmounting when I am ready to focus on it.
Thunar in XFCE has an eject button on each mounted partition that works pretty well, I just like the JWM partition scheme best.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Mon May 31, 2021 10:08 pm
by taersh
I need to have an idea of what is going on and to learn what a script is doing. If something goes wrong taking shortcuts I am dependent on whomever made them. I would take instructions on how to make this one script from the built-in system files, adapted for distro.
I don't understand this. You got all the information, you got all the code snippets. Does this mean you never created a script by yourself and using copy/paste?
I'm generally of the mind the best help is how-to's and creations for the masses (e.g., new .pet threads, new ppm items). It is safer and the best use of anyone's time.
Yes, How-To's are useful, but I'm not the guy for writing How-To's for the masses.
Since you can boot Puppy without to load save files or folders "learning by doing" is the best way to achieve things.
And you should do it separately for one Puppy after the other one.
Puppy's "eject" button is also in the right-click menu of each desktop drive/partition icon. I think its OPTION is just unmount. It's function is also in frontend_rox_funcs. There's also the upper right corner of the desktop drive icon to unmount/eject it. Usually the upper right corner is somehow visibly marked.
Re: What is the great Rox 'Unmount ALL partitions' command?
Posted: Wed Jun 02, 2021 11:16 am
by JASpup
Is xml just another shell script language? Run the same? Does a single function need to be called, or can it be run by itself?
That is the thing, if it were easy to lay eyes (I do not really think about code), it would be easy to explain how to make an unmount ALL partitions script, even if it had to be adapted for Puppy version.
Greater, I do not see why it would need to be adapted, because it is a simple operation.
I can screw around as we say auf Englisch, but I have to make time for it or the motive has to be high. That is how I got this far in Puppy.
If you can eject a JWM partition by clicking on the upper right corner emblem, that is something I have not tried yet.
Mentioning the button was mostly about the XFCE alternative to unmount partitions. I do not mount or unmount in rox or xfe. Thunar running in XFCE is more intuitive. In JWM I use the desktop partitions or pmount.