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 Tue 19 Jun 2018, 16:48
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
[SOLVED] Special Request to ShellScript (Step 1)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 10 Jan 2012, 19:11    Post subject:  [SOLVED] Special Request to ShellScript (Step 1)
Subject description: Promoting the user-friendliness of Puppy
 

Hello to all of the experts.

I am doing parts on a work "Promoting the user-friendliness of Puppy". When it is finished it should made the all new puppy linux user able to switch easily between "beginner", "Intermediary" and "advanced" so the menu shows only entries related to this selection.

What is needed, is a script running in background as long as puppy runs (or automatically started after installing new software and refreshing the menu).

1. It should observe the "applications" directory.
2. If new program is installed it should find the new .desktop file in "applications" and move it to a (the) specified directory and set a link to it in "applications".
3. It should know the difference between a real file and a link, so that only real files has been moved!

How can i do this?

I have made a .pet, but this one only works as long as you do not install new software.

Edit - 2012-01-12: .pet removed - not longer needed!
Please read the post before downloading and installing!
http://murga-linux.com/puppy/viewtopic.php?p=595349#595349

Any suggestions?, how this could be done?

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.

Last edited by RSH on Thu 12 Jan 2012, 00:35; edited 2 times in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5087
Location: Arizona, U.S.A.

PostPosted: Wed 11 Jan 2012, 00:00    Post subject:  

Hi RSH; This should do what you want:
Code:
#!/bin/sh
Apps=/usr/share/applications/*
Apps0=( Path to move desktop files to... eg.: "/usr/share/apps" )
Files=`find $Apps -type f`   ### " -type f " makes it find files only
echo "$Files" |while read F
do
   mv $F $Apps0
   ln -s $Apps0/`basename $F` $F
done

.
You could test it by making a fake dir. and copy a few desktop files to it.
Then also make a few fake links in the dir.
And make the dir.: /usr/share/apps

Then be sure to change the path for $Apps to your fake test dir.

# If you`re confused or need more help just ask! T.

Last edited by sunburnt on Wed 11 Jan 2012, 04:11; edited 1 time in total
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Wed 11 Jan 2012, 00:40    Post subject: I knew you guys are fantastic!  

Thank you, Sunburnt.

I knew you guys are fantastic. This is exactly what i would have written, if it could have been done in German.

I do not know enough about the syntax and commands of shellscript - especially about the "-f", "-r", "-a", "-whatever"-things.

I am now at "work" (it's fun, not work!)

Thank you again!

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5087
Location: Arizona, U.S.A.

PostPosted: Wed 11 Jan 2012, 04:08    Post subject:  

RHS..... I made a mistake...

This first line needs a /* at the end of it.

Like this:

Apps=/usr/share/applications/*

This keeps "find" from outputting only the path at the start of the list it makes.

# I fixed the code above... Good luck... Terry
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Wed 11 Jan 2012, 06:59    Post subject: Special Request to ShellScript (#!/bin/sh or #!/bin/bash)
Subject description: Actually solved - just some testings and then tune this one - because of my extended menu structure
 

Quote:
RSH..... I made a mistake...

This first line needs a /* at the end of it.

Like this:

Apps=/usr/share/applications/*

This keeps "find" from outputting only the path at the start of the list it makes.

# I fixed the code above... Good luck... Terry


Thanks to you, Terry, i have this one actually solved - just some testings and then tune this one - because of my extended menu structure. I have had already found the missing "/" and must have made some modifications, because it has created mysterious symbolic links, if no files were found in /usr/share/applications - but now it works very fine. Very Happy

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1742

PostPosted: Wed 11 Jan 2012, 10:27    Post subject:  

Hey RSH

you can get some more ideas to add to your program here


original thread
http://murga-linux.com/puppy/viewtopic.php?search_id=633140712&t=40277

modified app here
http://murga-linux.com/puppy/viewtopic.php?t=40277&search_id=633140712&start=39
http://www.puppy2.org/slaxer/Pmenu-1-i486-3_SLXR.txz
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Wed 11 Jan 2012, 16:58    Post subject: Special Request to ShellScript (#!/bin/sh or #!/bin/bash)
Subject description: SOLVED (step 1) and running in LazY Puppy 5.2.8-4
 

SOLVED (step 1) and running in LazY Puppy 5.2.8-4

http://murga-linux.com/puppy/viewtopic.php?t=75080

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0655s ][ Queries: 11 (0.0195s) ][ GZIP on ]