initial buildroot for linux 5.15
This commit is contained in:
@@ -0,0 +1 @@
|
||||
source "$BR2_EXTERNAL_POLKIT_PATH/package/polkit-rules-test/Config.in"
|
||||
@@ -0,0 +1 @@
|
||||
name: POLKIT
|
||||
@@ -0,0 +1 @@
|
||||
include $(sort $(wildcard $(BR2_EXTERNAL_POLKIT_PATH)/package/*/*.mk))
|
||||
@@ -0,0 +1,6 @@
|
||||
config BR2_PACKAGE_POLKIT_RULES_TEST
|
||||
bool "polkit rules test"
|
||||
depends on BR2_PACKAGE_POLKIT
|
||||
help
|
||||
Simple test to ensure polkit is loading and enforcing rules
|
||||
correctly.
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void){
|
||||
printf("Hello polkit!\n");
|
||||
return 0;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
|
||||
<policyconfig>
|
||||
<action id="org.freedesktop.policykit.pkexec.hello-polkit">
|
||||
<message>Authentication is required to run the hello world test program</message>
|
||||
<defaults>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>no</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/hello-polkit</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.freedesktop.policykit.pkexec.hello-polkit" &&
|
||||
subject.user == "brtest") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
################################################################################
|
||||
#
|
||||
# polkit-rules-test
|
||||
#
|
||||
################################################################################
|
||||
|
||||
POLKIT_RULES_TEST_DEPENDENCIES = polkit
|
||||
|
||||
define POLKIT_RULES_TEST_USERS
|
||||
brtest -1 brtest -1 =password /home/brtest /bin/sh brtest
|
||||
endef
|
||||
|
||||
define POLKIT_RULES_TEST_BUILD_CMDS
|
||||
$(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/initd/hello-polkit.c $(@D)/hello-polkit.c
|
||||
$(TARGET_CC) $(@D)/hello-polkit.c -o $(@D)/hello-polkit
|
||||
endef
|
||||
|
||||
# Install the rules file to /root. Test_polkit.py first tests that restarting
|
||||
# timesyncd as a user fails, then moves the rules file and confirmes restarting
|
||||
# timesyncd as a user succeeds.
|
||||
define POLKIT_RULES_TEST_INSTALL_INIT_SYSTEMD
|
||||
mkdir -p $(TARGET_DIR)/etc/polkit-1/rules.d
|
||||
$(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/systemd/systemd-timesyncd-restart.rules \
|
||||
$(TARGET_DIR)/root/systemd-timesyncd-restart.rules
|
||||
endef
|
||||
|
||||
define POLKIT_RULES_TEST_INSTALL_INIT_SYSV
|
||||
mkdir -p $(TARGET_DIR)/usr/share/polkit-1/actions/
|
||||
$(INSTALL) -D $(@D)/hello-polkit $(TARGET_DIR)/usr/bin/hello-polkit
|
||||
|
||||
$(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/initd/hello-polkit.policy \
|
||||
$(TARGET_DIR)/usr/share/polkit-1/actions/hello-polkit.policy
|
||||
|
||||
$(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/initd/hello-polkit.rules \
|
||||
$(TARGET_DIR)/root/hello-polkit.rules
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||
action.lookup("unit") == "systemd-timesyncd.service" &&
|
||||
subject.user == "brtest") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user