Install polkit policy file (#1970).
authorCarl Hetherington <cth@carlh.net>
Wed, 21 Apr 2021 20:41:22 +0000 (22:41 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 22 Apr 2021 13:42:11 +0000 (15:42 +0200)
cscript
platform/linux/com.dcpomatic.write-drive.policy [new file with mode: 0644]
platform/linux/wscript

diff --git a/cscript b/cscript
index 7dba914475273f9f4e5cf9e52c45b1350efe8394..ea8056c5df63d24e66384833d6ce3dba51f57587 100644 (file)
--- a/cscript
+++ b/cscript
@@ -341,6 +341,7 @@ def make_spec(filename, version, target, options, requires=None):
         print('%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2.mo' % l, file=f)
     print('%{_datadir}/libdcp/tags/*', file=f)
     print('%{_datadir}/libdcp/xsd/*', file=f)
+    print('%{_datadir}/polkit-1/actions/com.dcpomatic.write-drive.policy', file=f)
     print('', file=f)
     print('%prep', file=f)
     print('rm -rf $RPM_BUILD_DIR/dcpomatic-%s' % version, file=f)
@@ -651,6 +652,10 @@ def make_appimage(target, nice_name, internal_name, version):
     target.command('cp -r %s/share/dcpomatic2 build/%s.AppDir/usr/share/' % (target.directory, nice_filename))
     target.command('cp -r %s/share/libdcp/xsd build/%s.AppDir/usr/share/libdcp/' % (target.directory, nice_filename))
     target.command('cp -r %s/share/libdcp/tags build/%s.AppDir/usr/share/libdcp/' % (target.directory, nice_filename))
+    if internal_name == 'dcpomatic2_disk':
+        target.command('mkdir -p build/%s.AppDir/usr/share/polkit-1/actions', nice_filename)
+        target.command('cp %s/share/polkit-1/actions/com.dcpomatic.write-drive.policy build/%s.AppDir/usr/share/polkit-1/actions' % (target.directory, nice_filename))
+
     with open('build/%s.AppDir/AppRun' % nice_filename, 'w') as f:
         print('#!/bin/bash', file=f)
         print('export PATH=$APPDIR/usr/bin:$PATH', file=f)
diff --git a/platform/linux/com.dcpomatic.write-drive.policy b/platform/linux/com.dcpomatic.write-drive.policy
new file mode 100644 (file)
index 0000000..4031300
--- /dev/null
@@ -0,0 +1,15 @@
+<?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.0/policyconfig.dtd">
+<policyconfig>
+  <vendor>DCP-o-matic</vendor>
+  <vendor_url>https://dcpomatic.com</vendor_url>
+  <action id="com.dcpomatic.write-drive">
+    <description gettext-domain="dcpomatic">Format a drive and write a DCP to it</description>
+    <message gettext-domain="dcpomatic">Authentication is required to format the drive and write the DCP</message>
+    <defaults>
+       <allow_any>no</allow_any>
+       <allow_inactive>no</allow_inactive>
+       <allow_active>auth_admin_keep</allow_active>
+    </defaults>
+  </action>
+</policyconfig>
index 4b6f7f7aac2704fcfba96c01aa37cc563d33b385..587da325e3ef7735db0c6fcdf35468d9ac8a5cfd 100644 (file)
@@ -58,4 +58,6 @@ def build(bld):
     obj.VERSION = bld.env.VERSION
     desktops.append(obj.target)
 
+    bld.install_as('${PREFIX}/share/polkit-1/actions/com.dcpomatic.write-drive.policy', 'com.dcpomatic.write-drive.policy')
+
     bld.install_files('${PREFIX}/share/applications', desktops)