Created
June 25, 2012 06:49
-
-
Save alab1001101/2987067 to your computer and use it in GitHub Desktop.
Mozilla Updater Shell Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LIBDIR=/usr/lib64 | |
BINDIR=/usr/bin | |
TMPDIR=/tmp/mozup | |
FTP_BASE=ftp://releases.mozilla.org/mirror/mozilla | |
FTP_PATH=releases/latest/linux-x86_64/de | |
rm -rf $TMPDIR | |
mkdir $TMPDIR | |
cd $TMPDIR | |
function fetch_install() | |
{ | |
PROGRAM=$1 | |
FTPFULL=$FTP_BASE/$PROGRAM/$FTP_PATH/ | |
TARFILE=$(echo 'ls' | ftp -i $FTPFULL | awk '/'$PROGRAM'/ {print $9; exit}') | |
RELEASE=${TARFILE%.*.*} | |
if [[ ! -d $LIBDIR/$RELEASE ]] ; then | |
echo "get $TARFILE" | ftp -i $FTPFULL | |
sudo tar -C $LIBDIR -xvf $TARFILE --transform 's/^'$PROGRAM'/'$RELEASE'/' | |
[[ -L $BINDIR/$PROGRAM ]] && sudo rm $BINDIR/$PROGRAM | |
sudo ln -s $LIBDIR/$RELEASE/$PROGRAM $BINDIR/$PROGRAM | |
else | |
echo $RELEASE allready installed | |
fi | |
} | |
fetch_install firefox | |
fetch_install thunderbird | |
rm -rf $TMPDIR | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment