Eine Kleinigkeit habe ich noch in dein Skript eingebaut. Es Prüft nun ob die svn Protokoll Datei schon existiert und zeigt die vorherige SVN Revision an, das ist dann nützlich wenn der Build nicht geklappt hat, dann weis man welche alte Revisionsnummer man nehmen kann. Evtl. Kriege ich auch noch raus, wie man das Skript so macht, dass man die Revisionsnummer mit übergeben kann auf die man Aktualisieren will.
Code: Alles auswählen
#bin/sh
echo "This script downloads the newest SVN revision and recompiles the IDE"
# Type here the Path where your lazarus is located to.
LAZPATH=$HOME"/lazarus/"
STRIPCMD="/usr/bin/strip --strip-all "
SVNPROTOFILE="svnprotocol.txt"
BUILDPROTOFILE="buildprotocol.txt"
FULL=false
STRIP=true
ALWAYSBUILD=false
while getopts ":fnap:?" optname
do
case "$optname" in
"f")
FULL=true
;;
"n")
STRIP=false
;;
"p")
LAZPATH=$OPTARG
;;
"a")
ALWAYSBUILD=true
;;
"?")
echo -e "Usage:\n -p<Path>: Path to Lazarus\n -f : Full make\n -n : Do not strip\n -a : Always build"
exit
;;
":")
echo "No argument value for option $OPTARG"
exit
;;
*)
# Should not occur
echo "Unknown error while processing options"
exit
;;
esac
done
# Switch to lazarus path
echo "CD to ".$LAZPATH
cd $LAZPATH
# make the svn update and rewrite SVNPROTOFILE
if [ -f $SVNPROTOFILE ]; then
counter=$(wc -l < $SVNPROTOFILE)
LASTLINE=`tail -1 $SVNPROTOFILE`
len=`expr length "$LASTLINE"`
echo "Update from old SVN-Revision : " ${LASTLINE:len-7:7}
else
echo "Update from SVN"
fi
svn update > $SVNPROTOFILE
counter=$(wc -l < $SVNPROTOFILE)
LASTLINE=`tail -1 $SVNPROTOFILE`
if [ $counter == 1 ]; then
echo "Your version is up to date "$LASTLINE
if [ $ALWAYSBUILD == false ]; then
exit
fi
else
echo $LASTLINE
fi
# clean old files and rewrite BUILDPROTOFILE
echo "Clean everything"
make clean > $BUILDPROTOFILE
# Compile the tools
echo "Compile the tools"
if [ $FULL == true ]; then
echo "Full"
make lazbuild lcl ideintf components tools starter >> $BUILDPROTOFILE
if [ $STRIP == true ]; then
echo "Strip starter lazbuild tools"
$STRIPCMD"$LAZPATH"startlazarus
$STRIPCMD"$LAZPATH"lazbuild
$STRIPCMD"$LAZPATH"tools/lazres
$STRIPCMD"$LAZPATH"tools/lrstolfm
$STRIPCMD"$LAZPATH"tools/svn2revisioninc
$STRIPCMD"$LAZPATH"tools/updatepofiles
fi
else
echo "Partial"
make lazbuild lcl ideintf components >> $BUILDPROTOFILE
if [ $STRIP == true ]; then
echo "Strip lazbuild"
$STRIPCMD"$LAZPATH"lazbuild
fi
fi
# Compile the IDE with all packages ( Myprofile )
echo "Compile the IDE"
EXECCOMMAND="lazbuild --build-ide= --build-mode="
"$LAZPATH"$EXECCOMMAND >> $BUILDPROTOFILE
if [ $STRIP == true ]; then
echo "Strip lazarus"
$STRIPCMD"$LAZPATH"lazarus
fi
echo "Finished."