mirror of
https://github.com/dslm4515/BMLFS.git
synced 2025-08-01 19:42:55 +00:00
112 lines
4.0 KiB
Bash
112 lines
4.0 KiB
Bash
#! /bin/bash
|
|
|
|
# Polkit
|
|
# Source: https://github.com/polkit-org/polkit/archive/126/polkit-126.tar.gz
|
|
#
|
|
# $BUILD = Directory to temporarily install
|
|
# $PKGS = Directory to store built packages
|
|
#
|
|
# DEPS
|
|
# Required: Glib, duktape
|
|
# Recommended: libxslt, Linux-PAM, elogind or turnstile, gobject-introspection
|
|
# Optional: GTK-Doc, dbusmock
|
|
|
|
# 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
|
|
|
|
export PVER="126"
|
|
|
|
# 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 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 mv $BUILD/usr/lib/pam.d $BUILD/etc/
|
|
|
|
# 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-$PVER-$PSUFFIX &&
|
|
|
|
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-$PVER-$NOPSUFFIX && \
|
|
sudo -S rm -rf ${BUILD}/* /BMAN/*
|