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 Wed 19 Jun 2013, 06:09
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 Posts_count  
Author Message
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Tue 10 Jan 2012, 19:11    Post_subject:  [SOLVED] Special Request to ShellScript (Step 1)
Sub_title: 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

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available

Edited_times_total
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 4016
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.

Edited_time_total
Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 1564
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

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 4016
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: 1564
Location: Germany

PostPosted: Wed 11 Jan 2012, 06:59    Post_subject: Special Request to ShellScript (#!/bin/sh or #!/bin/bash)
Sub_title: 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

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send_private_message 
big_bass


Joined: 13 Aug 2007
Posts: 1736

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

_________________
slackware 14
Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Wed 11 Jan 2012, 16:58    Post_subject: Special Request to ShellScript (#!/bin/sh or #!/bin/bash)
Sub_title: 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

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0549s ][ Queries: 12 (0.0042s) ][ GZIP on ]