#!/bin/bash # $Header: /root/magellan-cvs/src/freespace2/fs2-open-installer.sh,v 1.1 2007-01-15 22:29:01 niro Exp $ # Freespace2 retail files installer die() { echo "Error: $@" exit 1 } DATADIR=/usr/games/freespace2 CDROM="$1" [[ $(id -u) != 0 ]] && die "You must be root!" [[ -f ${DATADIR}/.installed ]] && die "Media files already installed." [[ -z $(which unshield) ]] && die "unshield not found." [[ -z $(which mktemp) ]] && die "mktemp not found." [[ -z $(which eject) ]] && die "eject not found." #[[ -z $(which dialog) ]] && die "dialog not found." [[ -z ${CDROM} ]] && "No cdrom device given." TMP="$(mktemp -d)" # some needed directories install -d ${TMP}/cdrom install -d ${TMP}/data install -d ${TMP}/retailvp echo "To setup Freespace2 I need to copy several files from the original CDs." echo #### disc1 #### echo "Please insert Disc1 of Freespace2 into your cdrom and press enter" read mount ${CDROM} ${TMP}/cdrom || die "mount disc1" [[ ! -f ${TMP}/cdrom/data1.cab ]] && "Disc1 not found" echo "Copying data1.cab and data1.hdr to ${TMP}/data" cp ${TMP}/cdrom/data1.{cab,hdr} ${TMP}/data || die "copying data1.cab/hdr" umount ${TMP}/cdrom || die "umount disc1 failed" eject ${CDROM} #### disc2 #### echo echo "Please insert Disc2 of Freespace2 into your cdrom and press enter" read mount ${CDROM} ${TMP}/cdrom || die "mount disc2" [[ ! -f ${TMP}/cdrom/data2.cab ]] && "Disc2 not found" for i in tango1_fs2.vp COLOSSUS.MVE INTRO.MVE MONO1.MVE do echo "Copying ${i} to ${TMP}/data" # lower case needed! cp ${i} ${TMP}/data/$(echo $i | tr [:upper:] [:lower:]) || die "copying ${i}" done umount ${TMP}/cdrom || die "umount disc2 failed" eject ${CDROM} #### disc3 #### echo echo "Please insert Disc3 of Freespace2 into your cdrom and press enter" read mount ${CDROM} ${TMP}/cdrom || die "mount disc3" [[ ! -f ${TMP}/cdrom/data3.cab ]] && "Disc3 not found" for i in tango2_fs2.vp tango3_fs2.vp BASTION.MVE ENDPART1.MVE \ ENDPRT2A.MVE ENDPRT2B.MVE MONO2.MVE MONO3.MVE MONO4.MVE do echo "Copying ${i} to ${TMP}/data" # lower case needed! cp ${i} ${TMP}/data/$(echo $i | tr [:upper:] [:lower:]) || die "copying ${i}" done umount ${TMP}/cdrom || die "umount disc3 failed" eject ${CDROM} echo echo "Now extracting files from retail version ..." for group in "Basic Install Files" \ "Intel Anims" \ "Music Compressed" \ "High Res Files" do unshield -d ${TMP}/retailvp -g "$group" -L -j x data1.cab || die "unpacking ${group}" done unshield -d ${TMP} -g "Hud Config Files" -L -j x data1.cab || die "unpacking ${group}" echo "Installing Retail Freespace2 files to the system ..." install -m0644 ${TMP}/hud_config_files/* ${DATADIR}/data/players || die "installing HUD" install -m0644 ${TMP}/retailvp/*/* ${DATADIR}/data/players || die "installing retailvps1" install -m0644 ${TMP}/data/*.vp ${DATADIR} || die "installing retailvps2" install -m0644 ${TMP}/data/*.mve ${DATADIR}/data/movies || die "installing movies" # mark installation as "installed" touch ${DATADIR}/.installed echo "Cleaning up temp dirs ..." [[ -d ${TMP} ]] && rm -rf ${TMP} echo "Installation of Freespace2 successfully finished!"