Improve the call for root permissions

Registered by YannUbuntu on 2012-03-08

Discussion started on https://bugs.launchpad.net/ubuntu/+bug/806291

Currently, Boot-Repair's desktop file calls the "boot-repair" command.
The "boot-repair" script is very simple: it fills a variable (APPNAME=boot-repair), then calls another function (g2slaunch, located in /usr/share/boot-sav/gui-g2slaunch.sh ).
The "g2slaunch" script checks if it has been launched with root privileges. If not, it runs $APPNAME with root privileges (gksudo $APPNAME if gksudo is on the system, else gksu, else sudo or su).
You can also check the code here: http://anonscm.debian.org/gitweb/?p=collab-maint/boot-repair.git

Remark: OS-Uninstaller does the same (except APPNAME=os-uninstaller), so that the g2slaunch script can be used by both applications.

This blueprint is to discuss how this could be improved.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
YannUbuntu on 2012-03-09

Related branches

Sprints

Whiteboard

- Fabrice: If you already have a script that chooses the best 'su' command, why not using it in the desktop file, then? That would be better than having a desktop file that don't run anything because you're missing rights, IMHO.

- Yann: currently, the .desktop calls the "boot-repair" executable, which calls the script that chooses the best "su" command (e.g. it will call "gksudo boot-repair"). Do you know a better way to implement it ?

- Michael: How about creating an explicit boot-repair-wrapper script that chooses the best way to get root permissions?
As an additional precautionary action boot-repair itself could check if it has root permissons and exit otherwise. It would not try to get the permissions itself, however.
The desktop file would call boot-repair-wrapper.
If you are afraid someone might call boot-repair instead of boot-repair-wrapper because it has the nicer name, you might name them boot-repair (for the wrapper script) and boot-repair-backend or boot-repair-real (for the current boot-repair)

-Yann: i understand your suggestion Michael, it can be easily coded, but it has one drawback: this will increase the code size as the wrapper will have to be coded twice (1 for boot-repair, 1 for os-uninstaller). Is it a problem if boot-repair asks permissions itself instead of via a wrapper? i don't see any difference as the program will exit in both cases (with or without wrapper) if the user grants no permissions.
Other idea: i saw there has been an update here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492493 . I tried "pkexec boot-repair" but it fails...

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.