Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 15 Dec 2018, 00:38
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Script mounts any ext* or vfat partition on HD
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
musher0

Joined: 04 Jan 2009
Posts: 13167
Location: Gatineau (Qc), Canada

PostPosted: Fri 22 Jan 2016, 03:31    Post subject:  Script mounts any ext* or vfat partition on HD
Subject description: Also thumb drives
 

Hello all.

(Edited, June 20, 2018)

Often, you just want to mount a partition in a jiffy without having to
call in the PMount regiment.

So here you go:
This script will mount or unmount any ext? or vfat partition on your hard
drive or thumb drive by right-clicking on its name in the /mnt ROX-Filer
panel.
(Note: do not use on ram-drives created via < modprobe zram >.)

Unzip this script in /root/my-applications/bin or /opt/local/bin. Make it
executable. Once that is done, you click on it once. This will create a
symlink at the proper place in ROX's "OpenWith" structure.

After that, you can use it normally. Just right-click on a partition in the
/mnt folder: it will be in the context menu under the name
"monte-1-dsq.sh".

Click on this context link, and the partition will:
    * mount if unmounted -- and show the partition in a ROX window
    * unmount if mounted -- in this case ROX will ask you if you want to
    unmount it when you close the ROX window;
    * if the partition does not exist, it will tell you.


BFN.
~~~~~~~~~~~~~~~~~~~~
Code:
Please see more recent version below.
sdd8_says_it_does_not_exist_2016-01-22(2).jpg
 Description   
 Filesize   33.63 KB
 Viewed   261 Time(s)

sdd8_says_it_does_not_exist_2016-01-22(2).jpg


_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Wed 20 Jun 2018, 04:05; edited 3 times in total
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 4208
Location: Kiel,Germany

PostPosted: Mon 25 Jan 2016, 13:49    Post subject:  

What if
Type="`probepart | grep $Dsq | cut -d'|' -f2`"
get "none" or "swap" ?

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13167
Location: Gatineau (Qc), Canada

PostPosted: Thu 28 Jan 2016, 20:34    Post subject:  

Hi Karl.

Why would one want to mount a swap or non-existing partition?

BFN.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13167
Location: Gatineau (Qc), Canada

PostPosted: Tue 19 Jun 2018, 10:12    Post subject:  

Hello all.

Here is a more recent version. Any questions, please ask below.
Code:
#!/bin/sh
# /opt/local/bin/monte-1-dsq.sh
# Objectif / Goal:
# Monter ou démonter UNE partition. / Mount or unmount ONE partition.
# Usage :
# Appelé par clic droit sur un nom de partition affiché dans un panneau de ROX-Filer. /
# Called by right click on a partition name displayed in a ROX-Filer panel.
# Requis : / Required: /usr/local/lib/X11/mini-icons/mini-hdisk.xpm
## (c) Christian L'Écuyer, Gatineau (Qc), Canada, 21-22 janv. et 13 oct. 2016. GPL3.
##  (Alias "musher0" [forum PuppyLinux]).
#### set -xe
if [ -L /root/.config/rox.sourceforge.net/OpenWith/.inode_mount-point/monte-1-dsq.sh ];then
   Dsq="${@#/*/}"
   if [ "`fdisk -l /dev/$Dsq`" != "" ];then # Partition / existe ? / exists?
      if [ "`mount | grep $Dsq`" = "" ];then # Si non montée, on la monte. # Mount unmounted.
         Type="`probepart | grep $Dsq | cut -d'|' -f2`"
         mount -t $Type /dev/$Dsq /mnt/$Dsq
      else
         umount /mnt/$Dsq # Si montée, on la démonte. # Unmount mounted.
      fi
      rox /mnt/$Dsq # On l'affiche. # We show it.
   else
      [ "${LANG:0:2}" = "fr" ] && TXT="JE N'EXISTE PAS ! " || TXT="I DO NOT EXIST! "
      yaf-splash -bg_gradient true -fontsize large -bg black -fg red -text "$TXT >;->" -icon /usr/local/lib/X11/mini-icons/mini-hdisk.xpm -icon_width 48 -timeout 7
      # Partition / tells you if it exists! / vous dit si elle existe !
   fi
else
   ln -s /opt/local/bin/monte-1-dsq.sh /root/.config/rox.sourceforge.net/OpenWith/.inode_mount-point/
# Makes sure there is a symlink there to use. Means that the first time it is used,
# the script may appear to do nothing. / Assure qu'il y a un lien symbolique à utiliser
# à cet endroit. Signifie que la première fois, il peut sembler ne rien se passer.
fi # set +xe

Enjoy.
monte-1-dsq.sh.zip
Description 
zip

 Download 
Filename  monte-1-dsq.sh.zip 
Filesize  1.11 KB 
Downloaded  21 Time(s) 

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Wed 20 Jun 2018, 03:27; edited 1 time in total
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13167
Location: Gatineau (Qc), Canada

PostPosted: Tue 19 Jun 2018, 10:47    Post subject:  

... Continued from thread "xfe-1.42 FileManager", at
http://www.murga-linux.com/puppy/viewtopic.php?p=996342#996342
backi wrote:
Hi Musher !
Thanks for your Effort .......
But me i am a bit confused ......how to handle your script ......does it only
work in Puppy Linux ...... me executed it in Terminal on Bionic Dog .....but
have no Plan what to do further .

Hi backi.

In answer to your question:

1) -=> Untested on any of the "Dogs". <=-

2) It does not work from a terminal, it is designed to work from the ROX
right-click contextual menu for drives and such ("mount-points").

As an example --
Let's say this is the first time you are using this script. Also, let's say that
your partition sdc7 is unmounted and you want to mount it.

So you right-click on partition sdc7. The context menu is shown.
Click on the "Customize" item. A little ROX-Filer opens. Click "ok".

Now open directory /opt/local/bin OR directory ~/my-applications/bin (i.e.
wherever you stored this script) with ROX.

Now make a link from monte-1-dsq.sh from that directory to the "mount-
points" directory.

Hopefully the illustration explains it enough.

Once that is done, right-click on partition sdc7 and click on item
"monte-1-disk" in the list: this will mount partition sdc7 and a ROX-Filer
window of it will open.

A second example:
You have finished work on /mnt/sdc7 and you wish to unmount it.
Right-click on /mnt/sdc7, and click the "monte-1-disk.sh" item again.
/mnt/sdc7 will be unmounted.

Please note: you have to refresh the ROX-Filer window for /mnt for
the green button (the sign that a partition is mounted) to appear.
Same in reverse when you unmount a partition with this script, for the
green button to disappear.

If the above is not clear, please ask for further explanation.

IHTH.
Explanation.jpg
 Description   
 Filesize   171.5 KB
 Viewed   125 Time(s)

Explanation.jpg


_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Tue 19 Jun 2018, 10:52; edited 1 time in total
Back to top
View user's profile Send private message 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Tue 19 Jun 2018, 10:47    Post subject:  

Why would I want to mount something that is already mounted?

TTFN
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13167
Location: Gatineau (Qc), Canada

PostPosted: Tue 19 Jun 2018, 10:59    Post subject:  

jafadmin wrote:
Why would I want to mount something that is already mounted?

TTFN
Hi jafadmin.

Obvious. I do not know why you are stating the obvious. If your remark has
an "overtone/undertone" of any kind, I have this to say:

"You do not like this script? Nobody is forcing you to use it."

BFN.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
jafadmin

Joined: 19 Mar 2009
Posts: 859

PostPosted: Tue 19 Jun 2018, 11:20    Post subject:  

musher0 wrote:
If your remark has an "overtone/undertone" of any kind ..


All my remarks are certified tone-free by the official tone certifying workgroup. So no worries there. Cool
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13167
Location: Gatineau (Qc), Canada

PostPosted: Wed 20 Jun 2018, 04:12    Post subject:  

Hello all.

I have edited my posts above. May I suggest that you re-read them. Hopefully,
they now contain clearer explanations about what this script does.

Sorry for any inconvenience. TWYL.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

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.0814s ][ Queries: 13 (0.0273s) ][ GZIP on ]