Reply
Thread Tools
Posts: 359 | Thanked: 162 times | Joined on Jan 2011 @ Budapest
#1
I was under the impression you can write scripts and put them in /etc/init/apps. But I can't seem to get mine to work. I would like to write one to delete /home/user/.local/share/applications/simatk.desktop at startup, which is a useless app put there by my SIM card provider and which is recreated at every startup if it is not present.

Is there a tutorial somewhere or can we have a little thread to walk through writing scripts to run at startup and solve problems, etc?
 
Posts: 359 | Thanked: 162 times | Joined on Jan 2011 @ Budapest
#2
So here is what I did. First I wrote a script to delete the offending .desktop file:

Code:
sleep 45
rm /home/user/.local/share/applications/simatk.desktop
The long wait is needed because if the .desktop file was previously deleted it takes up to half a minute for it to be recreated on the next startup.

That is saved as /usr/include/del-t-mobile.sh

Then I executed

Code:
chmod a+rx /usr/include/del-t-mobile.sh
to make sure the script is executable. Note that the script only works when it is run as user, not as root, but it does work.

Now I created the following file

Code:
description "Deletes the program icon for T-Mobile SIM card"

author "aebl"

stop on stopping xsession

console none

nice 2

exec /usr/bin/aegis-exec -s -u user -l  "sh /usr/include/del-t-mobile.sh"
which I then saved as /etc/init/apps/t-mobile.conf

In theory this should work, but it doesn't. Running the script del-t-mobile.sh manually works fine; for some reason t-mobile.conf does not call it at startup.

So what am I doing wrong?
 
ammyt's Avatar
Posts: 1,918 | Thanked: 3,118 times | Joined on Oct 2010 @ My pants
#3
Well, on my N900, if I ever want to start a script at bootup, I usually create a file in etc/event.d like:
/etc/event.d/dbus-scripts-session which I used to start dbus-scripts when my N900 starts. it contains:
Code:
start on started hildon-desktop
stop on stopping hildon-desktop

console none

exec run-standalone.sh /usr/sbin/dbus-scripts --session

respawn
EDIT: Wait, you put that in init,d, are you sure you did a "update-rc.d <script> defaults" afterwards?

Last edited by ammyt; 2011-12-17 at 11:00.
 
Posts: 359 | Thanked: 162 times | Joined on Jan 2011 @ Budapest
#4
I believe this is disabled by aegis on the N9. I cannot create files in /etc/init.d/ even as root. The directory /etc/init/apps is, I believe, intended for applications to be able to have daemons, and I'm sort of piggy-backing on that... still stuck
 
Moderator | Posts: 5,320 | Thanked: 4,464 times | Joined on Oct 2009
#5
Originally Posted by noetus View Post
I believe this is disabled by aegis on the N9. I cannot create files in /etc/init.d/ even as root. The directory /etc/init/apps is, I believe, intended for applications to be able to have daemons, and I'm sort of piggy-backing on that... still stuck
Interested in hearing the solution to this so I can add it to my how-to's
 
Posts: 1,751 | Thanked: 844 times | Joined on Feb 2010 @ Sweden
#6
Try doing it with "exec sh /usr/include/del-t-mobile.sh" as i don't think the user are allowed to do that

But i am sure there is a cleaner way in doing this. Isn't that just an app icon?
__________________
You like what i do? Donate!

Make your desktop look awesome - use the AwOken Theme with the AwOken Icon Theme.

Add me on twitter @almehdin
Visit the swedish maemo/meego community forums

Last edited by AlMehdi; 2011-12-20 at 10:17.
 
Posts: 359 | Thanked: 162 times | Joined on Jan 2011 @ Budapest
#7
Originally Posted by AlMehdi View Post
But i am sure there is a cleaner way in doing this. Isn't that just an app icon?
It is just an icon and I'd love to know a cleaner way of doing it.. but it gets created on every boot of the device, even if the file already exists (so adding NotShowIn=X-MeeGo; to it only works until the next reboot). I also tried modifying permissions on it but it just got rewritten with the 'correct permissions on the next boot.
 
Posts: 1,751 | Thanked: 844 times | Joined on Feb 2010 @ Sweden
#8
Have you looked in "/etc/init/xsession*" or "/etc/default/*" ? Be careful though as changing this things could brick the phone.
__________________
You like what i do? Donate!

Make your desktop look awesome - use the AwOken Theme with the AwOken Icon Theme.

Add me on twitter @almehdin
Visit the swedish maemo/meego community forums
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#9
/etc/init/apps/*.conf autostart always work fine. autostart started after some seconds after reboot.
 
Posts: 31 | Thanked: 16 times | Joined on Mar 2010
#10
Running a script using "exec <script>" will run it as root. Trying to use "exec aegis-exec -s -u user" will run the script as nobody even though you specified user. I think you need to package your script in a .deb to get it signed by aegis when you install it to be able to run it as a different user with aegis-exec.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:10.