diff --git a/tools/install/build_fpc_snaphot_rpm.sh b/tools/install/build_fpc_snaphot_rpm.sh index 64a91633b3..532ef40471 100755 --- a/tools/install/build_fpc_snaphot_rpm.sh +++ b/tools/install/build_fpc_snaphot_rpm.sh @@ -3,6 +3,8 @@ set -x set -e +TmpDir=~/tmp + #------------------------------------------------------------------------------ # parse parameters #------------------------------------------------------------------------------ @@ -52,17 +54,15 @@ ARCH=`rpm --eval "%{_arch}"` #------------------------------------------------------------------------------ # create a temporary copy of the fpc sources to patch it -TmpDir=/tmp/`whoami`/fpc -rm -rf $TmpDir -if [ ! -d /tmp/`whoami` ]; then - mkdir -p /tmp/`whoami` -fi +TmpFPCDir=$TmpDir/fpc +rm -rf $TmpFPCDir +mkdir -p $TmpDir echo "extracting FPC from local svn ..." -svn export $FPCSrcDir $TmpDir +svn export $FPCSrcDir $TmpFPCDir # retrieve the version information -VersionFile="$TmpDir/compiler/version.pas" +VersionFile="$TmpFPCDir/compiler/version.pas" CompilerVersion=`cat $VersionFile | grep ' *version_nr *=.*;' | sed -e 's/[^0-9]//g'` CompilerRelease=`cat $VersionFile | grep ' *release_nr *=.*;' | sed -e 's/[^0-9]//g'` CompilerPatch=`cat $VersionFile | grep ' *patch_nr *=.*;' | sed -e 's/[^0-9]//g'` @@ -71,15 +71,15 @@ CompilerVersionStr="$CompilerVersion.$CompilerRelease.$CompilerPatch" LazVersion="$CompilerVersion.$CompilerRelease.$CompilerPatch$CompilerMinorPatch" # set version numbers in all Makefiles -perl replace_in_files.pl -sR -f '=\d.\d.\d' -r =$LazVersion -m 'Makefile(.fpc)?' $TmpDir/* +perl replace_in_files.pl -sR -f '=\d.\d.\d' -r =$LazVersion -m 'Makefile(.fpc)?' $TmpFPCDir/* # create a source tar.gz -cd $TmpDir/.. +cd $TmpDir tar -czf $RPMDIR/SOURCES/fpc-$LazVersion-$LazRelease.source.tar.gz fpc # remove the tempdir cd - -rm -rf $TmpDir +rm -rf $TmpFPCDir SpecFileTemplate=rpm/fpc.spec.template SpecFile=$RPMDIR/SPECS/fpc.spec @@ -95,4 +95,4 @@ cat $SpecFileTemplate | \ rpmbuild --target $ARCH -ba $SpecFile --nodeps -export FpcFullVersion=$LazVersion \ No newline at end of file +export FpcFullVersion=$LazVersion diff --git a/tools/install/check_fpc_dependencies.sh b/tools/install/check_fpc_dependencies.sh index ee3045378e..7f16b1b53a 100755 --- a/tools/install/check_fpc_dependencies.sh +++ b/tools/install/check_fpc_dependencies.sh @@ -8,7 +8,7 @@ set -e # try to compile a program echo Testing fpc ... -TmpDir=/tmp/fpc +TmpDir=~/tmp/fpc rm -rf $TmpDir mkdir -p $TmpDir TestPas=$TmpDir/test.pas diff --git a/tools/install/create_fpc-src_rpm.sh b/tools/install/create_fpc-src_rpm.sh index 1cccf73462..cad5501ac0 100755 --- a/tools/install/create_fpc-src_rpm.sh +++ b/tools/install/create_fpc-src_rpm.sh @@ -54,10 +54,12 @@ cat rpm/fpc-src.spec | \ > $SpecFile # copy custom rpm scripts -cp smart_strip.sh /tmp/smart_strip.sh -chmod a+x /tmp/smart_strip.sh -cp do_nothing.sh /tmp/do_nothing.sh -chmod a+x /tmp/do_nothing.sh +TmpDir=~/tmp +mkdir -p $TmpDir +cp smart_strip.sh $TmpDir/smart_strip.sh +chmod a+x $TmpDir/smart_strip.sh +cp do_nothing.sh $TmpDir/do_nothing.sh +chmod a+x $TmpDir/do_nothing.sh # build rpm rpmbuild -ba $SpecFile || rpm -ba $SpecFile diff --git a/tools/install/create_fpc_deb.sh b/tools/install/create_fpc_deb.sh index 495a2be9f3..46a422f631 100755 --- a/tools/install/create_fpc_deb.sh +++ b/tools/install/create_fpc_deb.sh @@ -154,11 +154,10 @@ fi #------------------------------------------------------------------------------ # create a temporary copy of the fpc sources to patch it -TmpDir=/tmp/fpc_patchdir +TmpDir=~/tmp/fpc_patchdir if [ "$WithTempDir" = "yes" ]; then if [ -d $TmpDir ]; then - rm -rf $TmpDir/* - rm -r $TmpDir + rm -rf $TmpDir fi mkdir -p $TmpDir diff --git a/tools/install/create_fpc_export_tgz.sh b/tools/install/create_fpc_export_tgz.sh index bbe8ef7d11..f4113ea568 100755 --- a/tools/install/create_fpc_export_tgz.sh +++ b/tools/install/create_fpc_export_tgz.sh @@ -20,24 +20,28 @@ if [ "x$OutputFile" = "x" ]; then exit fi +TmpDir=~/tmp +TmpFPCDir=$TmpDir/fpc +FPCTGZ=$TmpDir/fpc.tgz if [ "x$Download" = "xyes" ]; then echo "downloading fpc svn ..." - cd /tmp - rm -rf /tmp/fpc - svn export http://svn.freepascal.org/svn/fpc/trunk fpc + rm -rf $TmpFPCDir + mkdir -p $TmpDir + cd $TmpDir + svn export http://svn.freepascal.org/svn/fpc/trunk $TmpFPCDir cd - else echo "extracting fpc from local svn ..." - rm -rf /tmp/fpc - svn export $SourceDir /tmp/fpc + rm -rf $TmpFPCDir + svn export $SourceDir $TmpFPCDir fi -cd /tmp +cd $TmpDir echo "packing ..." -tar cvzf /tmp/fpc.tgz fpc +tar cvzf $FPCTGZ fpc cd - -mv /tmp/fpc.tgz $OutputFile -rm -rf /tmp/fpc +mv $FPCTGZ $OutputFile +rm -rf $TmpFPCDir # end. diff --git a/tools/install/create_fpc_rpm.sh b/tools/install/create_fpc_rpm.sh index af5def5244..726a26d7f2 100755 --- a/tools/install/create_fpc_rpm.sh +++ b/tools/install/create_fpc_rpm.sh @@ -51,10 +51,9 @@ fi #------------------------------------------------------------------------------ # create a temporary copy of the fpc sources to patch it -TmpDir=/tmp/fpc_patchdir +TmpDir=~/tmp/fpc_patchdir if [ "$WithTempDir" = "yes" ]; then if [ -d $TmpDir ]; then - # note: beware of malicious links rm -rf $TmpDir fi mkdir -p $TmpDir diff --git a/tools/install/create_fpc_tgz_from_local_dir.sh b/tools/install/create_fpc_tgz_from_local_dir.sh index effcf127b7..b62cdc7916 100755 --- a/tools/install/create_fpc_tgz_from_local_dir.sh +++ b/tools/install/create_fpc_tgz_from_local_dir.sh @@ -32,21 +32,15 @@ if [ ! -d $FPCSrcDir/compiler ]; then exit -1 fi -TmpBaseDir=/tmp +TmpBaseDir=~/tmp TmpDir=$TmpBaseDir/fpc rm -rf $TmpDir -if [ -d $FPCSrcDir/CVS ]; then - ppc386 -Fu../../lcl/units/i386/linux cvsexportlocal.pas - echo "extracting FPC from local cvs ..." - ./cvsexportlocal $FPCSrcDir $TmpDir +if [ -d $FPCSrcDir/.svn ]; then + echo "extracting FPC from local svn ..." + svn export $FPCSrcDir $TmpDir else - if [ -d $FPCSrcDir/.svn ]; then - echo "extracting FPC from local svn ..." - svn export $FPCSrcDir $TmpDir - else - cp -a $FPCSrcDir $TmpDir - fi + cp -a $FPCSrcDir $TmpDir fi if [ $RenameSmart = "yes" ]; then diff --git a/tools/install/create_lazarus_export_tgz.sh b/tools/install/create_lazarus_export_tgz.sh index 360da8e335..336a0c6b02 100755 --- a/tools/install/create_lazarus_export_tgz.sh +++ b/tools/install/create_lazarus_export_tgz.sh @@ -5,6 +5,7 @@ set -e OutputFile=$1 Usage="$0 [download] outputfilename" +TmpDir=~/tmp Download=no if [ "x$1" = "xdownload" ]; then @@ -17,29 +18,32 @@ if [ "x$OutputFile" = "x" ]; then exit fi +TmpLazDir=$TmpDir/lazarus +rm -rf $TmpLazDir if [ "x$Download" = "xyes" ]; then echo "downloading lazarus svn ..." - cd /tmp - rm -rf /tmp/lazarus - svn export http://svn.freepascal.org/svn/lazarus/trunk lazarus + mkdir -p $TmpLazDir + cd $TmpDir + svn export http://svn.freepascal.org/svn/lazarus/trunk $TmpLazDir cd - else echo "extracting lazarus from local svn ..." SourceDir=$(pwd | sed -e 's#lazarus[_0-9]*/tools.*$#lazarus#') - rm -rf /tmp/lazarus - svn export $SourceDir /tmp/lazarus + cd $TmpDir + svn export $SourceDir $TmpLazDir + cd - fi # add ide/revision.inc -Revision=$(svnversion /tmp/lazarus) -echo "const RevisionStr = '$Revision';" > /tmp/lazarus/ide/revision.inc +Revision=$(svnversion $TmpLazDir) +echo "const RevisionStr = '$Revision';" > $TmpLazDir/ide/revision.inc -cd /tmp +cd $TmpDir echo "packing ..." tar cvzf lazarus.tgz lazarus cd - -mv /tmp/lazarus.tgz $OutputFile -rm -rf /tmp/lazarus +mv $TmpDir/lazarus.tgz $OutputFile +rm -rf $TmpLazDir # end. diff --git a/tools/install/create_lazarus_rpm.sh b/tools/install/create_lazarus_rpm.sh index 99b4293191..ba7fb1e46f 100755 --- a/tools/install/create_lazarus_rpm.sh +++ b/tools/install/create_lazarus_rpm.sh @@ -24,7 +24,6 @@ LazVersion=$(./get_lazarus_version.sh) LazRelease='0' # $(echo $FPCRPM | sed -e 's/-/_/g') Src=lazarus-$LazVersion-$LazRelease.tar.gz SrcTGZ=$(./rpm/get_rpm_source_dir.sh)/SOURCES/$Src -TmpDir=/tmp/lazarus$LazVersion SpecFile=rpm/lazarus-$LazVersion-$LazRelease.spec Arch=$(rpm --eval "%{_arch}") diff --git a/tools/install/create_lazarus_slacktgz.sh b/tools/install/create_lazarus_slacktgz.sh index 13967b7a97..7306364120 100755 --- a/tools/install/create_lazarus_slacktgz.sh +++ b/tools/install/create_lazarus_slacktgz.sh @@ -11,8 +11,8 @@ Day=$(date +%d) # get installed fpc version echo "getting installed fpc version ..." if ! which ppc386 ; then - echo ERROR: fpc not installed - exit + echo ERROR: fpc not installed + exit fi FPCVER=`ppc386 -l | head -n 1 | awk '{print $5}'` echo "installed fpc version: $FPCVER" @@ -20,17 +20,19 @@ echo "installed fpc version: $FPCVER" Date=$Year$Month$Day LazVersion=$(./get_lazarus_version.sh) LazRelease='0' # $(echo $FPCRPM | sed -e 's/-/_/g') -Src=/tmp/lazarus-$LazVersion-$LazRelease.tar.gz -TmpDir=/tmp/lazarus$LazVersion +TmpDir=~/tmp/lazarus$LazVersion +Src=~/tmp/lazarus-$LazVersion-$LazRelease.tar.gz +SlackTGZ=~/tmp/lazarus-$LazVersion-i486-$LazRelease.tgz DescFile=slacktgz/slack-desc DepFile=slacktgz/slack-required -BuildRoot=/tmp/lazaruspackage/ +BuildRoot=~/tmp/lazaruspackage/ SrcDir="$TmpDir/lazarus" Where=`pwd` # download lazarus svn if needed echo "creating lazarus tgz ..." ./create_lazarus_export_tgz.sh $Src + rm -rf $TmpDir mkdir -p $TmpDir cd $TmpDir tar zxvf $Src @@ -44,7 +46,7 @@ echo "fpcsrc >= $FPCVER" >> $DepFile # build slacktgz echo "building slackware tgz package ..." if [ -d $BuildRoot ] ; then - rm -fr $BuildRoot + rm -fr $BuildRoot fi mkdir $BuildRoot mkdir -p $BuildRoot/install @@ -69,13 +71,13 @@ cp -arf $SrcDir/* $BuildRoot/usr/lib/lazarus/ ln -sf /usr/lib/lazarus/lazbuild usr/bin/lazbuild cat $SrcDir/install/man/man1/lazbuild.1 | gzip > $BuildRoot/usr/man/man1/lazbuild.1.gz -/sbin/makepkg -l y -c y /tmp/lazarus-$LazVersion-i486-$LazRelease.tgz +/sbin/makepkg -l y -c y $SlackTGZ cd #Clean up rm -fr $BuildRoot $TmpDir -echo "The new slackware tgz can be found at: /tmp/lazarus-$LazVersion-i486-$LazRelease.tgz" +echo "The new slackware tgz can be found at: $SlackTGZ" echo "A source package is has been created at: $Src" # end. diff --git a/tools/install/create_lazarus_snapshot_rpm.sh b/tools/install/create_lazarus_snapshot_rpm.sh index aedfc6fa4e..4f004394ee 100755 --- a/tools/install/create_lazarus_snapshot_rpm.sh +++ b/tools/install/create_lazarus_snapshot_rpm.sh @@ -45,8 +45,7 @@ if [ ! -f $FPCRPM ]; then exit fi -User=`whoami` -TmpFPCDir=/tmp/$User/fpc +TmpFPCDir=~/tmp/fpc if [ -e $TmpFPCDir ]; then rm -rf $TmpFPCDir fi @@ -63,27 +62,28 @@ export FPC FPCDIR=$TmpFPCDir/usr/$LIB/fpc/$FPCVersion export FPCDIR cd - +rm -rf $TmpFPCDir # create a temporary copy of the lazarus sources for packaging LazVersion=$(./get_lazarus_version.sh) LazRelease=`echo $FPCRPM | sed -e 's/-/_/g'` -TmpDir=/tmp/`whoami`/lazarus +TmpDir=~/tmp/lazarus -rm -rf $TmpDir +rm -rf $TmpLazDir echo "extracting Lazarus source from local svn ..." -svn export $LazSrcDir $TmpDir +svn export $LazSrcDir $TmpLazDir if [ ! -e ../svn2revisioninc ]; then make -C ../.. tools OPT="-n @$FPCCfg" fi -../svn2revisioninc $LazSrcDir $TmpDir/ide/revision.inc +../svn2revisioninc $LazSrcDir $TmpLazDir/ide/revision.inc # create a source tar.gz -cd $TmpDir/.. +cd $TmpLazDir/.. tar -czf $RPMDIR/SOURCES/lazarus-$LazVersion-$Date.tar.gz lazarus # remove the tempdir cd - -rm -rf $TmpDir +rm -rf $TmpLazDir # create spec file SpecFile=$RPMDIR/SPECS/lazarus-$LazVersion-$Date.spec @@ -97,7 +97,5 @@ cat rpm/lazarus.spec.template | \ # build rpm rpmbuild --target $ARCH -ba $SpecFile --nodeps -rm -rf $TmpFpcDir - # end. diff --git a/tools/install/macosx/makefpcsnapshot.sh b/tools/install/macosx/makefpcsnapshot.sh index eb9ed73a6d..d68f7110d4 100755 --- a/tools/install/macosx/makefpcsnapshot.sh +++ b/tools/install/macosx/makefpcsnapshot.sh @@ -32,6 +32,7 @@ BUILDDIR=~/tmp/build FPCBUILDDIR=$BUILDDIR/fpc INSTALLDIR=~/tmp/fpc INSTALLFPCDIR=~/fpc +TRASHDIR=~/tmp/trash PPCARCH=ppcppc CREATECROSSPPC=0 @@ -88,16 +89,14 @@ FPCARCH=`$COMPILER -iSP` # clean installdir: since I am not root and the install dir can contain files owned by root # created by a previous freeze, I just move it out of the way -if [ ! -d /tmp/`whoami`/trash ] ; then - mkdir -p /tmp/`whoami`/trash -fi +mkdir -p $TRASHDIR set +e rm -rf $INSTALLDIR set -e if [ -d $INSTALLDIR ]; then - mv $INSTALLDIR /tmp/`whoami`/trash/ + mv $INSTALLDIR $TRASHDIR fi mkdir -p $INSTALLDIR make install PP=$COMPILER INSTALL_PREFIX=$INSTALLDIR diff --git a/tools/install/macosx/makefpcsrcsnapshot.sh b/tools/install/macosx/makefpcsrcsnapshot.sh index 7fc8b23e5e..fb8ea46cd8 100755 --- a/tools/install/macosx/makefpcsrcsnapshot.sh +++ b/tools/install/macosx/makefpcsrcsnapshot.sh @@ -51,10 +51,8 @@ PACKPROJ=fpcsrc.packproj.template # clean installdir: since I am not root and the install dir can contain files owned by root # created by a previous freeze, I just move it out of the way -TRASHDIR=/tmp/`whoami`/trash -if [ ! -d $TRASHDIR ] ; then - mkdir -p $TRASHDIR -fi +TRASHDIR=~/tmp/trash +mkdir -p $TRASHDIR if [ -d $INSTALLDIR ] ; then mv $INSTALLDIR $TRASHDIR/fpcsrc-`date +%Y%m%d%H%M%S` fi diff --git a/tools/install/macosx/makelazsnapshot.sh b/tools/install/macosx/makelazsnapshot.sh index 0c40b5920c..439498ca3e 100755 --- a/tools/install/macosx/makelazsnapshot.sh +++ b/tools/install/macosx/makelazsnapshot.sh @@ -55,10 +55,8 @@ cd - # clean builddir: since I am not root and the install dir can contain files owned by root # created by a previous freeze, I just move it out of the way -TRASHDIR=/tmp/`whoami`/trash -if [ ! -d $TRASHDIR ] ; then - mkdir -p $TRASHDIR -fi +TRASHDIR=~/tmp/trash +mkdir -p $TRASHDIR if [ -d $BUILDDIR ] ; then mv $BUILDDIR $TRASHDIR/lazbuild-`date +%Y%m%d%H%M%S` fi