bash/bash-patchset.sh

26 lines
855 B
Bash
Raw Normal View History

#!/bin/sh
# by Silvan Calarco <silvan.calarco@mambasoft.it>
BASH_PATCHVERSION=$1
BASH_MAJVER=$(echo $BASH_PATCHVERSION | cut -d. -f1-2)
BASH_MAJVER_NODOT=$(echo $BASH_MAJVER | tr -d .)
BASH_PATCHVER=$(echo $BASH_PATCHVERSION | cut -d. -f3)
if [ -z "$BASH_PATCHVERSION" ]; then
echo "Usage: $0 <path_version>"
echo
echo "E.g.: $0 4.2.045"
exit 2
fi
rm -rf bash-patchset-$BASH_PATCHVERSION
mkdir bash-patchset-$BASH_PATCHVERSION
cd bash-patchset-$BASH_PATCHVERSION
for f in `seq 1 $BASH_PATCHVER`; do
BASH_PATCHVER_FORMATTED=`printf "%03d" $f`
wget -r -N -l 1 -np -nd -A "bash*" ftp://ftp.gnu.org/pub/gnu/bash/bash-$BASH_MAJVER-patches/bash${BASH_MAJVER_NODOT}-${BASH_PATCHVER_FORMATTED} || exit 1
done
cd ..
tar -cz bash-patchset-$BASH_PATCHVERSION > bash-patchset-$BASH_PATCHVERSION.tar.gz
rm -rf bash-patchset-$BASH_PATCHVERSION