Author Topic: How Do I Edit Menu Entry?  (Read 2298 times)

Offline bcat23

  • Jr. Member
  • **
  • Posts: 36
How Do I Edit Menu Entry?
« on: January 14, 2011, 03:29:59 PM »
I am having trouble with Spideroak. On the software portion of the forum someone suggested a fix that involves writing a script before running Spideroak. Here is the thread:

http://www.pclinuxos.com/forum/index.php/topic,85378.msg711686.html#msg711686

Once I create the script, how do I edit the menu entry to change the command to

spiderfix ; SpiderOak?

Thanks.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How Do I Edit Menu Entry?
« Reply #1 on: January 14, 2011, 03:36:16 PM »
The file to edit is the .desktop file. The .desktop files are in /usr/share/applications.

Follow the advice you received there, and you should be fine.


Offline bcat23

  • Jr. Member
  • **
  • Posts: 36
Re: How Do I Edit Menu Entry?
« Reply #2 on: January 14, 2011, 04:33:20 PM »
Here is my current desktop file for Spideroak:

Code: [Select]
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=SpiderOak Backup
Comment=SpiderOak Secure Backup and File Sharing Client
Terminal=false
Categories=SpiderOak;Network;X-MandrivaLinux-Internet-WebBrowsers;
Icon=/usr/share/pixmaps/spideroak/spideroak.png
Exec=/usr/bin/SpiderOak


How do I change the executable to run the script? Do I change the last line somehow? Thanks.
« Last Edit: January 14, 2011, 04:35:54 PM by bcat23 »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11687
  • ----IOFLU----
Re: How Do I Edit Menu Entry?
« Reply #3 on: January 14, 2011, 04:51:22 PM »
Here is my current desktop file for Spideroak:

Code: [Select]
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=SpiderOak Backup
Comment=SpiderOak Secure Backup and File Sharing Client
Terminal=false
Categories=SpiderOak;Network;X-MandrivaLinux-Internet-WebBrowsers;
Icon=/usr/share/pixmaps/spideroak/spideroak.png
Exec=/usr/bin/SpiderOak


How do I change the executable to run the script? Do I change the last line somehow? Thanks.

What does the script look like?
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How Do I Edit Menu Entry?
« Reply #4 on: January 14, 2011, 04:59:10 PM »
Did you create the spiderfix script and install it as described in the thread you linked to?

If so, Exec=/usr/local/bin/spiderfix ; /usr/bin/SpiderOak is the change to make.


Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11687
  • ----IOFLU----
Re: How Do I Edit Menu Entry?
« Reply #5 on: January 14, 2011, 05:07:33 PM »
Did you create the spiderfix script and install it as described in the thread you linked to?

If so, Exec=/usr/local/bin/spiderfix ; /usr/bin/SpiderOak is the change to make.



Just curious, is there a reason to use full paths in LXDE, when the applications' locations are already in the users default $PATH?
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How Do I Edit Menu Entry?
« Reply #6 on: January 14, 2011, 05:12:16 PM »
LOL You're right. I was going by what the user posted.
Quote
.....
Exec=/usr/bin/SpiderOak


Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11687
  • ----IOFLU----
Re: How Do I Edit Menu Entry?
« Reply #7 on: January 14, 2011, 05:23:01 PM »
LOL You're right. I was going by what the user posted.
Quote
.....
Exec=/usr/bin/SpiderOak



Hey, you put it together, so I just wanted to know if there was a necessity for full paths in the .desktop files in LXDE. I don't normally do that in KDE, so didn't want to give wrong advise if the full paths were somehow necessary. I figured you'd be the guy to ask!  ;D ;D
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How Do I Edit Menu Entry?
« Reply #8 on: January 14, 2011, 05:33:39 PM »
LOL You're right. I was going by what the user posted.
Quote
.....
Exec=/usr/bin/SpiderOak



Hey, you put it together, so I just wanted to know if there was a necessity for full paths in the .desktop files in LXDE. I don't normally do that in KDE, so didn't want to give wrong advise if the full paths were somehow necessary. I figured you'd be the guy to ask!  ;D ;D

 ;D Not necessary, no.

Offline bcat23

  • Jr. Member
  • **
  • Posts: 36
Re: How Do I Edit Menu Entry?
« Reply #9 on: January 14, 2011, 06:09:03 PM »
I am close but seem to be missing something. I edited the script and desktop file. When I click the menu item, I am asked for my root password. After entering the password, nothing happens. If I then type SpiderOak in a terminal, SpiderOak opens.

Here is the content of my script named spiderfix:

Code: [Select]
gksu "cp -f /usr/lib/SpiderOak/library.zip-backup /usr/lib/SpiderOak/library.zip"
Here is the contents of my .desktop file:

Code: [Select]
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=SpiderOak Backup
Comment=SpiderOak Secure Backup and File Sharing Client
Terminal=false
Categories=SpiderOak;Network;X-MandrivaLinux-Internet-WebBrowsers;
Icon=/usr/share/pixmaps/spideroak/spideroak.png
Exec=/usr/local/bin/spiderfix ; /usr/bin/SpiderOak

Here are the permissions of the spiderfix script (placed in folder /usr/local/bin):

Code: [Select]
-rwxr-xr-x 1 root root 81 Jan 14 19:05 spiderfix*

Is there a step I am missing or have I made an error somewhere? Thanks.



Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11687
  • ----IOFLU----
Re: How Do I Edit Menu Entry?
« Reply #10 on: January 14, 2011, 06:41:01 PM »
I am close but seem to be missing something. I edited the script and desktop file. When I click the menu item, I am asked for my root password. After entering the password, nothing happens. If I then type SpiderOak in a terminal, SpiderOak opens.

Here is the content of my script named spiderfix:

gksu "cp -f /usr/lib/SpiderOak/library.zip-backup /usr/lib/SpiderOak/library.zip"

Here is the contents of my .desktop file:

Code: [Select]
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=SpiderOak Backup
Comment=SpiderOak Secure Backup and File Sharing Client
Terminal=false
Categories=SpiderOak;Network;X-MandrivaLinux-Internet-WebBrowsers;
Icon=/usr/share/pixmaps/spideroak/spideroak.png
Exec=/usr/local/bin/spiderfix ; /usr/bin/SpiderOak

Here are the permissions of the spiderfix script (placed in folder /usr/local/bin):

Code: [Select]
-rwxr-xr-x 1 root root 81 Jan 14 19:05 spiderfix*

Is there a step I am missing or have I made an error somewhere? Thanks.


The script will run as root without the gksu when run from /usr/local/bin.

------------------------------------------------------------------------------------------------
#!/bin/bash
# Name: spiderfix
# Purpose: copy /usr/lib/SpiderOak/library.zip-backup to /usr/lib/SpiderOak/library.zip

cp -f /usr/lib/SpiderOak/library.zip-backup /usr/lib/SpiderOak/library.zip


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

Copy the purple text above into your text editor, press the Enter key to start a new line, then save the file as spiderfix. As root, copy the file to /usr/local/bin, and make executable.

Since you already have your own script, with the correct name, in /usr/local/bin, you can, as root, open the existing script in your text editor, delete the text already there, then copy the above purple text into it, press the Enter key to start a new line, then save the file. The permissions posted show it's already executable.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline bcat23

  • Jr. Member
  • **
  • Posts: 36
Re: How Do I Edit Menu Entry?
« Reply #11 on: January 14, 2011, 07:15:19 PM »
I modified the script as described above to remove the gksu part of the command. Now I am getting a permissions error:


Code: [Select]
cp: cannot remove `/usr/lib/SpiderOak/library.zip': Permission denied
Does anyone have any thoughts on how to fix this? Am I still making an error somewhere? Thanks.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11687
  • ----IOFLU----
Re: How Do I Edit Menu Entry?
« Reply #12 on: January 14, 2011, 07:40:44 PM »
I modified the script as described above to remove the gksu part of the command. Now I am getting a permissions error:


Code: [Select]
cp: cannot remove `/usr/lib/SpiderOak/library.zip': Permission denied
Does anyone have any thoughts on how to fix this? Am I still making an error somewhere? Thanks.

What are the permissions on /usr/lib/SpiderOak/library.zip?

[<you>@localhost ~]$ ls -l /usr/lib/SpiderOak/ |grep library                        <Enter>

Post your results.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline bcat23

  • Jr. Member
  • **
  • Posts: 36
Re: How Do I Edit Menu Entry?
« Reply #13 on: January 14, 2011, 07:46:32 PM »
Here are the permissions for library.zip:

Code: [Select]
-rwxr-xr-x 1 root root  6825627 Jan 14 21:23 library.zip*
-rwxr-xr-x 1 root root  6825627 Jan 14 17:09 library.zip-backup*

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11687
  • ----IOFLU----
Re: How Do I Edit Menu Entry?
« Reply #14 on: January 14, 2011, 11:46:34 PM »
Here are the permissions for library.zip:

Code: [Select]
-rwxr-xr-x 1 root root  6825627 Jan 14 21:23 library.zip*
-rwxr-xr-x 1 root root  6825627 Jan 14 17:09 library.zip-backup*


OK, I figured out why this works for me on the one application I use a similar menu entry for. You need to do two things. As root;

[root@localhost ~]# cd /usr/lib/SpiderOak                                   <Enter>

From here you need to make library.zip writable by group root.

[root@localhost SpiderOak]# chmod 775 library.zip                     <Enter>

To be sure, also do this to library.zip-backup

[root@localhost SpiderOak]# chmod 775 library.zip-backup                     <Enter>

Open PCC --> System --> Manage users on system, right click on your user and choose edit.



Click the Groups tab, and add yourself to the root group.



Click the OK button, then close PCC.

To check this, I installed SpiderOak, opened Konqueror - Super User Mode, and navigated to /usr/lib/SpiderOak. I copied library.zip to library.zip-backup then used the mv command to rename library.zip to library.zip-safe. This left no library.zip at all.

From the command line of the Konqueror dropdown terminal, I entered these commands;

[root@fatman SpiderOak]# touch library.zip                    <Enter> 
[root@fatman SpiderOak]# chmod 775 library.zip                  <Enter> 

This gives an empty file named library.zip, with the same permissions as the actual files, as seen here;



I changed the menu command as shown here;



and as root added the spiderfix script to /usr/local/bin, and made it executable.
       
Clicking on the SpiderOak Backup menu entry brought up this window, without any errors.



In the Konqueror terminal, re-running the previous command, brought these results.



showing that the copying was effected from the menu entry, and the application properly launched thereafter.

For those who may think this a security problem, being a member of the root group does not give one full, or even broad root access. It only allows write access to those chosen few files that root grants group writing privileges to. In this case it grants the ability to restore a single damaged file from a single backup file, granted to a single normal user, who also happens to be root, when he uses the root password.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...