MNTDRV, a handy & flexible drive mounting program

Moderator: Forum moderators

Post Reply
User avatar
wizard
Posts: 1586
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

MNTDRV, a handy & flexible drive mounting program

Post by wizard »

MNTDRV, a handy & flexible drive mounting program that can be used from the terminal, run from a file manager or executed from the Rox or XFE right click menus.

Forum member @geo_c started a discussion on convenient ways to mount drives here: viewtopic.php?t=6373 thanks Geo. From his topic I wrote mntdrv and have improved it since. The current revision is D.

What can it do?
It's a mount/unmount toggle, run the first time it mounts, second time it unmounts.
By default it will mount/unmount sdb1 (can be changed).

Changing the default:
Open mntdrv in Geany text editor and edit the first section of code, i.e. mydrv=sdb1
If you want to have a dedicated file for each drive, then rename the file to suit. When executed it will toggle, mount/unmount the specified drive.
NOTE: if you leave mydrv blank, i.e. mydrv= , you will be prompted to enter the drive partition.

prompt.jpg
prompt.jpg (6.3 KiB) Viewed 922 times

Run from terminal:
-type: mntdrv
This will mount/unmount the default drive

-type: mntdrv sdc1
This would override the default and mount/unmount sdc1

Run from Rox or other file manager:
This will mount/unmount the default drive, or prompt if default is blank

Note: having a copy or symlink to mntdrv in the /mnt directory makes mount/unmounting a little more intuitive. Navigate (or make a bookmark) to /mnt, then run mntdrv and you're right in the directory where our mount point (directory) is located.

Both Rox and XFE have right click menus that can use mntdrv if your drive already has a mount point in /mnt, i.e, sdc1

Run from Rox:
-navigate to /mnt
-right click an existing mount point
-click: mntdrv
This will override the default and mount/unmount the existing mount point

roxrc.jpg
roxrc.jpg (41.57 KiB) Viewed 922 times

Run from XFE Scripts:
-navigate to /mnt
-right click an existing mount point
-click: Scripts>mntdrv
This will override the default and mount/unmount the existing mount point

The attached .pet file will install mntdrv into /root/my-applications/bin and setup all the symlinks needed for any of the run methods described above.

mntdrv-d.pet
(1.23 KiB) Downloaded 42 times

I've also included just the mntdrv script in the next post if you just want to experiment with it.

wizard

Last edited by wizard on Mon Aug 22, 2022 1:04 am, edited 2 times in total.

Big pile of OLD computers

User avatar
wizard
Posts: 1586
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: MNTDRV, a handy & flexible drive mounting program

Post by wizard »

Here is the mntdrv script.

mntdrv.gz
Remove fake .gz before using
(1.16 KiB) Downloaded 46 times

wizard

Big pile of OLD computers

User avatar
mikewalsh
Moderator
Posts: 5575
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1681 times

Re: MNTDRV, a handy & flexible drive mounting program

Post by mikewalsh »

@wizard :-

Don't forget to give yourself 'credit' up top (along with an approximate date; month & year is usually sufficient, though you can put specific dates if ya want). It's an original script, so you deserve credit for it, right?

The forum 'small print' does cover licensing where the individual doesn't mention such, but it never hurts to add a mention of which license you're using. The GPL (v2 or v3) are most commonly used, though I prefer the GNU 'all-permissive' license.

Do a wee bit of research into the various available licenses, and decided what you prefer. Doesn't do a scrap of harm to "dot the i's and cross the t's"......it soon becomes second nature. There was a thread in the early days of this Forum where this point was being debated quite hotly, though I can't find it!

Only small points, but many amateur scripters often forget this stuff.

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

backi
Posts: 589
Joined: Thu Jul 23, 2020 2:28 pm
Has thanked: 71 times
Been thanked: 65 times

Re: MNTDRV, a handy & flexible drive mounting program

Post by backi »

Hi
@wizard :

Finally found a working Tool to mount Drives in XFE Filemanager.

Cool :thumbup: very cool :thumbup: :thumbup:

Applause,Applause,Applause :thumbup:

User avatar
wizard
Posts: 1586
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: MNTDRV, a handy & flexible drive mounting program

Post by wizard »

@mikewalsh

Hi Mike

Don't forget to give yourself 'credit' up top (along with an approximate date; month & year is usually sufficient, though you can put specific dates if ya want). It's an original script, so you deserve credit for it, right?

The stuff that I do is pretty simplistic, mntdrv for instance is about 2 dozen lines of actual code. Probably poor code. I do bash scripts that help me with some small task (they're like crossword puzzles for me) and then post on the forum in case others might find them useful. Don't really care about 'credit', but will start putting my name in the top so users can run down who is responsible if it fails. In these cases, what exactly would the 'license ' accomplish?

Thanks
wizard

Last edited by wizard on Mon Aug 22, 2022 1:10 am, edited 1 time in total.

Big pile of OLD computers

User avatar
mikewalsh
Moderator
Posts: 5575
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1681 times

Re: MNTDRV, a handy & flexible drive mounting program

Post by mikewalsh »

@wizard :-

I was exactly the same as you, when I first started playing around with scripting. Essentially, just trying out little bits'n'pieces, here & there, simply to make MY life easier.......like the wee utility I came up with for changing 'spot' permissions to those of 'root', and moving stuff around to make it more accessible. Entirely for my own benefit, initially, being a long-term Chrome user, and Google changing things so that the browser HAD to be run as a 'normal user', etc.

I then got to thinking that I couldn't be the only one who would benefit from it, and so I published it. Things blossomed from there, as it were. If I can not only make my own life simpler, but also help out other Puppians into the bargain, I'm good with that. Just altruistic, I guess!

--------------------------------------------------

There was a big discussion about licencing in the early days after the Murga Forum died, and I'd already started publishing links to all my Puppy software not only here, but also on several other forums I frequent; Bleeping Computer, LinuxQuestions, and TechSupportGuy to name just a few. I got to thinking, especially after realising that it's the licensing that essentially makes the whole Linux eco-system work the way it does.

All the licence does is to basically let anyone who uses it know that they have the freedom to take that code, study it, use it and/or modify it in any way they see fit to suit their own needs. Most importantly it also states that the author is happy to grant that freedom. (It ALSO basically says that if you DO decide to modify it, don't come whining to me if it then doesn't work! :D )

I've already come across instances where people have taken chunks of my own, personal code and have blatantly tried passing it off as their own original work. I've got no issues with folks doing what the hell they want with it, but as least give me some credit for coming up with it in the first place, y'know? :roll:

The main GPL licences tend to be more for complete 'projects', where you put the entire thing together from start to finish. The reason I go with the 'all-permissive' licence is because it's intended for individual files - like bash scripts - and is intended for short chunks of code anyway......nominally up to around maybe 300 lines of code.

On top of all that, these little 'finishing touches' just make things LOOK more professional, if nothing else.....and show that you do take SOME pride in what you're doing! : (And I've always been a bugger for if I'm going to do summat, I like to do it properly...)

https://en.wikipedia.org/wiki/GNU_All-p ... ve_License

I suppose the biggest thing I've put together, to date, from scratch, is the updater mechanism for the Chrome/Iron portable browsers, and which was easily adapted to update the Zoom-portables, too. Maybe 195 lines of code, all told.

----------------------------

Perhaps such wouldn't bother you. But there ARE such things as 'intellectual property rights' - not that I'm that fussed about it - though it miffs me when some people try to pass my work off as their own.

All I'm saying is that you're selling yourself short if you don't at least establish yourself as the author of your own work. Remember, even the Puppy forum is publicly accessible, so anyone can take anything they want.

It IS entirely up to YOU, of course. It's not compulsory! :lol:

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

Post Reply

Return to “File Management”