mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-28 12:57:50 +00:00
Add simple arg parsing for mkpkg so we can set debug, flavor or platform.
This commit is contained in:
parent
d02489ff40
commit
551791a51f
@ -88,7 +88,7 @@ package: sudo.pp
|
|||||||
DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
|
DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
|
||||||
$(SHELL) $(srcdir)/mkinstalldirs $$DESTDIR/$(timedir) && \
|
$(SHELL) $(srcdir)/mkinstalldirs $$DESTDIR/$(timedir) && \
|
||||||
$(MAKE) install DESTDIR=$$DESTDIR && \
|
$(MAKE) install DESTDIR=$$DESTDIR && \
|
||||||
$(SHELL) $(srcdir)/pp \
|
$(SHELL) $(srcdir)/pp $(PPFLAGS) \
|
||||||
--destdir=$$DESTDIR \
|
--destdir=$$DESTDIR \
|
||||||
$(srcdir)/sudo.pp \
|
$(srcdir)/sudo.pp \
|
||||||
bindir=$(bindir) \
|
bindir=$(bindir) \
|
||||||
@ -103,7 +103,7 @@ package: sudo.pp
|
|||||||
sudoers_uid=$(sudoers_uid) \
|
sudoers_uid=$(sudoers_uid) \
|
||||||
sudoers_gid=$(sudoers_gid) \
|
sudoers_gid=$(sudoers_gid) \
|
||||||
sudoers_mode=$(sudoers_mode) \
|
sudoers_mode=$(sudoers_mode) \
|
||||||
version=$(VERSION)
|
version=$(VERSION) $(PPVARS)
|
||||||
|
|
||||||
clean: config.status
|
clean: config.status
|
||||||
for d in $(SUBDIRS) $(SAMPLES); do (cd $$d && $(MAKE) $@); done
|
for d in $(SUBDIRS) $(SAMPLES); do (cd $$d && $(MAKE) $@); done
|
||||||
|
41
mkpkg
41
mkpkg
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Build a binary package using polypkg
|
# Build a binary package using polypkg
|
||||||
# Usage: mkpkg
|
# Usage: mkpkg [--debug] [--flavor flavor] [--platform platform]
|
||||||
#
|
#
|
||||||
|
|
||||||
# Make sure IFS is set to space, tab, newline in that order.
|
# Make sure IFS is set to space, tab, newline in that order.
|
||||||
@ -9,6 +9,43 @@ nl='
|
|||||||
'
|
'
|
||||||
IFS=" $nl"
|
IFS=" $nl"
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
usage="usage: mkpkg [--debug] [--flavor flavor] [--platform platform]"
|
||||||
|
debug=0
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
--debug)
|
||||||
|
set -x
|
||||||
|
PPFLAGS="--debug${PPFLAGS+ }${PPFLAGS}"
|
||||||
|
;;
|
||||||
|
--flavor=?*)
|
||||||
|
arg=`echo "$1" | sed -n 's/^--flavor=\(.*\)/\1/p'`
|
||||||
|
PPVARS="${PPVARS}${PPVARS+ }flavor=$arg"
|
||||||
|
;;
|
||||||
|
--flavor)
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "$usage" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PPVARS="${PPVARS}${PPVARS+ }flavor=$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--platform=?*)
|
||||||
|
arg=`echo "$1" | sed -n 's/^--platform=\(.*\)/\1/p'`
|
||||||
|
PPVARS="${PPVARS}${PPVARS+ }platform=$arg"
|
||||||
|
;;
|
||||||
|
--platform)
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "$usage" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PPVARS="${PPVARS}${PPVARS+ }platform=$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
top_srcdir=`dirname $0`
|
top_srcdir=`dirname $0`
|
||||||
|
|
||||||
platform=`$top_srcdir/pp --probe` || exit 1
|
platform=`$top_srcdir/pp --probe` || exit 1
|
||||||
@ -139,4 +176,4 @@ IFS=" $nl"
|
|||||||
set -- $configure_opts
|
set -- $configure_opts
|
||||||
IFS="$OIFS"
|
IFS="$OIFS"
|
||||||
$top_srcdir/configure "$@" || exit 1
|
$top_srcdir/configure "$@" || exit 1
|
||||||
make $make_opts && make $make_opts package
|
make $make_opts && make $make_opts PPFLAGS="$PPFLAGS" PPVARS="$PPVARS" package
|
||||||
|
8
sudo.pp
8
sudo.pp
@ -1,6 +1,6 @@
|
|||||||
%set
|
%set
|
||||||
if test -n "$SUDO_FLAVOR"; then
|
if test -n "$flavor"; then
|
||||||
name="sudo-$SUDO_FLAVOR"
|
name="sudo-$flavor"
|
||||||
else
|
else
|
||||||
name="sudo"
|
name="sudo"
|
||||||
fi
|
fi
|
||||||
@ -183,7 +183,7 @@ still allow people to get their work done."
|
|||||||
|
|
||||||
# create symlink to ease transition to new path for ldap config
|
# create symlink to ease transition to new path for ldap config
|
||||||
# if old config file exists and new one doesn't
|
# if old config file exists and new one doesn't
|
||||||
if test X"%{SUDO_FLAVOR}" = X"ldap" -a \
|
if test X"%{flavor}" = X"ldap" -a \
|
||||||
-r /etc/ldap/ldap.conf -a ! -r /etc/sudo-ldap.conf; then
|
-r /etc/ldap/ldap.conf -a ! -r /etc/sudo-ldap.conf; then
|
||||||
ln -s /etc/ldap/ldap.conf /etc/sudo-ldap.conf
|
ln -s /etc/ldap/ldap.conf /etc/sudo-ldap.conf
|
||||||
fi
|
fi
|
||||||
@ -213,7 +213,7 @@ still allow people to get their work done."
|
|||||||
%preun [deb]
|
%preun [deb]
|
||||||
# Remove the /etc/ldap/ldap.conf -> /etc/sudo-ldap.conf symlink if
|
# Remove the /etc/ldap/ldap.conf -> /etc/sudo-ldap.conf symlink if
|
||||||
# it matches what we created in the postinstall script.
|
# it matches what we created in the postinstall script.
|
||||||
if test X"%{SUDO_FLAVOR}" = X"ldap" -a \
|
if test X"%{flavor}" = X"ldap" -a \
|
||||||
X"`readlink /etc/sudo-ldap.conf 2>/dev/null`" = X"/etc/ldap/ldap.conf"; then
|
X"`readlink /etc/sudo-ldap.conf 2>/dev/null`" = X"/etc/ldap/ldap.conf"; then
|
||||||
rm -f /etc/sudo-ldap.conf
|
rm -f /etc/sudo-ldap.conf
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user