Files
sudo/mkpkg
2010-07-14 14:09:34 -04:00

195 lines
4.6 KiB
Bash
Executable File

#!/bin/sh
#
# Build a binary package using polypkg
# Usage: mkpkg
#
IFS=
top_srcdir=`dirname $0`
platform=`$top_srcdir/pp --probe` || exit 1
# Default paths
prefix=/usr/local
# Linux distros may build binaries as pie files.
# This is really something libtool should figure out, but it does not.
case "$platform" in
*-s390*|*-sparc*|*-alpha*)
F_PIE=-fPIE
;;
*)
F_PIE=-fpie
;;
esac
# Choose configure options by platform.
# We use the same configure options as vendor packages when possible.
case "$platform" in
centos4.*|rhel4.*)
# Note, must indent with tabs, not spaces due to IFS trickery
prefix=/usr
configure_opts="
--prefix=$prefix
--with-logging=syslog
--with-logfac=authpriv
--with-pam
--with-pam-login
--with-editor=/bin/vi
--with-env-editor
--with-ignore-dot
--with-tty-tickets
--with-ldap
--with-selinux
--with-passprompt=[sudo] password for %p: "
;;
centos5.*|rhel5.*)
# Note, must indent with tabs, not spaces due to IFS trickery
prefix=/usr
configure_opts="
--prefix=$prefix
--with-logging=syslog
--with-logfac=authpriv
--with-pam
--with-pam-login
--with-editor=/bin/vi
--with-env-editor
--with-ignore-dot
--with-tty-tickets
--with-ldap
--with-selinux
--with-linux-audit
--with-passprompt=[sudo] password for %p: "
export CFLAGS="$F_PIE" LDFLAGS="-pie"
;;
sles9.*)
prefix=/usr
# SuSE doesn't have /usr/libexec
case "$platform" in
*64*) libexec=lib64;;
*) libexec=lib;;
esac
# Note, must indent with tabs, not spaces due to IFS trickery
configure_opts="
--prefix=$prefix
--libexecdir=$prefix/$libexec/sudo
--with-logging=syslog
--with-logfac=auth
--with-all-insults
--with-ignore-dot
--with-tty-tickets
--enable-shell-sets-home
--with-sudoers-mode=0440
--with-pam
--with-ldap
--with-env-editor
--with-passprompt=%p\'s password: "
make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
;;
sles10.*)
prefix=/usr
# SuSE doesn't have /usr/libexec
case "$platform" in
*64*) libexec=lib64;;
*) libexec=lib;;
esac
# Note, must indent with tabs, not spaces due to IFS trickery
# XXX - SuSE uses secure path but only for env_reset
configure_opts="
--prefix=$prefix
--libexecdir=$prefix/$libexec/sudo
--with-logging=syslog
--with-logfac=auth
--with-all-insults
--with-ignore-dot
--with-tty-tickets
--enable-shell-sets-home
--with-sudoers-mode=0440
--with-pam
--with-ldap
--with-env-editor
--with-passprompt=%p\'s password: "
make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
export CFLAGS="$F_PIE" LDFLAGS="-pie"
;;
sles11.*)
prefix=/usr
# SuSE doesn't have /usr/libexec
case "$platform" in
*64*) libexec=lib64;;
*) libexec=lib;;
esac
# Note, must indent with tabs, not spaces due to IFS trickery
# XXX - SuSE uses secure path but only for env_reset
configure_opts="
--prefix=$prefix
--libexecdir=$prefix/$libexec/sudo
--with-selinux
--with-logging=syslog
--with-logfac=auth
--with-all-insults
--with-ignore-dot
--with-tty-tickets
--enable-shell-sets-home
--with-sudoers-mode=0440
--with-pam
--with-ldap
--with-env-editor
--with-passprompt=%p\'s password: "
make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
export CFLAGS="$F_PIE" LDFLAGS="-pie"
;;
deb[456].*)
# XXX - create sudo group like debian does
# debian now has a %sudo entry in its sample sudoers
# Note, must indent with tabs, not spaces due to IFS trickery
if test "${SUDO_FLAVOR:-vanilla}" == "ldap"; then
configure_opts="--with-ldap
--with-ldap-conf-file=/etc/sudo-ldap.conf"
fi
configure_opts="$configure_opts
--prefix=/usr
--with-all-insults
--with-exempt=sudo
--with-pam
--with-fqdn
--with-logging=syslog
--with-logfac=authpriv
--with-env-editor
--with-editor=/usr/bin/editor
--with-timeout=15
--with-password-timeout=0
--with-passprompt=[sudo] password for %p:
--with-timedir=/var/lib/sudo
--disable-root-mailer
--disable-setresuid
--with-sendmail=/usr/sbin/sendmail
--mandir=/usr/share/man
--libexecdir=/usr/lib/sudo
--with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
;;
*)
# Note, must indent with tabs, not spaces due to IFS trickery
configure_opts="
--prefix=$prefix
--with-insults=disabled
--with-logging=syslog
--with-logfac=auth
--with-editor=/usr/bin/vim:/usr/bin/vi:/bin/vi
--with-env-editor"
;;
esac
# Remove spaces from IFS when setting $@ so that passprompt may include them
OIFS="$IFS"
IFS="
"
set -- $configure_opts
IFS="$OIFS"
$top_srcdir/configure "$@" || exit 1
make $make_opts && make $make_opts package