build_setup.sh (3499B)
1 #!/bin/bash 2 # Build various setups.. 3 4 # inputs: 5 # directory with the common media 6 Q3SETUPMEDIA=/home/timo/Id/Q3SetupMedia/quake3 7 # directory with binaries tree 8 Q3BINARIES=../install 9 # version: $1 10 VERSION=$1 11 # temporary directory used to prepare the files 12 # NOTE: this dir is erased before a new setup is built 13 TMPDIR=setup.tmp 14 15 # location of the setup dir (for graphical installer and makeself) 16 SETUPDIR=setup 17 18 # cp setup phase 19 # we need to copy the symlinked files, and not the symlinks themselves 20 # on antares this is forced with a cp -L 21 # on spoutnik, -L is not recognized, and dereference is the default behaviour 22 # we need a robust way of checking 23 TESTFILE=/tmp/foo$$ 24 touch $TESTFILE 25 # see if option is supported 26 cp -L $TESTFILE $TESTFILE.cp 2>/dev/null 27 if [ $? -eq 1 ] 28 then 29 # option not supported, should be on by default 30 echo "cp doesn't have -L option" 31 unset CPOPT 32 else 33 # option supported, use it 34 echo "cp supports -L option" 35 CPOPT="-L" 36 fi 37 rm $TESTFILE 38 39 40 # graphical installer (based on Loki Software's Setup tool) 41 build_installer () 42 { 43 TMPDIR=setup.tmp 44 45 rm -rf $TMPDIR 46 mkdir $TMPDIR 47 48 # copy base setup files 49 cp $CPOPT -R $SETUPDIR/setup.sh $SETUPDIR/setup.data $TMPDIR 50 51 # copy media files 52 cp $CPOPT -R $Q3SETUPMEDIA/* $TMPDIR 53 54 # remove CVS entries 55 find $TMPDIR -name CVS | xargs rm -rf 56 57 # copy binaries 58 mkdir -p $TMPDIR/bin/x86 59 # smp 60 cp $CPOPT $Q3BINARIES/linuxquake3-smp $TMPDIR/bin/x86/quake3-smp.x86 61 strip $TMPDIR/bin/x86/quake3-smp.x86 62 brandelf -t Linux $TMPDIR/bin/x86/quake3-smp.x86 63 # old school 64 cp $CPOPT $Q3BINARIES/linuxquake3 $TMPDIR/bin/x86/quake3.x86 65 strip $TMPDIR/bin/x86/quake3.x86 66 brandelf -t Linux $TMPDIR/bin/x86/quake3.x86 67 # ded 68 cp $CPOPT $Q3BINARIES/linuxq3ded $TMPDIR/bin/x86/q3ded 69 strip $TMPDIR/bin/x86/q3ded 70 brandelf -t Linux $TMPDIR/bin/x86/q3ded 71 72 # PB files 73 mkdir -p $TMPDIR/pb/htm 74 cp $CPOPT ../pb/linux/*.so $TMPDIR/pb 75 cp $CPOPT ../pb/htm/*.htm $TMPDIR/pb/htm 76 77 # Linux FAQ 78 mkdir -p $TMPDIR/Docs/LinuxFAQ 79 cp $CPOPT LinuxSupport/* $TMPDIR/Docs/LinuxFAQ 80 81 # generated .qvm pk3 files 82 mkdir -p $TMPDIR/baseq3 83 mkdir -p $TMPDIR/missionpack 84 # not needed now 85 #cp $CPOPT $Q3BINARIES/baseq3/pak8.pk3 $TMPDIR/baseq3/ 86 #cp $CPOPT $Q3BINARIES/missionpack/pak3.pk3 $TMPDIR/missionpack/ 87 88 # menu shortcut to the game 89 # FIXME current setup doesn't have a way to set symlinks on arbitrary things 90 # so we use a dummy quake3 script (which will be overwritten by postinstall.sh) 91 echo -e "#!/bin/sh\necho \"If you read this, then the setup script failed miserably.\nPlease report to ttimo@idsoftware.com\n\"" > $TMPDIR/bin/x86/quake3 92 echo -e "#!/bin/sh\necho \"If you read this, then the setup script failed miserably.\nPlease report to ttimo@idsoftware.com\n\"" > $TMPDIR/bin/x86/quake3-smp 93 # create the auto-extractible archive 94 # first step: on FreeBSD we would default to Linux binaries .. use a symlink 95 ( 96 cd $TMPDIR/setup.data/bin 97 ln -s Linux FreeBSD 98 ln -s Linux NetBSD 99 ln -s Linux OpenBSD 100 ) 101 # NOTE: we used to pass the $VERSION, but it doesn't seem very usefull 102 ./$SETUPDIR/makeself/makeself.sh $TMPDIR linuxq3apoint-$VERSION.x86.run "Quake III Arena Point Release $VERSION " ./setup.sh 103 104 chmod a+rx linuxq3apoint-$VERSION.x86.run 105 106 #rm -rf $TMPDIR 107 } 108 109 check_brandelf() 110 { 111 # make sure brandelf is installed to avoid any problem when building the setups 112 BRAND=`which brandelf`; 113 if [ -n "$BRAND" ] && [ -x "$BRAND" ] 114 then 115 echo "brandelf is present: $BRAND" 116 else 117 echo "brandelf not found" 118 exit 119 fi 120 } 121 122 # safe checks 123 check_brandelf 124 125 build_installer