From b5a3513fb9f7b39cabc48e50375927e3b414b1a0 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 28 Dec 2023 18:45:30 -0700 Subject: [PATCH] Handle Debian GNU Hurd --- scripts/mkpkg | 89 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/scripts/mkpkg b/scripts/mkpkg index 5871dc8fe..8519649fc 100755 --- a/scripts/mkpkg +++ b/scripts/mkpkg @@ -282,6 +282,12 @@ case "$osversion" in make_opts="${make_opts}${make_opts+ }"'docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)' ;; deb*|ubu*) + if [ "$crossbuild" = "true" ]; then + osname="unknown" + else + osname="`uname`" + fi + # Sudo-specific executables moved to /usr/libexec/sudo starting in # Debian: Debian 12 (Bookworm) # Ubuntu: Ubuntu 22.04 (Jammy Jellyfish) @@ -294,36 +300,50 @@ case "$osversion" in osmajor=`sed -n -e 's/^VERSION_ID=\"\([0-9]*\).*$/\1/p' /etc/os-release` case "$osversion" in deb*) - if [ -z $osmajor ] || [ $osmajor -ge 10 ]; then - with_apparmor=true - fi if [ -z $osmajor ] || [ $osmajor -ge 12 ]; then libexec=libexec fi + case "$osname" in + Linux|unknown) + if [ -z $osmajor ] || [ $osmajor -ge 10 ]; then + with_apparmor=true + fi + ;; + esac ;; ubu*) - if [ -z $osmajor ] || [ $osmajor -ge 14 ]; then - with_apparmor=true - fi if [ -z $osmajor ] || [ $osmajor -ge 22 ]; then libexec=libexec fi - ;; - esac - - # Encrypted remote I/O log support. - with_openssl=true - # Python plugins - with_python=true - # Man pages should be compressed in .deb files - export MANCOMPRESS='gzip -9' - export MANCOMPRESSEXT='.gz' - # If Ubuntu, add --enable-admin-flag - case "$osversion" in - ubu*) + if [ -z $osmajor ] || [ $osmajor -ge 14 ]; then + with_apparmor=true + fi configure_opts="${configure_opts}${configure_opts+$tab}--enable-admin-flag${tab}--without-lecture" ;; esac + + case "$osname" in + GNU) + # GNU hurd doesn't have PAM, AppArmor or have Python packages + ;; + *) + # Python plugins + with_python=true + # PAM + configure_opts="${configure_opts}${configure_opts+$tab}--with-pam" + # Linux audit + configure_opts="${configure_opts}${configure_opts+$tab}--with-linux-audit" + # AppArmor + if [ X"$with_apparmor" = X"true" ]; then + configure_opts="${configure_opts}${configure_opts+$tab}--with-apparmor" + fi + ;; + esac + # Encrypted remote I/O log support. + with_openssl=true + # Man pages should be compressed in .deb files + export MANCOMPRESS='gzip -9' + export MANCOMPRESSEXT='.gz' # Newer Debian uses arch-specific lib dirs MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null` # Note, must indent with tabs, not spaces due to IFS trickery @@ -337,12 +357,8 @@ case "$osversion" in configure_opts="${configure_opts}${configure_opts+$tab}--with-sssd-lib=/usr/lib/$MULTIARCH" fi fi - if [ X"$with_apparmor" = X"true" ]; then - configure_opts="${configure_opts}${configure_opts+$tab}--with-apparmor" - fi configure_opts="--prefix=/usr --with-all-insults - --with-pam --enable-zlib=system --with-fqdn --with-logging=syslog @@ -356,20 +372,23 @@ case "$osversion" in --with-sendmail=/usr/sbin/sendmail --mandir=/usr/share/man --libexecdir=/usr/$libexec - --with-linux-audit $configure_opts" - # Use correct libaudit dependency - for f in /lib/${MULTIARCH}${MULTIARCH:+/}libaudit.so.[0-9]* /lib/libaudit.so.[0-9]*; do - if [ -f "$f" ]; then - linux_audit=`dpkg-query -S "$f" 2>/dev/null | sed -n 's/:.*//p'` - test -n "$linux_audit" && break + # Use correct libaudit dependency for Linux audit + case "$configure_opts" in + *--with-linux-audit*) + for f in /lib/${MULTIARCH}${MULTIARCH:+/}libaudit.so.[0-9]* /lib/libaudit.so.[0-9]*; do + if [ -f "$f" ]; then + linux_audit=`dpkg-query -S "$f" 2>/dev/null | sed -n 's/:.*//p'` + test -n "$linux_audit" && break + fi + done + if [ -z "$linux_audit" ]; then + echo "unable to determine package for libaudit" 1>&2 + exit 1 fi - done - if [ -z "$linux_audit" ]; then - echo "unable to determine package for libaudit" 1>&2 - exit 1 - fi - PPVARS="${PPVARS}${PPVARS+$space}linux_audit=$linux_audit" + PPVARS="${PPVARS}${PPVARS+$space}linux_audit=$linux_audit" + ;; + esac # Use correct libssl dependency libssl_dep=`dpkg-query -S /usr/lib/${MULTIARCH}${MULTIARCH:+/}libssl.so.[1-9]* /lib/${MULTIARCH}${MULTIARCH:+/}libssl.so.[1-9]* 2>/dev/null | sort -rn | awk -F: '{ print $1; exit }'` if [ -z "$libssl_dep" ]; then