maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How to give permission to a script file inside a deb? (https://talk.maemo.org/showthread.php?t=89562)

flotron 2013-03-22 21:05

How to give permission to a script file inside a deb?
 
I'm making a theme packaged on deb.
The theme require to modify some files inside /usr/share/themes/base/meegotouch. It modifies succesfully those file s when i add the script to the posinst file BUT now i want to modify that files by a desktop icon that run an SH script that run commands like /sbin/initctl restart xsession/mthome or symlink inside /usr/share/themes/base/meegotouch/libmeegotouchhome/style but these ones doesn't work.

I don't have permission? I tried chmod +x script.sh on the postinst but no luck

Maybe the script should be placed in other folder? (now is in /opt/theme)

elros34 2013-03-22 21:19

Re: How to give permission to a script file inside a deb?
 
I guess you need to be root user so try run commands with sudo.

flotron 2013-03-22 21:24

Re: How to give permission to a script file inside a deb?
 
but if you run commands in sudo the user must enter the password?
and why this script is working when is inside the postinst but not in the script.sh?

peterleinchen 2013-03-22 21:41

Re: How to give permission to a script file inside a deb?
 
You need to put a file "myApp.sudoers" into /etc/sudoers.d/
with a content like
Quote:

user ALL = NOPASSWD: /path/to/script/scriptname
and call in postinst 'update-sudoers'.
Then you may call the script with sudo without requiring a password.

--edit
This guide is only valid for normal debian based systems. For Harmattans cripped aegisfs there needs to be obeyed a few things more ...

flotron 2013-03-22 21:55

Re: How to give permission to a script file inside a deb?
 
sorry for be insisten but why this script is working when is inside the postinst but not in the script.sh?

peterleinchen 2013-03-22 22:00

Re: How to give permission to a script file inside a deb?
 
postinst is executed as root.
Did you try to run the script with sudo or as root?

flotron 2013-03-22 22:26

Re: How to give permission to a script file inside a deb?
 
So.. if i execute this: ln -s /opt/mytheme /usr/share/themes
With sudo would be:

Code:

sudo ln -s /opt/mytheme usr/share/themes

flotron 2013-03-22 22:54

Re: How to give permission to a script file inside a deb?
 
Quote:

Originally Posted by peterleinchen (Post 1330942)
You need to put a file "myApp.sudoers" into /etc/sudoers.d/
with a content like
and call in postinst 'update-sudoers'.
Then you may call the script with sudo without requiring a password.

not working :(

I tried to add sudo in the desktop icon too but nothing..:confused:

Code:

[Desktop Entry]
Type=Application
Name=My Theme
Exec=sudo /opt/mytheme/changer/script.sh
Icon=/opt/mytheme/icon/icon.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable


peterleinchen 2013-03-22 23:14

Re: How to give permission to a script file inside a deb?
 
Instead of guessing around: what exactly is not working? Which errors?
What is the content of your script?
Forgot the shebang?
Does the script work when executed as root?
???

flotron 2013-03-22 23:23

Re: How to give permission to a script file inside a deb?
 
Sorry i forgot to answer that..

Yes is working manually via terminal with root


All times are GMT. The time now is 17:48.

vBulletin® Version 3.8.8