diff --git a/meson.build b/meson.build index d58714e..a1afcfa 100644 --- a/meson.build +++ b/meson.build @@ -121,6 +121,11 @@ if systemdsystemunitdir == '' systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir') endif +datadir = get_option('datadir') +if datadir == '' + datadir = join_paths(prefix, get_option('datadir')) +endif + # Generate configuration file config_h = configure_file(output: 'config.h', configuration: cdata) @@ -132,6 +137,7 @@ subdir('libupower-glib') subdir('src') subdir('tools') subdir('doc') +subdir('policy') pkgconfig = import('pkgconfig') pkgconfig.generate( diff --git a/policy/meson.build b/policy/meson.build new file mode 100644 index 0000000..3371bde --- /dev/null +++ b/policy/meson.build @@ -0,0 +1,24 @@ +if polkit.found() + #newer polkit has the ITS rules included + if polkit.version().version_compare('>0.113') + i18n.merge_file( + input: 'org.freedesktop.upower.policy.in', + output: 'org.freedesktop.upower.policy', + install: true, + install_dir: join_paths(datadir, 'polkit-1', 'actions') , + type: 'xml', + po_dir: join_paths(meson.project_source_root(), 'po') + ) + #older polkit is missing ITS rules and will fail + else + i18n.merge_file( + input: 'org.freedesktop.upower.policy.in', + output: 'org.freedesktop.upower.policy', + install: true, + install_dir: join_paths(datadir, 'polkit-1', 'actions') , + type: 'xml', + data_dirs: join_paths(meson.project_source_root(), 'policy'), + po_dir: join_paths(meson.project_source_root(), 'po') + ) + endif +endif \ No newline at end of file diff --git a/policy/org.freedesktop.upower.policy.in b/policy/org.freedesktop.upower.policy.in new file mode 100644 index 0000000..6068294 --- /dev/null +++ b/policy/org.freedesktop.upower.policy.in @@ -0,0 +1,32 @@ + + + + + + + + The UPower Project + http://upower.freedesktop.org/ + system-suspend + + + <_description>Enable battery charging limit + <_message>Authentication is required to set battery charging start and end limit. + + no + yes + + + +