From 6be166a7155114a355a4218b3cf84402af21d325 Mon Sep 17 00:00:00 2001 From: asmeron Date: Tue, 16 Jul 2024 23:27:06 +0600 Subject: [PATCH] Add ubinstall-gtk to polkit --- ublinux/rc.post.d/11-xorg | 10 +++++----- ublinux/rc.preinit.d/59-polkit | 9 ++++++++- ublinux/rc.xorg/02-xrandr | 10 +++++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ublinux/rc.post.d/11-xorg b/ublinux/rc.post.d/11-xorg index 45c79cb..e20e7d6 100755 --- a/ublinux/rc.post.d/11-xorg +++ b/ublinux/rc.post.d/11-xorg @@ -120,15 +120,15 @@ EOF XORG_STR_MONITOR+=' Option "Ignore" "true"\n' elif grep -Eiq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then XORG_STR_MONITOR+=' Option "Primary" "true"\n' - elif grep -Eiq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^lo:[[:alnum:]]*$|^LeftOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then XORG_STR_MONITOR+=" Option \"LeftOf\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" - elif grep -Eiq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^ro:[[:alnum:]]*$|^RightOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then XORG_STR_MONITOR+=" Option \"RightOf\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" - elif grep -Eiq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^ab:[[:alnum:]]*$|^Above:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then XORG_STR_MONITOR+=" Option \"Above\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" - elif grep -Eiq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^be:[[:alnum:]]*$|^Below:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then XORG_STR_MONITOR+=" Option \"Below\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" - elif grep -Eiq "^rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^rotate:[[:alpha:]]*$" <<< "${VIDEO_PORT_PARAM}"; then XORG_STR_MONITOR+=" Option \"Rotate\" \"$(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})\"\n" fi [[ -z ${PREFERRED_MODE} ]] && PREFERRED_MODE=$(grep Modeline <<< "${XORG_STR_MONITOR}" | cut -d'"' -f2) diff --git a/ublinux/rc.preinit.d/59-polkit b/ublinux/rc.preinit.d/59-polkit index abd65b7..13ac089 100755 --- a/ublinux/rc.preinit.d/59-polkit +++ b/ublinux/rc.preinit.d/59-polkit @@ -20,13 +20,19 @@ SYSCONF="${ROOTFS}${SYSCONF}" SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null SOURCE=${SYSCONF}/security; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null +declare -A POLKIT + +exec_polkit_ubinstall(){ + [[ $(cmdline_value ub.sgnfiles) =~ .*"-iso.sgn" ]] && POLKIT[com.ublinux.ubinstall-gtk.]=yes:wheel +} + exec_polkit(){ ## Настрока polkit правил rm -f "${ROOTFS}"/etc/polkit-1/rules.d/ublinux-* if [[ -n ${POLKIT[@]} ]]; then for RULES in "${!POLKIT[@]}"; do RULES_GROUP= - RULES_FILE="${ROOTFS}/etc/polkit-1/rules.d/ublinux-$(sed 's/\([A-z0-9]*.[A-z0-9]*.[A-z0-9]*\)\..*/\1/' <<< ${RULES}).rules" + RULES_FILE="${ROOTFS}/etc/polkit-1/rules.d/ublinux-$(sed 's/\([[:alnum:]]*.[[:alnum:]]*.[[:alnum:]]*\)\..*/\1/' <<< ${RULES}).rules" RULES_RESULT=$(cut -d: -f1 <<< ${POLKIT[${RULES}]}) for GROUP in $(grep ":" <<< ${POLKIT[${RULES}]} | cut -d: -f2 | tr ',' '\n'); do RULES_GROUP+="&& subject.isInGroup(\"${GROUP}\") " @@ -53,4 +59,5 @@ EOF ##### MAIN ##### ################ + exec_polkit_ubinstall $@ exec_polkit $@ diff --git a/ublinux/rc.xorg/02-xrandr b/ublinux/rc.xorg/02-xrandr index a764ad7..ab3a5e3 100755 --- a/ublinux/rc.xorg/02-xrandr +++ b/ublinux/rc.xorg/02-xrandr @@ -54,15 +54,15 @@ SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) elif grep -Eiq "^mode:[0-9x_]*:[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) --rate $(cut -d: -f3 <<< ${VIDEO_PORT_PARAM}) - elif grep -Eiq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^lo:[[:alnum:]]*$|^LeftOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --left-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif grep -Eiq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^ro:[[:alnum:]]*$|^RightOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --right-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif grep -Eiq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^ab:[[:alnum:]]*$|^Above:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --above $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif grep -Eiq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^be:[[:alnum:]]*$|^Below:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --below $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif grep -Eiq "^Rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^Rotate:[[:alpha:]]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --rotate $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) fi if [[ -n ${MODELINE} ]]; then