Ship CUPS authorization through settings package
This commit is contained in:
@@ -7,6 +7,5 @@ run_logged "$OMARCHY_INSTALL/config/ssh-keepalive.sh"
|
||||
run_logged "$OMARCHY_INSTALL/config/docker.sh"
|
||||
run_logged "$OMARCHY_INSTALL/config/snapper.sh"
|
||||
run_logged "$OMARCHY_INSTALL/config/locate.sh"
|
||||
run_logged "$OMARCHY_INSTALL/config/printing.sh"
|
||||
run_logged "$OMARCHY_INSTALL/config/enable-services.sh"
|
||||
run_logged "$OMARCHY_INSTALL/config/firewall.sh"
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
# cups-browsed manages queues through CUPS and does not need Unix root. Give
|
||||
# only its locked service account passwordless CUPS administration; interactive
|
||||
# users go through cups-pk-helper and Polkit instead.
|
||||
cups_files_conf="${OMARCHY_CUPS_FILES_CONF:-/etc/cups/cups-files.conf}"
|
||||
cups_browsed_sysusers_conf="${OMARCHY_CUPS_BROWSED_SYSUSERS_CONF:-/etc/sysusers.d/omarchy-cups-browsed.conf}"
|
||||
|
||||
if [[ -f $cups_browsed_sysusers_conf ]]; then
|
||||
systemd-sysusers "$cups_browsed_sysusers_conf"
|
||||
fi
|
||||
|
||||
if [[ -L $cups_files_conf ]]; then
|
||||
echo "Refusing to rewrite symlinked CUPS authorization config: $cups_files_conf" >&2
|
||||
false
|
||||
elif [[ -f $cups_files_conf ]]; then
|
||||
staged_conf=$(mktemp --tmpdir="${cups_files_conf%/*}" ".${cups_files_conf##*/}.XXXXXX")
|
||||
|
||||
if ! awk '
|
||||
NR == FNR {
|
||||
if (tolower($1) == "systemgroup") {
|
||||
for (i = 2; i <= NF; i++) {
|
||||
if (substr($i, 1, 1) == "#")
|
||||
break
|
||||
if ($i != "wheel" && !seen_group[$i]) {
|
||||
system_groups[++system_group_count] = $i
|
||||
seen_group[$i] = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
next
|
||||
}
|
||||
|
||||
tolower($1) == "systemgroup" {
|
||||
comment_start = index($0, "#")
|
||||
if (!wrote_system_group) {
|
||||
printf "SystemGroup"
|
||||
for (i = 1; i <= system_group_count; i++)
|
||||
printf " %s", system_groups[i]
|
||||
if (!seen_group["cups-browsed"])
|
||||
printf " cups-browsed"
|
||||
if (comment_start)
|
||||
printf " %s", substr($0, comment_start)
|
||||
print ""
|
||||
wrote_system_group = 1
|
||||
} else if (comment_start) {
|
||||
print substr($0, comment_start)
|
||||
}
|
||||
next
|
||||
}
|
||||
|
||||
tolower($1) == "peercred" {
|
||||
comment_start = index($0, "#")
|
||||
if (!saw_peer_cred) {
|
||||
printf "PeerCred on"
|
||||
if (comment_start)
|
||||
printf " %s", substr($0, comment_start)
|
||||
print ""
|
||||
} else if (comment_start) {
|
||||
print substr($0, comment_start)
|
||||
}
|
||||
saw_peer_cred = 1
|
||||
next
|
||||
}
|
||||
|
||||
{ print }
|
||||
|
||||
END {
|
||||
if (!wrote_system_group)
|
||||
print "SystemGroup sys root cups-browsed"
|
||||
if (!saw_peer_cred)
|
||||
print "PeerCred on"
|
||||
}
|
||||
' "$cups_files_conf" "$cups_files_conf" >"$staged_conf"; then
|
||||
rm -f "$staged_conf"
|
||||
false
|
||||
fi
|
||||
|
||||
if ! chmod --reference="$cups_files_conf" "$staged_conf" ||
|
||||
! chown --reference="$cups_files_conf" "$staged_conf" ||
|
||||
! mv -f "$staged_conf" "$cups_files_conf"; then
|
||||
rm -f "$staged_conf"
|
||||
false
|
||||
fi
|
||||
fi
|
||||
@@ -3,11 +3,13 @@
|
||||
cp -f "$OMARCHY_PATH/default/pacman/pacman-${OMARCHY_MIRROR:-stable}.conf" /etc/pacman.conf
|
||||
cp -f "$OMARCHY_PATH/default/pacman/mirrorlist-${OMARCHY_MIRROR:-stable}" /etc/pacman.d/mirrorlist
|
||||
|
||||
# omarchy-settings skips this override until cups-browsed is actually present
|
||||
# to avoid pacman creating cups-browsed.conf.pacnew during ISO package install.
|
||||
if [[ -f $OMARCHY_PATH/etc-overrides/cups-cups-browsed.conf && -d /etc/cups ]]; then
|
||||
# omarchy-settings skips these overrides until CUPS is actually present to
|
||||
# avoid pacman creating .pacnew files during ISO package installation.
|
||||
if [[ -f $OMARCHY_PATH/etc-overrides/cups-cups-browsed.conf && -f /etc/cups/cups-files.conf ]]; then
|
||||
systemd-sysusers /etc/sysusers.d/omarchy-cups-browsed.conf
|
||||
cp -f "$OMARCHY_PATH/etc-overrides/cups-cups-browsed.conf" /etc/cups/cups-browsed.conf
|
||||
rm -f /etc/cups/cups-browsed.conf.pacnew
|
||||
install -m 0640 -o root -g cups "$OMARCHY_PATH/etc-overrides/cups-cups-files.conf" /etc/cups/cups-files.conf
|
||||
rm -f /etc/cups/cups-browsed.conf.pacnew /etc/cups/cups-files.conf.pacnew
|
||||
fi
|
||||
|
||||
source "$OMARCHY_INSTALL/hardware/pacman.sh"
|
||||
|
||||
Reference in New Issue
Block a user