shorewall_code/tools/build/upload

187 lines
4.2 KiB
Plaintext
Raw Normal View History

#/bin/sh
usage() {
echo "Usage: upload [-pclsxh] <version>"
rpm=
literpm=
perlrpm=
shellrpm=
DEST=
USER="webadmin@mail.shorewall.net"
SHOREWALL=shorewall
COMMAND=scp
UPLOADCOMMON=
UPLOADPERL=
UPLOADSHELL=
UPLOADLITE=
UPLOADXML=
UPLOADHTML=
done=
case $1 in
-*)
;;
*)
UPLOADCOMMON=Yes
UPLOADPERL=Yes
UPLOADSHELL=Yes
UPLOADLITE=Yes
UPLOADXML=Yes
UPLOADHTML=Yes
done=Yes
;;
esac
while [ -z "$done" ]; do
[ $# -eq 0 ] && break
option=$1
case $option in
-*)
option=${option#-}
[ -z "$option" ] && break
while [ -n "$option" ]; do
case $option in
p*)
UPLOADPERL=Yes
option=${option#p}
;;
c*)
UPLOADCOMMON=Yes
option=${option#c}
;;
s*)
UPLOADSHELL=Yes
option=${option#s}
;;
l*)
UPLOADLITE=Yes
option=${option#l}
;;
x*)
UPLOADXML=Yes
option=${option#x}
;;
h*)
UPLOADHTML=Yes
option=${option#h}
;;
*)
usage
;;
esac
done
shift
;;
*)
done=Yes
;;
esac
done
case $1 in
4.*Beta*|4.*RC*)
DEST="/srv/ftp/pub/shorewall/development/${1%.*}/shorewall-$1"
SHOREWALL=shorewall-common
rpm=shorewall-common-${1%-*}-0${1#*-}.noarch.rpm
literpm=shorewall-lite-${1%-*}-0${1#*-}.noarch.rpm
perlrpm=shorewall-perl-${1%-*}-0${1#*-}.noarch.rpm
shellrpm=shorewall-shell-${1%-*}-0${1#*-}.noarch.rpm
;;
4.0.*-*)
DEST="/srv/ftp/pub/shorewall/${1%.*}/shorewall-${1%-*}"
SHOREWALL=shorewall-common
;;
4.0.*)
DEST="/srv/ftp/pub/shorewall/${1%.*}/shorewall-$1"
SHOREWALL=shorewall-common
rpm=shorewall-common-${1}-1.noarch.rpm
literpm=shorewall-lite-${1}-1.noarch.rpm
perlrpm=shorewall-perl-${1}-1.noarch.rpm
shellrpm=shorewall-shell-${1}-1.noarch.rpm
;;
4.1.*)
DEST="/srv/ftp/pub/shorewall/development/${1%.*}/shorewall-$1"
SHOREWALL=shorewall-common
rpm=shorewall-common-${1}-1.noarch.rpm
literpm=shorewall-lite-${1}-1.noarch.rpm
perlrpm=shorewall-perl-${1}-1.noarch.rpm
shellrpm=shorewall-shell-${1}-1.noarch.rpm
;;
3.*[13579].*)
DEST="/srv/ftp/pub/shorewall/development/${1%.*}/shorewall-$1"
rpm=shorewall-${1}-1.noarch.rpm
literpm=shorewall-lite-${1}-1.noarch.rpm
;;
*.*[13579].*)
DEST="/srv/ftp/pub/shorewall/development/${1%.*}/shorewall-$1"
rpm=shorewall-${1}-1.noarch.rpm
;;
3.*Beta*|*RC*)
DEST="/srv/ftp/pub/shorewall/development/${1%.*}/shorewall-$1"
rpm=shorewall-${1%-*}-0${1#*-}.noarch.rpm
literpm=shorewall-lite-${1%-*}-0${1#*-}.noarch.rpm
;;
*.*Beta*|*RC*)
DEST="/srv/ftp/pub/shorewall/development/${1%.*}/shorewall-$1"
rpm=shorewall-${1%-*}-0${1#*-}.noarch.rpm
literpm=shorewall-lite-${1%-*}-0${1#*-}.noarch.rpm
perlrpm=shorewall-perl-${1%-*}-0${1#*-}.noarch.rpm
shellrpm=shorewall-shell-${1%-*}-0${1#*-}.noarch.rpm
;;
3.[2468].*)
DEST="/srv/ftp/pub/shorewall/${1%.*}/shorewall-$1"
rpm=shorewall-${1}-1.noarch.rpm
literpm=shorewall-lite-${1}-1.noarch.rpm
;;
*.[2468].*)
DEST="/srv/ftp/pub/shorewall/${1%.*}/shorewall-$1"
rpm=shorewall-${1}-1.noarch.rpm
literpm=shorewall-lite-${1}-1.noarch.rpm
perlrpm=shorewall-perl-${1}-1.noarch.rpm
shellrpm=shorewall-shell-${1}-1.noarch.rpm
;;
*)
DEST="/srv/ftp/pub/shorewall/${1%.*}/shorewall-$1"
rpm=shorewall-${1}-1.noarch.rpm
;;
esac
[ $# -eq 1 ] || { echo "Usage: $(basename $0) <version>"; exit 2; }
[ -d errata ] || mkdir errata
[ -f known_problems.txt ] || echo "There are no known problems in Shorewall version $1" > known_problems.txt
if [ -f shorewall-lite-${1}/releasenotes.txt ]; then
cat $SHOREWALL-${1}/releasenotes.txt shorewall-lite-${1}/releasenotes.txt > releasenotes.txt
else
cat $SHOREWALL-${1}/releasenotes.txt > releasenotes.txt
fi
if [ "$HOSTNAME" = lists ]; then
mkdir -p $DEST
COMMAND=cp
else
ssh $USER mkdir -p $DEST
DEST=${USER}:${DEST}
fi
files="errata known_problems.txt releasenotes.txt patch-$1 ${1}.*"
[ -n "$UPLOADPERL" ] && files="$files shorewall-perl-${1}.* $perlrpm"
[ -n "$UPLOADCOMMON" ] && files="$files shorewall-common-${1}.* $rpm"
[ -n "$UPLOADSHELL" ] && files="$files shorewall-shell-${1}.* $shellrpm"
[ -n "$UPLOADLITE" ] && files="$files shorewall-lite-${1}.* $literpm"
[ -n "$UPLOADXML" ] && files="$files shorewall-docs-xml-${1}.* $literpm"
[ -n "$UPLOADHTML" ] && files="$files shorewall-docs-html-${1}.* $literpm"
$COMMAND -r $files $DEST