DriveMan drive manager and AutoDrive auto. mounter.

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

DriveMan drive manager and AutoDrive auto. mounter.

#1 Post by sunburnt »

I`ve integrated DriveMan and AutoDrive, but they can still be used separately.
DriveMan pix is shown below with the Settings GUI, AutoDrive has no GUI.

A Menu item is added for DriveMan: Menu > Filesystem > DriveMan
Maybe there should be a Settings GUI option to add a desktop icon also?
Click a device in DriveMan`s list and a popup menu gives a list of action choices.
Actions: Rox Filer, Mount-Unmount, Boot Mount Set-Unset, Settings, Exit DM, Exit Menu.
Settings GUI is easy to understand. DriveMan`s device list is never any taller than needed.

AutoDrive mounts and unmounts all removable devices automatically.
Auto. mounting takes 7 to 9 seconds, unmounting takes a second or so.
It refreshes DriveMan`s device list on device insert and remove events. ( option maybe? )
It can mount the device only, or also show the device in a Rox Filer window.
It adds the device to Rox Filer`s Bookmarks menu and Firefox`s SaveAs menu.

Below is a pix with instructions showing how to set HotPup`s Event Manager so it`s disabled.
The download box has instructions for extracting DriveMan in: /root/My-Applications.

### Beta software: Make a gzipped backup of your Save file just to be sure...

### Beta-7 version.
Attachments
driveman_b-7.zip
Move the zip file into: /root/My-Applications and extract it.
(11.67 KiB) Downloaded 689 times
000_DriveMan+Settings_b-6.png
DriveMan and Settings GUI.
(51.11 KiB) Downloaded 1346 times
000_HotPup-Setting.png
Run HotPup event manager: Menu > System > Puppy Event Manager
The pix shows the only checkbox that should be "on" in all the tabpanels.
(27.56 KiB) Downloaded 1254 times
Last edited by sunburnt on Sat 17 Apr 2010, 23:14, edited 3 times in total.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#2 Post by big_bass »

Hey sunburnt

I ll be testing again and giving feedback


thanks for the PM

Joe

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#3 Post by 8-bit »

I ran your new v6 version and upon clicking settings, the first time, The configuration GUI showed. So I tried the increase button.
The number stayed at 8. I then clicked exit and again, a blank settings file. But this time, when I deleted the settings file and tried to start again by exiting driveman and restarting it, it failed to run the settings GUI.
So I do not know what to tell you.
But consistently wiping out the settings file is not good.

Tried on Puppy 431 and Puppy 432.

Do you have any support files installed on your version of Puppy?
What version do you have it working consistently on?

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

Sorry about that 8-bit, I had it working and I hadn`t looked at it for so long I didn`t notice.
The entrybox on line 22 of the file: driveman.set.gtk3 is filled from the settings file.
But the settings file is not reread again to show the change, the DriveMan GUI`s list changed
and got bigger and smaller, but the Settings GUI was not updated with the change. ( ooops )
I`ve made the entrybox read the settings file separately to get the max. drive list height value.

I`ll wait for any other "bugs" to pop up so I can swat all of them down for the next beta.

I`m using dpup482, I`ll change to a new one after awhile. ( Your problem "worked" for me! )
Last edited by sunburnt on Thu 15 Apr 2010, 20:39, edited 1 time in total.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#5 Post by 8-bit »

From the experience I have had, as long as the settings file does not get overwritten or written with blank variables, the program works.
But with no error checking of a zero content settings file, driveman.set.gtk3 crashes as it cannot get it's variables from an empty file.
The weird part is that if I am in the settings GUI and click increase a few times and then check the settings file each time, sometimes the setHT gets written and and sometimes I come up with an empty settings file.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#6 Post by 8-bit »

I am now over on Dpup484.
Found another problem.
Even though the settings file shows False on everything, driveman.set.gtk3 comes up with two boxes checked.
That should not happen.
As to the empty settings file, it does not happen in dpup484.
So I see what you mean about it working in dpup.

But the big question is to why it fails in Puppy 431 and 432.
So far, as far as I can see, until the problems get ironed out, it looks like a dup484 only utility.
But the forcing of an autorun of driveman on startup and the automount is not good.

If it fails for me in the checkboxes being already checked, it should for you too.
And the refresh of the settings should reflect in the settings GUI.

And, YES I did have the foresight to back up the save file for dpup484.

My Puppy 431 uses xterm and my Puppy 432 uses rxvt.
I am not sure what terminal dpup484 uses.
That could make a big difference.

Edit: dpup484 uses mrxvt-full as it's terminal and that is a binary file.
I assume that that is where the problem lies between your program working on dpup and not puppy versions with xterm or rxvt.

So it may not be your program's fault on the problems but the terminal program used to run the bash scripts.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post by sunburnt »

driveman.set.gtk3 reads the settings file and it`s variable values set the checkboxes.
It`s very hard to imagine a checkbox showing anything other than it`s variable value.

I can`t reproduce your problem of the settings file getting "hosed", so I can`t diagnose it.
Refresh the settings file you`re looking at after the Settings GUI runs, it`s rewritten then.
When the Settings GUI is run the "real world" conditions are written to the Settings file.
Settings don`t just show blindly... If you kill AutoDrive with rxvt, it`ll show it`s stopped.
The only 3 Settings that`re not rewritten are: auto. mount, filer, and drive list max. height.
This is so they will remain the same for the next bootup, set them and they stay that way.

We`ll wait for big_bass to report back.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#8 Post by big_bass »

Hey Terry (sunburnt)

everything worked for me 8)

*I disabled HotPup`s Event Manager

I am on a 412 base but modified


-------------------------------------------------------------------------------
debugging info
I noticed only one error during debugging only
a grep error which takes place just after you select mount -unmount
--------------------------------------------------------------------------------
TIP:

8-bit should test puppy pfix=ram
just to verify if its a version error that needs addressing or not

if it works on a clean puppy pfix=ram then it works for that version


a personal request:

remove any code that reads puppylinux files
such as PUPSTATE as an example only

I hacked the slitaz mount box 3.3 and it only looks for ROX
which could be edited for any manager

making it linux friendly too so I could try it on slackware
and others out there in the open source community


Joe
Last edited by big_bass on Sat 17 Apr 2010, 18:05, edited 1 time in total.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#9 Post by sunburnt »

Thanks big_bass; It`s good to know that it works on slightly older Puppies.
When you say it worked, I assume you are over looking 8-bit`s error... Fixed.

I looked at the btnMNT code and there`s 4 greps at the beginning. I don`t see any bugs.
Could you tell me what you did to detect it? I tried using set -x and it showed nothing.
Here`s the only lines with grep:

Code: Select all

	drvInfo=$(<$drvINFO)
	ROW=`echo "$drvInfo" |grep $1`
	COL=`echo "$ROW" |cut -d '|' -f 2`
	if [ -z "`mount |grep $1`" ];then							## mount drive
		if [ "`echo $1 |grep sr`" ];then
			if [ "`probepart |grep $1 |cut  -d '|' -f 2`" = 'none' ];then	# empty CD-DVD, error
PUPSTATE is the only Puppy file, and probepart is the only Puppy utility that I use.
I use to write most of my apps. so they were generic. You`re right, I`ll change DriveMan.
I have 4 script function libraries I wrote, and one of them has a function like probepart.
1 does filesystems ( probepart ), 1 for file types, 1 for manipulating lists, and 1 for gtkdialog.
I`d prefer to write my apps. with library support ( easier ), but nobody else seems interested.
If I`m the only one using the libraries then they become unused code on peoples PCs. :?

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#10 Post by 8-bit »

Tests with pfix=ram

Puppy 4.2.1
Driveman works with no crash and no trash of settings file.
But when choosing settings from the popup, the settings GUI comes up with "Run Driveman at boot" and "Run Autodrive at boot" checked even though it is the first time the settings popup has been used and before it was called, the settings file showed all as "false".

Puppy 4.3.2 Official
settings file blanks as soon as the popup settings is used and the Settings GUI crashes with no variables from an empty settings file.

Puppy 4.3.4 CE? (technasaurous)
same as Puppy 4.3.2 Official

Puppy 4.3.1 SCSI
Same as Puppy 4.3.2 Official

Now you know as much as I do at the present time.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#11 Post by sunburnt »

Thanks 8-bit; There seems to be a lot of variance in the way Puppy versions run scripts, huh?
Makes you think that it`s pointless to bother to write anything except for yourself.

big_bass; I eliminated the need for probepart from DriveMan, but eliminating PUPSTATE...
Finding the system drive in all the different ways Linux can be setup and run is daunting.
Puppy frugal`s Save device is the system drive and / is in ram, a full install it`s the / partition.
I could have the DriveMan Startup file detect what partitions are mounted, but prone to errors.
It`s only used to put the "B" in the drive list and stop attempts to unmount it. Errors otherwise...

Any suggestions on how to detect the main system partition? The one that can`t be unmounted.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post by sunburnt »

I think I found a simple way... Just do "df" and get the top partiton listed.
It has to be the first one mounted, right? It`s probably not fool proof, but it works...
And the concept behind it is fairly sound, for most system setup`s it should work.

A thought, I looked at TinyCore, did "df" and all that`s mounted is 2 tmpfs.
So like Puppy / in in ram, but in TinyCore there was no system drive ( first boot like Puppy? ).
So my code`s good I think.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#13 Post by big_bass »

Hey Terry (sunburnt)


edit line 74 add double quotes on grep "$DEV" in two places

Code: Select all

	
	devMNT=`echo "$MNT" |grep "$DEV"` ; BOOT=`echo "$drvBOOT"| grep "$DEV"`



that removed the error warning


suggestions
### run driveman at boot up should be by default off

I assume you are over looking 8-bit`s error... Fixed.
--------------------------------------------
while running the code I had hda4 showing "M"

#this is strange should be unmounted ????
/dev/loop2 on /mnt/dev/hda4 type ext3 (rw,errors=continue,data=ordered)
/dev/loop3 on /mnt/hda4 type ext3 (rw,errors=continue,data=ordered)' ']'

so I did this
#

Code: Select all

df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sda2 6499008 1276680 4892196 21% /initrd/mnt/dev_save
/dev/loop1 1015496 533757 481739 53% /initrd/pup_ro1
tmpfs 1141168 1172 1139996 0% /initrd/pup_rw
/dev/loop0 81024 81024 0 100% /initrd/pup_ro2
unionfs 1141168 1172 1139996 0% /
/dev/loop2 521780 42944 452332 9% /mnt/dev/hda4
/dev/loop3 521780 42944 452332 9% /mnt/hda4



#### hmmm somethings fishy here lets unmount hda4 from the loop

Code: Select all

umount /dev/loop2
 umount /dev/loop3
now it was looking good

# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sda2 6499008 1276680 4892196 21% /initrd/mnt/dev_save
/dev/loop1 1015496 533757 481739 53% /initrd/pup_ro1
tmpfs 1141168 1172 1139996 0% /initrd/pup_rw
/dev/loop0 81024 81024 0 100% /initrd/pup_ro2
unionfs 1141168 1172 1139996 0% /
#



I have a routine I wrote in Xdialog that filters out the loop and swap
Any suggestions on how to detect the main system partition? The one that can`t be unmounted.

Code: Select all

blkid  | egrep '(hd|sd)' | egrep -v "/dev/loop*" | egrep -v "swap" | cut -f 1 -d ':' >/tmp/list_of_drives
since it will get mounted on /mnt (**not home**)
you'll be able to adjust it to your needs

Joe

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#14 Post by sunburnt »

Hi big_bass; That`s really odd, I`ve never had to use " " for assigning a value.
It`s only needed to preserved line feeds and to group spaced items.
The devices $DEV are only single items. I don`t use " " for assigning anywhere in the script.

The setting to boot run DriveMan is off by default, see the assignment code, line 75:

Code: Select all

	[ "$S" ]&& echo -e "setHT=8\\ndmBOOT=false\\ndmSTICKY=false
adBOOT=false\\nadRUN=false\\nadMNT=false\\nadFILER=false" > $Settings		### End Setup, Start GUI
How did 2 loop devices end up getting mounted on /mnt/dev/hda4 and /mnt/hda4 ??? :lol:

The egrep removes: loops, MMC partition tables, and the next gets the drive partitions:

Code: Select all

HD=`cat /proc/partitions |sed 's/^.* //' |egrep -v '(loop|blk0$)' |grep '[0-9]$'`
And this in the drive list building loop removes swaps and extended partitions:

Code: Select all

	[[ "$DEV" != sr* ]]&&		 ###   L.s    L.x    L.x    95x   NTx		###			# ignore swaps and ext.parts.
	[ "`disktype /dev/$DEV | egrep '(0x82|0x83|0x05|0x0F|0x42)'`" ]&& continue
I tried your code to detect the main system partition and got a long list of my 2 drive`s
partitions ( sda1,3,5,6 sdb1,5 ) and also sdc1,2,3,5,6,7,8,9,10,11,12.
Why it left out sdc4 is anybody`s guess. Anyway... It doesn`t seem to give the system drive.
Wouldn`t it be easier to write it with only one egrep statement?

I think taking the top drive in the "df" list is good for detecting the system disk,
considering all the different types of Linux distros. and all the different ways to boot them.
As said, it only puts the B on the system drive and keeps it from trying to be unmounted.

I`ve eliminated both probepart and PUPSAVE from DriveMan, I`ll test more and post later.
T. 8)

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#15 Post by big_bass »

Code: Select all

 sh -x /root/my-applications/driveman/driveman

Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
+ devMNT=
++ echo ''
++ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.



now do the edit I posted and check the output
you'll see that the error was removed


if you want another tool to look just for the grep error
now it is overkill but shows the power of strace

Code: Select all

strace -e open,read,write /root/my-applications/driveman/driveman   | grep [OPTION]

open("/etc/rc.d/PUPSTATE", O_RDONLY|O_LARGEFILE) = 3
read(3, "PUPMODE=13\nPDEV1=\'hda\'\nDEV1FS=\'i"..., 535) = 535
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.


Terry I like what you are doing




thanks for re doing without the need
of the pupstate




Joe
Last edited by big_bass on Sat 17 Apr 2010, 18:10, edited 1 time in total.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

Evidently the error must not be a bad one as normal execution of DriveMan doesn`t show it.
I guess grep is just really picky, I never noticed because it works anyway...

I got and will look at your mounter, I made a boot mounter with Xdialog years ago.
And you`ll see another "old" mount app. of mine if you look at: /usr/sbin/filemnt
Barry heavily modified it, it really needed it as I was new to scripting back then.

I hope to post beta-7 tomorrow after running it through repeated testing.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#17 Post by big_bass »

Evidently the error must not be a bad one as normal execution of DriveMan doesn`t show it.
I guess grep is just really picky, I never noticed because it works anyway...

I said it was a grep warning only while debugging
just wanted you to verify that

it is working correctly for me

I hope to have some time later today to run some more tests

*A side note long before I modified xfilmount on my slackware box
and I want to say thanks for your older work I was able to easily mount the unique puppy files 2fs 3fs sfs (sfs required kernel support to be compiled in ) which in turn lead to the making of slaxer pup

I had to get everything else working my plan was and is to make
puppy more linux friendly so interchanging of programs
would be possible



strange how a chain of events started so long ago

Thanks
Joe


P.S I removed the link I posted (should have just sent it as a PM )


and your latest driveman 8)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#18 Post by sunburnt »

8-bit; I made an extra check on the Settings file size being too small. But a DM restart`s needed.

big_bass; Your thoughts on "other" Linuxes and how to make the 2 apps. work universally...
Puppy uses /root, which usually isn`t used in other Linuxes, they use the user`s dir. ( natch ).
So users have no access to the /root/my-applications dir. even if the other Linuxes have one.
SO... I guess putting the apps. in /usr/local solves the problem... Huh? All Linuxes have it...

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#19 Post by 8-bit »

When do I get to check out your latest offering beyond version 6?
I am going crazy trying to track down what is causing the settings file to be overwritten with a blank file.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#20 Post by sunburnt »

Ok... Here`s beta-7, I didn`t get as much time to test it as I wanted, it seems to work well.
It`s done weird stuff a few times ( typical Bash ):
It mounted all the drives ( don`t know why ).
And took 20 secs. to unmount a USB once ( maybe not it`s fault ).
### See the original post for the new version`s download...

8-bit; Be sure to delete the old /driveman and /autodrive dirs.

big_bass; Try it on Slax and let us know if it worked, I`ll try to fix any bugaboos.

Post Reply