DriveMan drive manager and AutoDrive auto. mounter.

Under development: PCMCIA, wireless, etc.
Message
Author
big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#21 Post by big_bass »

Hey sunburnt


as far as where your app should be installed when you decide to package it is in /usr/sbin because it is a mounting tool and that would be the correct location



you dont need any code to write into JWM the installer takes care of that
even my hacked slackwares package tools has no problem updating the menus automatically

no need coping the desktop with the script
all gets handled with petget or pkgtools when the package is registered
this also allows for clean uninstalls

!!I havent tried your latest version yet that you uploaded today !!
*I still have one problem with the drive man settings option starting with two boxes checked

I discovered that when driveman is first run
and while its open if I delete the following three files
on a clean installed puppy pfix=ram and nothing else installed

Code: Select all

rm -f /root/Startup/0_mountdrives.startup 
rm -f /root/Startup/autodrive.startup 
rm -f /root/Startup/driveman.startup  

the setting box then is cleared

the problem is that on the very first run of driveman
these files get auto created instantly after clicking on driveman
/root/Startup/0_mountdrives.startup
/root/Startup/autodrive.startup
/root/Startup/driveman.startup


so I have to figure out why this condition happens
maybe because on slaxer_pup my drives are labeled as
hda for hard drives sda for USB drives hdc or hdd for cd/dvd drives
the old standard way

I am getting closer at least I confirmed a temp fix


if you would like for me to generate any logs to help you track this
just let me know what you need to see


Joe

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

#22 Post by 8-bit »

BigBass,
Examine lines 66-71 in the driveman file and you will see those files get copied before any settings file is ever created. Also, they get copied even if there is a settings file every time driveman is run.
The test for a settings file and creation is a few more lines down.

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

#23 Post by sunburnt »

Hi joe; I put AutoDrive in /usr/sbin at first, but as the files grew I didn`t want the mess it made.
That`s why I started naming all the files with the apps. name so they`re all grouped together.
As the number of files grew for each app. I decided it`d be best to give them their own dirs.
So /root/my-applications seemed best, except when you want them to work for most Linuxes.
But most of Puppy`s apps. are in /usr/local in their own dirs., so it`s really the best place for them.
Neither app. needs to be in the path, and they`re not command line tools or common utilities.

Puppy`s installer copies the menu and startup files? And how would it know what to write to .jwmrc?
DriveMan has the "sticky" Settings option that gets added and removed from the lines in .jwmrc.

The startup files check the Settings file to see if DriveMan or AutoDrive are to be run at boot.
They don`t just only run the apps., they first test to see if they are to be run or not.
And why deleting the 3 startup files would have any effect on the Settings file is nutty.
They make no difference to the Settings file, but if Settings isn`t there, the apps. won`t bootup.

I found the 2 checkbox problems, they`re still the same as when the startup files were different.
Just comment out the 2 "if" statements at these lines ( I think ): 148, 149, 152, 153:

Code: Select all

btnSET() {
	. $Settings
#	if [ -e /root/Startup/$dmF.startup ];then			# set driveman boot display
#		writeSET dmBOOT=true ;else writeSET dmBOOT=false ;fi
	if [ "`grep DM_MAIN /root/.jwmrc |grep sticky`" ];then		# set driveman sticky display
		writeSET dmSTICKY=true ;else writeSET dmSTICKY=false ;fi
#	if [ -e /root/Startup/$adF.startup ];then				# set autodrive boot display
#		writeSET adBOOT=true ;else writeSET adBOOT=false ;fi
8-bit; All of the first boot files are only copied if they don`t exist. The test below, " ! -e ".

Code: Select all

if [ ! -e /root/Setup/$dmF.startup ];then cp -f $adPF.startup /root/Startup ;fi

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

#24 Post by 8-bit »

Sunburnt, I had never examined the files written to /root/Startup and just assumed they started the things the name referred to.
Bad assumption on my part! :oops:
So that one is solved for me.

Now if I could track down exactly what is happening with the settings file when I run it on Puppy 432, that would be great.

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

#25 Post by sunburnt »

8-bit; I`ve been looking at the function that modifies the setting in the Settings file ( line 42 ):

Code: Select all

writeSET() { VAR=`echo $1 |sed 's/=.*$//'`
	echo "$(<$Settings)" |sed "s/$VAR=.*$/$1/" > $Settings			# write setting to file
}
You could try experimenting with the 2 lines of code to see what they do to the setting.
Call the function like this: /mnt/home/apps/driveman/driveman writeSET setHT=22
The variable assignment you give it should replace the one that was there.
If the variable assignment in the Settings file was: set=8 , now it should be: setHT=22

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

#26 Post by big_bass »

Hey Terry (sunburnt)


before I get into the details I spent a few hours last night and a few more this morning :D because I want another mount tool
as a stand alone app



And why deleting the 3 startup files would have any effect on the Settings file is nutty.
They make no difference to the Settings file, but if Settings isn`t there, the apps. won`t bootup.
as strange as that may be it lead me to comment out the
writing of those three files (while in the testing stage)
I run out of the driveman folder

I am not worried about that part of the code ATM because
I made a tmp fix so I consider it a minor glitch I will figure out

thanks again for removing probepart and pupstate :D
--------------------------------------------
version 7 created a small new small glitch
it requires you to click on Rox_Filer (twice) but not like windows
the program opens an empty folder
then the second time around after the box closes and opens again clicking Rox_Filer does work
and show the contents of the folder

I did mount the drives before selecting rox


------------------------------------------------
I think that its fine on puppy to use my-applications
since every one has it

an install script aka doinst or pinstall
could handle jwm
just to get it out of the main code (if possible)
so if you run ice or another manager
small tweaks can be easily made

*out side of puppy its no big deal for me to modify
the package to run on another linux version
I just am taking advantage of the massive time saved
if you filter out those files first

whats the gain ? you will also eliminate the differences
in puppy versions too by not depending on any code from it


Joe

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

#27 Post by sunburnt »

Hi big_bass; Amazingly I`m having the same ROX thing happen, will look into it.
FYI... Clicking the ROX menu item should mount if not mounted ( probably the empty ROX ).

# Repeat of the post above:
I found the 2 bootup checkbox problems, I changed the bootup but not handler code.
Just comment out the 2 "if" statements at these lines: 148, 149, 152, 153 ( I think ):

Code: Select all

btnSET() {
   . $Settings
#   if [ -e /root/Startup/$dmF.startup ];then         # set driveman boot display
#      writeSET dmBOOT=true ;else writeSET dmBOOT=false ;fi
   if [ "`grep DM_MAIN /root/.jwmrc |grep sticky`" ];then      # set driveman sticky display
      writeSET dmSTICKY=true ;else writeSET dmSTICKY=false ;fi
#   if [ -e /root/Startup/$adF.startup ];then            # set autodrive boot display
#      writeSET adBOOT=true ;else writeSET adBOOT=false ;fi
I could add a line to check for the /root/.jwmrc file first ( if not a Puppy distro.).
For Ice WM tell me if you know how to set: " TaskBar No Show" and "Sticky On Desktop".

The 3 files... They are the only way DriveMan and AutoDrive start and mount at boot.
The /root dir. is not used usually in most Linuxes, the used dir. is of course.
Where would be a good place to put the 3 files so they`ll work universally?
And then there`s the driveman.desktop file for the menus, it needs a fix for that also.

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

#28 Post by sunburnt »

Fix for the ROX menu item unmounting the drive. It`s easiest to just post the entire function:

Code: Select all

btnMNT() {
	if [ "$sysDRV" = "$1" ];then																														# if system drive, rox, exit
		[ "$2" = rox ]&& rox `mount |grep $1 |cut -d ' ' -f 3` ; return ;fi
	drvInfo=$(<$drvINFO)																																			# get GUIs drive list
	ROW=`echo "$drvInfo" |grep $1`																										# get drive list device ROW
	if [ ! "`mount |grep $1`" ];then														## mount drive
		if [[ "$1" = sr* ]];then
			if [ "`echo $(disktype /dev/$1) |sed 's/^.*size //;s/ .*$//'`" = 0 ];then			# blank CD-DVD
				xmessage -nearmouse -title " ERROR" "  Blank CD-DVD in Drive. " ; return ;fi
			disktype /dev/$1 2> /tmp/dt.tmp
			if [ "`echo $(</tmp/dt.tmp) |grep 'No medium found'`" ];then								# no CD-DVD
				xmessage -nearmouse -title " ERROR" "  No CD-DVD in Drive. " ; return ;fi
		fi
		mkdir -p /mnt/$1 ; mount /dev/$1 /mnt/$1
		if [ $? -eq 0 ];then NEW=`echo $ROW |sed "s/||/|M|/"`								# if mount successful
			echo "$drvInfo" |sed "s/$ROW/$NEW/" > $drvINFO
		else xmessage -nearmouse -title " ERROR" "  Failed to Mount Device: $1  " ; return		# mount failed
		fi
	elif [ ! "$2" ];then																									## unmount drive
		NEW=`echo $ROW |sed "s/M//"`
		rox -D /mnt/$1 ; umount /dev/$1
		if [ $? -gt 0 ];then																																				# if unmt failed, error
			xmessage -title " ERROR" "  Failed to UnMount Drive. " ; return ;fi
		echo "$drvInfo" |sed "s/$ROW/$NEW/" > $drvINFO
	fi
	[ "`mount |grep $1`" ]&& [ "$2" ]&& rox /mnt/$1													#if mounted and rox arg.
	killPS DRIVEMAN ; $dmPF &
}

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

#29 Post by big_bass »

Terry (sunburnt)

check your PM mail

Joe

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

#30 Post by big_bass »

Hey Terry (sunburnt)


with the two latest patches you posted

it works great!!!! 8)

thanks

Joe

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

#31 Post by 8-bit »

I just ran the driveman.uninstall script and found a potential problem.
With it in the driveman directory, if you select the button to remove both driveman and autodrive, it crashes without removing the autodrive directory.
I moved it outside of the driveman directory and it worked.
But in that case another line needs to be added to delete driveman.uninstall.

I also did some modifications to driveman and driveman.set.gtk3 and with them, I got it to run on Puppy 431 and Puppy 432.

Also, FYI, when I run driveman from a terminal, I get an error message of DEV being a directory.

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

#32 Post by sunburnt »

big_bass; So did you then try replacing the 3 files in: /root/Startup ?
The 2 don`t cause the apps. to boot automatically, they check the Settings file for "true".
And the file: 0_mountdrives.startup only mounts drives if they are listed in:
/mnt/home/apps/driveman/drvboot.lst

Give these last few files a try and let me know, I`d like to release the last beta version.

Terry 8)

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

#33 Post by 8-bit »

A nice addition to your driveman program would be for it to autodetect a storage device that was plugged in while it was running and update accordingly.
When I had DM displayed and plugged in a USB flash stick, it was not detected without a restart of driveman.

Also, what about making it a tray application that would pop up?
That way, those that love their nice desktop background pics would not have them cluttered with a DM window.

I know you love these types of suggestions. :wink:

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

#34 Post by sunburnt »

Hi 8-bit; DM does show USBs plugged in. For me anyway...
The tray app. is not a bad idea at all...

big_bass; Does DM show and remove USB drives that AutoDrive mounts and unmounts for you?

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#35 Post by technosaurus »

8-bit wrote: But in that case another line needs to be added to delete driveman.uninstall.

Code: Select all

#deletes this script
rm $0
$0 is a good little tool for making busybox style scripts that share code and/or functions within the same file. By making symlinks to your bash script with different names, you can change how it operates by checking `basename $0` to determine which functions or code blocks to use.

Code: Select all

#very rough example dir2tar with symlinks for dir2tgz, dir2tbz, dir2xz ...
DIRNAME=$1
tar -cf ${DIRNAME}.tar ${DIRNAME}
[ "`basename $0`" == "dir2tgz" ] && gzip ${DIRNAME}.tar
[ "`basename $0`" == "dir2tbz" ] && bzip ${DIRNAME}.tar
[ "`basename $0`" == "dir2txz" ] && xz ${DIRNAME}.tar
...
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

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

#36 Post by 8-bit »

sunburnt wrote:Hi 8-bit; DM does show USBs plugged in. For me anyway...
The tray app. is not a bad idea at all...

big_bass; Does DM show and remove USB drives that AutoDrive mounts and unmounts for you?
My mistake! :oops:
I did not have autodrive set up to start when booting or restarting X in the settings!
It works!

And just out of curiosity, is this to be a replacement for Hotpup and Pmount?
Also, can it be given a selection to mount selected drives on startup?
The word is selected, not all.

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

#37 Post by sunburnt »

Thanks technosaurus and 8-bit; I didn`t try the uninstall and didn`t think to delete AutoDrive first!
8-bit; DriveMan and AutoDrive doen`t restart X, DriveMan does restart JWM if needed.
I`m not sure what you`re saying about mounting drives at bootup.
If you select a drive in DriveMan`s list and click [ Set Boot } a "B" should appear in the list.
And at bootup the selected drive will be mounted automatically.

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

#38 Post by 8-bit »

Thank you for the explanation of the B option. It works as advertised.
I just tried my moded version on the new pup44-a1 (community version),
and had major problems with that OS doing strange things.
driveman still worked as expected, but It could be that since it installs with a script rather than going through Puppy Package Manager, that messed things up.
Of course, puppy 44 uses a strange menu system as it is partially based on stardust.

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

#39 Post by sunburnt »

Yep, it just keeps changing like Linux itself. There doesn`t seem to be any plan, it just happens.
I`ve rewritten apps. several times so they`ll work again, sometimes in the same Puppy version.
If a new version does new hardware or maybe new features, well... maybe. Why else change?
I find a Puppy version that works well on my PCs, and I stay with it, usually 2 per version.

I`ve seen programmers and developers come and go in my 5 years here, mostly programmers.
Lots of time and effort spent with a short shelf life for any app. written. Too much effort...
Effort that truly improves "Linux" is well spent, but most of it amounts to window dressing.
Linux "could" smash M$ Wenners and they know it, but they don`t worry, Linux is scattered.

Effort put to cleaning the legacy mess and especially gtkdialog would be very well spent.
gtkdialog is sooo important, but it`s also sooo hard to use that it`s the biggest bane of Puppy.
And... It would be one of the easier things to straighten out! But without agreement... Nada...
Tried TinyCore? Squash and Web apps. It`s more for hobbyists, but that`s where Puppy started.

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

#40 Post by 8-bit »

I do not think it is anything driveman has done! I think it is a glitch in Puppy 44 and have reported it as such.
By the way, with mods I have made to your program, I now can use it with no problems and no errors other than 2.
One is an error of DEV being a directory.
The other is that if a drive is already mounted and you click on ROX from the popup, the way the btnMNT routine is written, the mounted drive is unmounted and then ROX displays an empty directory.
Could a conditional if be added that if $2=rox the umount would be bypassed and rox display the mounted partition? I can live with the way it is now, since I know what is happening.
Also, have you figured out how to get DM not to display the extra mounted directory with the blank name that I assume is the filesystem in memory?

And last, to get driveman to work with my Puppy versions 431 and 432, I did modifications to driveman and driveman.set.gtk3 to where driveman.gtk3 never has to call any functions in driveman to make changes to the settings file!
In my case, that means I can remove all the functions that call writeSET in driveman if I wanted.
Other than getting it's screen position from driveman, I have driveman.set.gtk3 set up to make all changes to the settings file on its own.

Post Reply