Buat file baru di /usr/share/polkit-1/actions/
sudo nano /usr/share/polkit-1/actions/FlashTool.policy
dan tambahkan baris di bawah ini:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.run-FlashTool">
<description>Run FlashTool</description>
<message>Authentication is required to run FlashTool</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/home/natasha/FlashTool/FlashTool</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
</action>
</policyconfig>
Kemudian buat file baru /home/natasha/FlashTool/
nano /home/natasha/FlashTool/flashtool-pkexec
dan tambahkan baris di bawah ini:
#!/bin/sh
pkexec "/home/natasha/FlashTool/FlashTool" "$@"
Gunakan baris di bawah ini untuk Exec
dalam desktop
file Anda :
Exec=/home/natasha/FlashTool/flashtool-pkexec
Diuji pada sistem saya Ubuntu 15.04 GNOME dengan file-file berikut:
$ cat /usr/share/applications/gedit.root.desktop
[Desktop Entry]
Name=Gedit as root
GenericName=Text Editor
X-GNOME-FullName=
Comment=
Exec=gedit-pkexec
Icon=gedit
Terminal=false
Type=Application
Categories=GNOME;System;Filesystem;Settings;
StartupNotify=true
X-Ubuntu-Gettext-Domain=gedit
$ cat /usr/share/polkit-1/actions/gedit.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.run-FlashTool">
<description>Run FlashTool</description>
<message>Authentication is required to run FlashTool</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gedit</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
</action>
</policyconfig>
$ cat /usr/bin/gedit-pkexec
#!/bin/sh
pkexec "gedit" "$@"