Skip to content

Instantly share code, notes, and snippets.

@nvgoldin
nvgoldin / gist:c040ec0ebfa143dcf523939e5a8475c9
Created January 30, 2017 14:20 — forked from djmattyg007/gist:6b5e845ad1140c8a0fa66b64f953bf9a
Example of allowing management of individual systemd units with polkit
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units") {
if (action.lookup("unit") == "myservice.service") {
var verb = action.lookup("verb");
if (verb == "start" || verb == "stop" || verb == "restart") {
return polkit.Result.YES;
}
}
}
});
#!/bin/bash
FILE=$1
USER=$2
EMAIL=$3
realfile=$(readlink -f $FILE)
cat << EOF | augtool -Ast "Xml incl ${realfile}"
# Remove #empty node