From 70410957426362e8d1c3471adcaf6084a27056e2 Mon Sep 17 00:00:00 2001 From: teastep Date: Sat, 19 Aug 2006 17:10:32 +0000 Subject: [PATCH] Finish makeshorewall changes for modularization git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4391 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- tools/build/makeshorewall | 121 ++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 19 deletions(-) diff --git a/tools/build/makeshorewall b/tools/build/makeshorewall index c5baacda5..559c798d9 100755 --- a/tools/build/makeshorewall +++ b/tools/build/makeshorewall @@ -33,6 +33,28 @@ # # If no options are given, all options are assumed. # +# The following environmental variables are used by the program: +# +# SAMPLES (value "Yes" or "No") -- Determines if the sample configurations +# are included in /usr/share/shorewall. +# Default is Yes. +# +# MACROS (value "Yes" or "No") -- Determines if the macro files +# are included in /usr/share/shorewall +# Default is Yes. +# +# CONFIGFILES (value "Yes" or "No") +# -- Determines if a copy of /etc/shorewall/* +# is included in /usr/share/shorewall/configfiles +# (Shorewall RPM) +# Default is Yes. +# +# XLIBS -- A space-separated list of run-time libraries +# to exclude from /usr/share/shorewall/. +# +# XCLIBS -- A space-separated list of compiler libraries +# to exclude from /usr/share/shorewall/. +# # If is given, a patch file reflecting the differences # between that version and the current version ( ) is # generated. The directory ./shorewall- must exist and @@ -64,23 +86,11 @@ GPG="/usr/bin/gpg -ab --batch --comment 'To verify this, you can download our pu # # Libraries to include in the tarball # -XLIBS="" +#XLIBS="" # # Compiler Libraries to exclude the tarball # -XCLIBS="" -# -# Include Samples -# -SAMPLES=Yes -# -# Include configfiles -# -CONFIGFILES=Yes -# -# Include macros -# -MACROS=Yes +#XCLIBS="" ################################################################################ # V A R I A B L E S ################################################################################ @@ -154,6 +164,61 @@ usage() set -e set -u +# +# Include Samples +# +if [ -n "$SAMPLES" ]; then + case $SAMPLES in + Y*|y*) + ;; + N*|n*) + SAMPLES= + ;; + *) + echo " ERROR: Invalid value ($SAMPLES) for SAMPLES" >&2 + exit 2 + ;; + esac +else + SAMPLES=Yes +fi +# +# Include configfiles +# +if [ -n "$CONFIGFILES" ]; then + case $CONFIGFILES in + Y*|y*) + ;; + N*|n*) + CONFIGFILES= + ;; + *) + echo " ERROR: Invalid value ($CONFIGFILES) for CONFIGFILES" >&2 + exit 2 + ;; + esac +else + CONFIGFILES=Yes +fi +# +# Include macros +# +if [ -n "$MACROS" ]; then + case $MACROS in + Y*|y*) + ;; + N*|n*) + MACROS= + ;; + *) + echo " ERROR: Invalid value ($MACROS) for MACROS" >&2 + exit 2 + ;; + esac +else + MACROS=Yes +fi + done= [ $# -eq 0 ] && usage @@ -303,6 +368,11 @@ if [ -n "${BUILDTARBALL}${BUILDRPM}" ]; then report "Lite SVN tag is $LITESVNBRANCH" [ -n "$BUILDTARBALL" ] && report "TARBALL is $TARBALL" && report "LITETARBALL is $LITETARBALL" [ -n "$BUILDRPM" ] && report "RPM is $RPMNAME" && report "LITERPM is $LITERPMNAME" + [ -n "$XLIBS" ] && report "Excluding the following run-time libraries: $XLIBS" + [ -n "$XCLIBS" ] && report "Excluding the following compiler libraries: $XCLIBS" + [ -n "$CONFIGFILES" ] && report "Including configuration files in /usr/share/shorewall/" || report "Excluding configuration files from /usr/share/shorewall/" + [ -n "$SAMPLES" ] && report "Including samples in /usr/share/shorewall/" || report "Excluding samples from /usr/share/shorewall/" + [ -n "$MACROS" ] && report "Including macros in /usr/share/shorewall/" || report "Excluding macros in /usr/share/shorewall/" fi [ -n "$BUILDHTML" ] && report "HTML Directory is $HTMLDIR" @@ -330,10 +400,14 @@ if [ -n "${BUILDTARBALL}${BUILDRPM}" ]; then fgrep VERSION=$VERSION $SHOREWALLLITEDIR/fallback.sh > /dev/null 2>&1 || fatal_error "Lite fallback.sh has wrong version" fi - if [ -n "$SAMPLES" -a -n "$SAMPLESTAG" ]; then - cd $SHOREWALLDIR - do_or_die "svn export --non-interactive --force https://svn.sourceforge.net/svnroot/shorewall/$SAMPLESTAG Samples >> $LOGFILE 2>&1" - cd $DIR + if [ -n "$SAMPLES" ]; then + if [ -n "$SAMPLESTAG" ]; then + cd $SHOREWALLDIR + do_or_die "svn export --non-interactive --force https://svn.sourceforge.net/svnroot/shorewall/$SAMPLESTAG Samples >> $LOGFILE 2>&1" + cd $DIR + fi + else + perl -p -w -i -e "s|Samples||" $SHOREWALLDIR/shorewall.spec fi do_or_die "rm -rf $SHOREWALLDIR/debian" @@ -344,14 +418,22 @@ if [ -n "${BUILDTARBALL}${BUILDRPM}" ]; then for lib in $XLIBS; do rm -f $SHOREWALLDIR/lib.${lib} + perl -p -w -i -e "s|.*/usr/share/shorewall/lib.${lib}\$||" $SHOREWALLDIR/shorewall.spec + perl -p -w -i -e "s|.*/usr/share/shorewall-lite/lib.${lib}\$||" $SHOREWALLLITEDIR/shorewall-lite.spec done - for clib in $XCLIBS; do + for lib in $XCLIBS; do rm -f $SHOREWALLDIR/clib.${lib} + perl -p -w -i -e "s|.*/usr/share/shorewall/clib.${lib}\$||" $SHOREWALLDIR/shorewall.spec done if [ -z "$MACROS" ]; then rm -f $SHOREWALLDIR/macro.* + perl -p -w -i -e "s|.*/usr/share/shorewall/macro.*||" $SHOREWALLDIR/shorewall.spec + fi + + if [ -z "$CONFIGFILES" ]; then + perl -p -w -i -e 's|^\./install.sh|\./install.sh -c|;s|.*configfiles.*||' $SHOREWALLDIR/shorewall.spec fi do_or_die "tar -zcvf $TARBALL $SHOREWALLDIR >> $LOGFILE 2>&1" @@ -366,6 +448,7 @@ if [ -n "${BUILDTARBALL}${BUILDRPM}" ]; then fi if [ -n "$HASLITE" ]; then progress_message "Creating $DIR/$LITETARBALL..." + do_or_die "cp $SHOREWALLDIR/lib.* $SHOREWALLLITEDIR >> $LOGFILE 2>&1" do_or_die "tar -zcvf $LITETARBALL $SHOREWALLLITEDIR >> $LOGFILE 2>&1" do_or_die "tar -jcvf shorewall-lite-${VERSION%-*}.tar.bz2 $SHOREWALLLITEDIR >> $LOGFILE 2>&1" if [ -n "$SIGN" ]; then