mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Fix handling of the ldap flavor
Remove destdir unless --debug was specified Make distclean before running configure if there is a Makefile present
This commit is contained in:
37
mkpkg
37
mkpkg
@@ -5,6 +5,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Make sure IFS is set to space, tab, newline in that order.
|
# Make sure IFS is set to space, tab, newline in that order.
|
||||||
|
space=' '
|
||||||
|
tab=' '
|
||||||
nl='
|
nl='
|
||||||
'
|
'
|
||||||
IFS=" $nl"
|
IFS=" $nl"
|
||||||
@@ -12,39 +14,42 @@ IFS=" $nl"
|
|||||||
# Parse arguments
|
# Parse arguments
|
||||||
usage="usage: mkpkg [--debug] [--flavor flavor] [--platform platform]"
|
usage="usage: mkpkg [--debug] [--flavor flavor] [--platform platform]"
|
||||||
debug=0
|
debug=0
|
||||||
|
flavor=vanilla
|
||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--debug)
|
--debug)
|
||||||
set -x
|
set -x
|
||||||
PPFLAGS="--debug${PPFLAGS+ }${PPFLAGS}"
|
debug=1
|
||||||
|
PPFLAGS="--debug${PPFLAGS+$space}${PPFLAGS}"
|
||||||
;;
|
;;
|
||||||
--flavor=?*)
|
--flavor=?*)
|
||||||
arg=`echo "$1" | sed -n 's/^--flavor=\(.*\)/\1/p'`
|
flavor=`echo "$1" | sed -n 's/^--flavor=\(.*\)/\1/p'`
|
||||||
PPVARS="${PPVARS}${PPVARS+ }flavor=$arg"
|
PPVARS="${PPVARS}${PPVARS+$space}flavor=$flavor"
|
||||||
;;
|
;;
|
||||||
--flavor)
|
--flavor)
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "$usage" 1>&2
|
echo "$usage" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PPVARS="${PPVARS}${PPVARS+ }flavor=$2"
|
flavor="$2"
|
||||||
|
PPVARS="${PPVARS}${PPVARS+$space}flavor=$flavor"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--platform=?*)
|
--platform=?*)
|
||||||
arg=`echo "$1" | sed -n 's/^--platform=\(.*\)/\1/p'`
|
arg=`echo "$1" | sed -n 's/^--platform=\(.*\)/\1/p'`
|
||||||
PPFLAGS="${PPFLAGS}${PPFLAGS+ }--platform $arg"
|
PPFLAGS="${PPFLAGS}${PPFLAGS+$space}--platform $arg"
|
||||||
;;
|
;;
|
||||||
--platform)
|
--platform)
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "$usage" 1>&2
|
echo "$usage" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PPFLAGS="${PPFLAGS}${PPFLAGS+ }--platform $2"
|
PPFLAGS="${PPFLAGS}${PPFLAGS+$space}--platform $2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Pass unknown options to configure
|
# Pass unknown options to configure
|
||||||
extra_opts="${extra_opts}${extra_opts+ }$1"
|
configure_opts="${configure_opts}${configure_opts+$tab}$1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@@ -79,7 +84,7 @@ case "$platform" in
|
|||||||
CFLAGS=-O; export CFLAGS
|
CFLAGS=-O; export CFLAGS
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
extra_opts="--disable-zlib${extra_opts+ }${extra_opts}"
|
configure_opts="${configure_opts}${configure_opts+$tab}--disable-zlib"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -92,7 +97,7 @@ case "$platform" in
|
|||||||
if [ $osrelease -ge 50 ]; then
|
if [ $osrelease -ge 50 ]; then
|
||||||
# RHEL 5 and up build pies and have audit support
|
# RHEL 5 and up build pies and have audit support
|
||||||
export CFLAGS="$F_PIE" LDFLAGS="-pie"
|
export CFLAGS="$F_PIE" LDFLAGS="-pie"
|
||||||
configure_opts="--with-linux-audit"
|
configure_opts="${configure_opts}${configure_opts+$tab}--with-linux-audit"
|
||||||
fi
|
fi
|
||||||
# Note, must indent with tabs, not spaces due to IFS trickery
|
# Note, must indent with tabs, not spaces due to IFS trickery
|
||||||
configure_opts="$configure_opts
|
configure_opts="$configure_opts
|
||||||
@@ -117,7 +122,7 @@ case "$platform" in
|
|||||||
export CFLAGS="$F_PIE" LDFLAGS="-pie"
|
export CFLAGS="$F_PIE" LDFLAGS="-pie"
|
||||||
if [ $osrelease -ge 11 ]; then
|
if [ $osrelease -ge 11 ]; then
|
||||||
# SLES 11 and higher has SELinux
|
# SLES 11 and higher has SELinux
|
||||||
configure_opts="--with-selinux"
|
configure_opts="${configure_opts}${configure_opts+$tab}--with-selinux"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# SuSE doesn't have /usr/libexec
|
# SuSE doesn't have /usr/libexec
|
||||||
@@ -148,8 +153,8 @@ case "$platform" in
|
|||||||
deb*)
|
deb*)
|
||||||
prefix=/usr
|
prefix=/usr
|
||||||
# Note, must indent with tabs, not spaces due to IFS trickery
|
# Note, must indent with tabs, not spaces due to IFS trickery
|
||||||
if test "${SUDO_FLAVOR:-vanilla}" = "ldap"; then
|
if test "$flavor" = "ldap"; then
|
||||||
configure_opts="--with-ldap
|
configure_opts="${configure_opts}${configure_opts+$tab}--with-ldap
|
||||||
--with-ldap-conf-file=/etc/sudo-ldap.conf"
|
--with-ldap-conf-file=/etc/sudo-ldap.conf"
|
||||||
fi
|
fi
|
||||||
configure_opts="$configure_opts
|
configure_opts="$configure_opts
|
||||||
@@ -175,8 +180,8 @@ case "$platform" in
|
|||||||
--with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
|
--with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if test "${SUDO_FLAVOR:-vanilla}" = "ldap"; then
|
if test "$flavor" = "ldap"; then
|
||||||
configure_opts="--with-ldap"
|
configure_opts="${configure_opts}${configure_opts+$tab}--with-ldap"
|
||||||
fi
|
fi
|
||||||
# Note, must indent with tabs, not spaces due to IFS trickery
|
# Note, must indent with tabs, not spaces due to IFS trickery
|
||||||
configure_opts="$configure_opts
|
configure_opts="$configure_opts
|
||||||
@@ -194,5 +199,9 @@ OIFS="$IFS"
|
|||||||
IFS=" $nl"
|
IFS=" $nl"
|
||||||
set -- $configure_opts $extra_opts
|
set -- $configure_opts $extra_opts
|
||||||
IFS="$OIFS"
|
IFS="$OIFS"
|
||||||
|
if [ -r Makefile ]; then
|
||||||
|
make $make_opts distclean
|
||||||
|
fi
|
||||||
$top_srcdir/configure "$@" || exit 1
|
$top_srcdir/configure "$@" || exit 1
|
||||||
make $make_opts && make $make_opts PPFLAGS="$PPFLAGS" PPVARS="$PPVARS" package
|
make $make_opts && make $make_opts PPFLAGS="$PPFLAGS" PPVARS="$PPVARS" package
|
||||||
|
test $debug -eq 0 && rm -rf destdir
|
||||||
|
Reference in New Issue
Block a user