PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Shellscript for downloading and compiling software... A few errors



Linuxsys
17-09-2004, 22:56
#!/bin/bash

datum='date +%Y''%m''%d'
who='whoami'

if [ "/usr/bin/wget" ];then
cd $HOME
echo "Using wget for getting the tar file"

if [ "$HOME/aMule-cvs-$datum.tar.bz2" ]
then
echo "File exists - will not download the file again^^"
else
wget http://amule.hirnriss.net/cvs/aMule-cvs-$datum.tar.bz2
fi

if [ "$HOME/amule-cvs" ];then
rm -Rf $HOME/amule-cvs
echo "Deleting old amule directory for preventing Bugs through old data"

if [ "aMule-cvs-$datum.tar.bz2" ];then
echo "Unpacking source"
tar jxf aMule-cvs-$datum.tar.bz2 -C $HOME
cd $HOME/amule-cvs
nohup $HOME/amule-cvs/autogen.sh
echo "Running autogen.sh -- see autogen.sh for a log file!"
mv $HOME/amule-cvs/nohup.out $HOME/amule-cvs/autogensh.txt
cd $HOME/amule-cvs
echo "Configuring for debugging, disabled optimizations and enabled the graphical client -- see configure.txt for a log"
nohup $HOME/amule-cvs/configure --prefix=/usr --enable-debug --disable-optimize --enable-amulecmdgui
mv $HOME/amule-cvs/nohup.out $HOME/amule-cvs/configure.txt
cd $HOME/amule-cvs
echo "Running make, see make.txt for a log!"
nohup make -C $HOME/amule-cvs
mv nohup.out make.txt

if [ "$who" != "root" ];then
echo "Using sudo to make install, logging to install.txt"
sudo nohup make -C $HOME/amule-cvs install
mv nohup.out install.txt
else
echo "Doing make install"
nohup make -C $HOME/amule-cvs install
mv nohup.out install.txt
exit
fi
fi
fi
fi

Erstes Problem ist:
if [ "$HOME/aMule-cvs-$datum.tar.bz2" ]
then
echo "File exists - will not download the file again^^"
else
wget http://amule.hirnriss.net/cvs/aMule-cvs-$datum.tar.bz2
fi

Irgendwie macht der das nicht....

Zweites Problem ist:
nohup gibt ständig diese nervende Meldung aus, dass das alles in nohup.out gespeichert wird - kann man das unterdrücken?

Drittes Problem ist die zweite else Schleife:

if [ "$who" != "root" ];then
echo "Using sudo to make install, logging to install.txt"
sudo nohup make -C $HOME/amule-cvs install
mv nohup.out install.txt
else
echo "Doing make install"
nohup make -C $HOME/amule-cvs install
mv nohup.out install.txt
...
Das geht auch nicht - wo liegt der Fehler?

Gebt einem Anfänger mal Hilfe... :confused:

peschmae
18-09-2004, 07:52
if [ -e "$HOME/aMule-cvs-$datum.tar.bz2" ]

bzw. man test

Für den Rest hab ich jetzt gerade keine Zeit ;)

MfG Peschmä

Linuxsys
18-09-2004, 17:29
Danke :D

Habe jetzt alles so wie ich es will.


#!/bin/bash

datum=`date +%Y''%m''%d`
who='whoami'

if [ "/usr/bin/wget" ];then
cd $HOME
echo "Using wget for getting the tar file"

if [ -r "$HOME/aMule-cvs-$datum.tar.bz2" ]
then
echo "File exists - will not download the file again^^"
else
wget http://amule.hirnriss.net/cvs/aMule-cvs-$datum.tar.bz2
fi

if [ "$HOME/amule-cvs" ];then
rm -Rf $HOME/amule-cvs
echo "Deleting old amule directory for preventing Bugs through old data"

if [ "aMule-cvs-$datum.tar.bz2" ];then
echo "Unpacking source"
tar jxf aMule-cvs-$datum.tar.bz2 -C $HOME
cd $HOME/amule-cvs
echo "Running autogen.sh -- see autogen.sh for a log file!"
$HOME/amule-cvs/autogen.sh >> autogensh.log
cd $HOME/amule-cvs
echo "Configuring for debugging, disabled optimizations, using embedded crypto and enabled the graphical client -- see configure.txt for a log"
$HOME/amule-cvs/configure --prefix=/usr --enable-debug --disable-optimize --enable-amulecmdgui --enable-embedded_crypto >> configure.txt
cd $HOME/amule-cvs
echo "Running make, see make.txt for a log!"
nohup make -C $HOME/amule-cvs >> make.txt

if [ "$who" != "root" ];then
echo "Using sudo to make install, logging to install.txt"
sudo -u root make -C $HOME/amule-cvs install >> install.txt
else
echo "Doing make install"
nohup make -C $HOME/amule-cvs install
exit
fi
fi
fi
fi

Tut gut sein Werk und ist mir ne grosse Hilfe :D

peschmae
18-09-2004, 20:06
A propos: JDieskau vom lf.de hat so ein Monster-Shellscript geschrieben das ziemlich beliebige Software von Sourceforge/Freshmeat/... herunterladen und installieren kann. Evtl. möchtest du ja auch das mal angucken.

Hiess glaub ich jdcvs oder so, das Script. klick (http://www.linuxforen.de/forums/showthread.php?t=141926&highlight=jdcvs)

MfG Peschmä