Annotation of /trunk/freespace2/fs2-open-installer.sh
Parent Directory | Revision Log
Revision 94 -
(hide annotations)
(download)
(as text)
Mon Jan 15 22:29:02 2007 UTC (17 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 3143 byte(s)
Mon Jan 15 22:29:02 2007 UTC (17 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 3143 byte(s)
new files
1 | niro | 94 | #!/bin/bash |
2 | # $Header: /root/magellan-cvs/src/freespace2/fs2-open-installer.sh,v 1.1 2007-01-15 22:29:01 niro Exp $ | ||
3 | # Freespace2 retail files installer | ||
4 | |||
5 | die() | ||
6 | { | ||
7 | echo "Error: $@" | ||
8 | exit 1 | ||
9 | } | ||
10 | |||
11 | DATADIR=/usr/games/freespace2 | ||
12 | CDROM="$1" | ||
13 | |||
14 | [[ $(id -u) != 0 ]] && die "You must be root!" | ||
15 | [[ -f ${DATADIR}/.installed ]] && die "Media files already installed." | ||
16 | [[ -z $(which unshield) ]] && die "unshield not found." | ||
17 | [[ -z $(which mktemp) ]] && die "mktemp not found." | ||
18 | [[ -z $(which eject) ]] && die "eject not found." | ||
19 | #[[ -z $(which dialog) ]] && die "dialog not found." | ||
20 | [[ -z ${CDROM} ]] && "No cdrom device given." | ||
21 | |||
22 | TMP="$(mktemp -d)" | ||
23 | |||
24 | # some needed directories | ||
25 | install -d ${TMP}/cdrom | ||
26 | install -d ${TMP}/data | ||
27 | install -d ${TMP}/retailvp | ||
28 | |||
29 | echo "To setup Freespace2 I need to copy several files from the original CDs." | ||
30 | echo | ||
31 | |||
32 | #### disc1 #### | ||
33 | echo "Please insert Disc1 of Freespace2 into your cdrom and press enter" | ||
34 | read | ||
35 | |||
36 | mount ${CDROM} ${TMP}/cdrom || die "mount disc1" | ||
37 | [[ ! -f ${TMP}/cdrom/data1.cab ]] && "Disc1 not found" | ||
38 | |||
39 | echo "Copying data1.cab and data1.hdr to ${TMP}/data" | ||
40 | cp ${TMP}/cdrom/data1.{cab,hdr} ${TMP}/data || die "copying data1.cab/hdr" | ||
41 | umount ${TMP}/cdrom || die "umount disc1 failed" | ||
42 | eject ${CDROM} | ||
43 | |||
44 | |||
45 | #### disc2 #### | ||
46 | echo | ||
47 | echo "Please insert Disc2 of Freespace2 into your cdrom and press enter" | ||
48 | read | ||
49 | |||
50 | mount ${CDROM} ${TMP}/cdrom || die "mount disc2" | ||
51 | [[ ! -f ${TMP}/cdrom/data2.cab ]] && "Disc2 not found" | ||
52 | |||
53 | for i in tango1_fs2.vp COLOSSUS.MVE INTRO.MVE MONO1.MVE | ||
54 | do | ||
55 | echo "Copying ${i} to ${TMP}/data" | ||
56 | # lower case needed! | ||
57 | cp ${i} ${TMP}/data/$(echo $i | tr [:upper:] [:lower:]) || die "copying ${i}" | ||
58 | done | ||
59 | umount ${TMP}/cdrom || die "umount disc2 failed" | ||
60 | eject ${CDROM} | ||
61 | |||
62 | |||
63 | #### disc3 #### | ||
64 | echo | ||
65 | echo "Please insert Disc3 of Freespace2 into your cdrom and press enter" | ||
66 | read | ||
67 | |||
68 | mount ${CDROM} ${TMP}/cdrom || die "mount disc3" | ||
69 | [[ ! -f ${TMP}/cdrom/data3.cab ]] && "Disc3 not found" | ||
70 | |||
71 | |||
72 | for i in tango2_fs2.vp tango3_fs2.vp BASTION.MVE ENDPART1.MVE \ | ||
73 | ENDPRT2A.MVE ENDPRT2B.MVE MONO2.MVE MONO3.MVE MONO4.MVE | ||
74 | do | ||
75 | echo "Copying ${i} to ${TMP}/data" | ||
76 | # lower case needed! | ||
77 | cp ${i} ${TMP}/data/$(echo $i | tr [:upper:] [:lower:]) || die "copying ${i}" | ||
78 | done | ||
79 | umount ${TMP}/cdrom || die "umount disc3 failed" | ||
80 | eject ${CDROM} | ||
81 | |||
82 | |||
83 | echo | ||
84 | echo "Now extracting files from retail version ..." | ||
85 | |||
86 | for group in "Basic Install Files" \ | ||
87 | "Intel Anims" \ | ||
88 | "Music Compressed" \ | ||
89 | "High Res Files" | ||
90 | do | ||
91 | unshield -d ${TMP}/retailvp -g "$group" -L -j x data1.cab || die "unpacking ${group}" | ||
92 | done | ||
93 | unshield -d ${TMP} -g "Hud Config Files" -L -j x data1.cab || die "unpacking ${group}" | ||
94 | |||
95 | |||
96 | echo "Installing Retail Freespace2 files to the system ..." | ||
97 | install -m0644 ${TMP}/hud_config_files/* ${DATADIR}/data/players || die "installing HUD" | ||
98 | install -m0644 ${TMP}/retailvp/*/* ${DATADIR}/data/players || die "installing retailvps1" | ||
99 | install -m0644 ${TMP}/data/*.vp ${DATADIR} || die "installing retailvps2" | ||
100 | install -m0644 ${TMP}/data/*.mve ${DATADIR}/data/movies || die "installing movies" | ||
101 | |||
102 | # mark installation as "installed" | ||
103 | touch ${DATADIR}/.installed | ||
104 | |||
105 | echo "Cleaning up temp dirs ..." | ||
106 | [[ -d ${TMP} ]] && rm -rf ${TMP} | ||
107 | |||
108 | echo "Installation of Freespace2 successfully finished!" |