Skip to content

Commit

Permalink
Implement Polkit policy for WoeUSB(not working yet)
Browse files Browse the repository at this point in the history
This commit implements the polkit policy for WoeUSB.  It doesn't have effect yet as it is not installed as for now and not integrated to GUI code, you may try out by manually install polkit/com.github.slacka.woeusb.policy to /usr/share/polkit-1/actions and run `pkexec woeusb`.

Refer: polkit: polkit Reference Manual <https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html>
Related-GitHub-Issue: Support Polkit · Issue #53 · slacka/WoeUSB <https://github.com/slacka/WoeUSB/issues/53>
Signed-off-by: 林博仁 <[email protected]>
  • Loading branch information
brlin-tw committed Jun 13, 2017
1 parent edc4e41 commit 70a0d65
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions polkit/com.github.slacka.woeusb.policy
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<!--
DOC: https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html
-->
<policyconfig>
<vendor>The WoeUSB Project</vendor>
<vendor_url>https://github.com/slacka/WoeUSB</vendor_url>
<icon_name>woeusbgui-icon</icon_name>

<action id="com.github.slacka.woeusb.run-cli-using-pkexec">
<description>Run `woeusb` as SuperUser</description>
<description xml:lang="zh_TW">以超級使用者(SuperUser)身份執行 `woeusb`</description>

<message>Authentication is required to run `woeusb` as SuperUser.</message>
<message xml:lang="zh_TW">以超級使用者(SuperUser)身份執行 `woeusb` 需要通過身份驗證。</message>

<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>

<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/woeusb</annotate>
</action>

<action id="com.github.slacka.woeusb.run-cli-using-pkexec-usr-local">
<description>Run `woeusb` as SuperUser</description>
<description xml:lang="zh_TW">以超級使用者(SuperUser)身份執行 `woeusb`</description>

<message>Authentication is required to run `woeusb` as SuperUser.</message>
<message xml:lang="zh_TW">以超級使用者(SuperUser)身份執行 `woeusb` 需要通過身份驗證。</message>

<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>

<annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/woeusb</annotate>
</action>

<action id="com.github.slacka.woeusb.format-mode">
<description>WoeUSB running in --format mode.</description>
<description xml:lang="zh_TW">WoeUSB 以 --format 模式運行</description>

<message>Superuser privilege is required for WoeUSB to modify your target device's partition table, create target partiton, format target filesystem, mount and unmount target filesystem, install bootloader and etc.</message>
<message xml:lang="zh_TW">WoeUSB 需要「超級使用者(SuperUser)」權限以修改您目標裝置的分區表、建立目標分區、格式化目標檔案系統、掛載與解除掛載目標檔案系統、安裝開機載入器以及其他操作。</message>

<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>

<action id="com.github.slacka.woeusb.install-mode">
<description>WoeUSB running in --install mode.</description>
<description xml:lang="zh_TW">WoeUSB 以 --install 模式運行</description>

<message>Superuser privilege is required for WoeUSB to mount and unmount target filesystem, install bootloader and etc.</message>
<message xml:lang="zh_TW">WoeUSB 需要「超級使用者(SuperUser)」權限以掛載與解除掛載目標檔案系統、安裝開機載入器以及其他操作。</message>

<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig>

0 comments on commit 70a0d65

Please sign in to comment.