#! /bin/bash # Polkit # Source: https://gitlab.freedesktop.org/polkit/polkit/-/archive/123/polkit-123.tar.gz # # $BUILD = Directory to temporarily install # $PKGS = Directory to store built packages # # DEPS # Required: Glib, mozjs(JS) or duktape, # Recommended: Linux-PAM, elogind turnstile # Optional: gobject-introspection, D-Bus Python, dbusmock, docbook-xml, # Optional: docbook-xsl, GTK-Doc, and libxslt # If coptimizing with GCC: export CFLAGS="-march=native -pipe " export CFLAGS+="-O3 -Os -fdata-sections -ffat-lto-objects " export CFLAGS+="-ffunction-sections -flto=auto -fno-semantic-interposition " export CFLAGS+="-fstack-protector-strong -fzero-call-used-regs=used " export CXXFLAGS=$CFLAGS export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed " # For polkit-121, apply patch from Chimera Linux to make innetgr optional; does not exist on musl: # patch -Np1 -i ../patches/polkit-chimera/innetgr.patch # Ensure turnstile-session processes fall back to display check patch -Np1 -i ../patches/polkit-chimera/turnstile.patch # Per LFS, There should be a dedicated user and group to take control of the polkitd # daemon after it is started. sudo -E groupadd -fg 27 polkitd && sudo -E useradd -c "PolicyKit Daemon Owner" -d /etc/polkit-1 -u 27 \ -g polkitd -s /bin/false polkitd # If using mozjs instead of duktape: sed -e '/mozjs/s/102/115/' -i meson.build && sed -e 's/JS_Init/JS::DisableJitBackend(); &/' \ -i src/polkitbackend/polkitbackendjsauthority.cpp # If elogind is installed: export stkr=libelogind # if seatd is installed OR Consolekit2, then: export stkr=ConsoleKit meson setup --prefix=/usr --buildtype=release \ -Dman=true -Dsession_tracking=$stkr \ -Dtests=false -Dos_type=lfs OUT unset stkr read -p "Compile?" && ninja -C OUT -j2 && sudo -S DESTDIR=$BUILD ninja -C OUT install && \ sudo -S mkdir -pv /BMAN/install /BMAN/usr/share && \ sudo -S mv $BUILD/usr/share/man /BMAN/usr/share/ && \ #sudo -S install -m644 ../files/polkit-lfs/polkit-1 ${BUILD}/etc/pam.d/ && # Fix the pam configuration, per Chimera Linux: cat > /tmp/polkit-1 << "EOF" auth requisite pam_nologin.so auth required pam_env.so auth required pam_unix.so account required pam_unix.so session required pam_unix.so session required pam_limits.so password required pam_unix.so EOF sudo -S install -m644 /tmp/polkit-1 ${BUILD}/etc/pam.d/ cd $BUILD && sudo -S mkdir -v ${BUILD}/install && cat > /tmp/slack-desc << "EOF" # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| polkit: polkit (authentication framework) polkit: polkit: PolicyKit is an application-level toolkit for defining and handling polkit: the policy that allows unprivileged processes to speak to privileged polkit: processes. PolicyKit is specifically targeting applications in rich polkit: desktop environments on multi-user UNIX-like operating systems. polkit: polkit: polkit: polkit: Home: http://www.freedesktop.org/wiki/Software/PolicyKit polkit: EOF sudo -S mv -v /tmp/slack-desc install/ && cat > /tmp/doinst.sh << "EOF" groupadd -fg 27 polkitd && useradd -c "PolicyKit Daemon Owner" -d /etc/polkit-1 -u 27 \ -g polkitd -s /bin/false polkitd EOF sudo mv /tmp/doinst.sh install/ && sudo -S makepkg -l y -c n $PKGS/polkit-123-$PSUFFIX && #cp -v install/doinst.sh /tmp/ && \ #cd - && cat ../files/polkit-lfs/doinst.sh >> /tmp/doinst.sh && #cd - && sudo -S mv -v /tmp/doinst.sh install/doinst.sh && #sudo -S makepkg -l y -c n $PKGS/polkit-0.120-$(uname -m)-mlfs.txz && \ cd /BMAN && \ cat > /tmp/slack-desc << "EOF" polkit-doc: Manuals for polkit (authentication framework) polkit-doc: polkit-doc: An application-level toolkit for defining and handling the policy polkit-doc: that allows unprivileged processes to speak to privileged polkit-doc: processes. polkit-doc: polkit-doc: http://www.freedesktop.org/wiki/Software/PolicyKit polkit-doc: EOF sudo -S mv -v /tmp/slack-desc install/ && \ sudo -S makepkg -l y -c n $PKGS/polkit-doc-123-$NOPSUFFIX && \ sudo -S rm -rf ${BUILD}/* /BMAN/*