-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeloki.sh
185 lines (152 loc) · 6.89 KB
/
makeloki.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/sh
#83;40003;0c Make a Loki Install Binary for Vegastrike
#
#
# Instructions:
#
# Copy the loki_setup/ folder in the same directory as copies of your data dir, music dir, vssetup and vegastrike.
# Note: this script will move the the data and music dirs, not copy...so don't use your cvs masters :-)
# Have the relevant binaries compiled statically.
#
# Now we have to edit this file, and the files setup.base.xml and setup.music.xml
#
# To edit this script:
# + First change OLDVERSIONTEXT to the name of the current home directory, and
# NEWVERSIONTEXT to the intended name...both sans the '.'
# + Then change the DATAMODULE and MUSICMODULE names.
# + If you use SVN, you'll have to edit this script to clean that out.
# + And you are done, do and edit the xml files.
#
# The xml files are easy to do:
# + Change the product name, description, and version attributes in each.
# + Change the version of the Base component in setup.base.xml
# + You will then want to change the references to Vegastrike in the text in
# the Option tag and the Help tag in the Base component.
# + And then, for the binary bin/vegastrike.sh, you will want to change the
# symlink and name attributes.
# + Then you need to change the name of the hidden file
# from .vegastrike.4.x to whatever your Version.txt will read.
# + Before adding/removing any files or directories.
#
# Run this script once with the 'prepare' argument to make sure all the binaries needed are there.
# Run this script with the 'release' argument.
# ie: sh makeloki.sh prepare
# sh makeloki.sh release
#
# Change these to use for a different mod
#
# \/ \/ \/ \/ \/ \/ \/ \/ \/
OLDVERSIONTEXT="privgold100" # The hidden folder in the data dir, with the m3us
NEWVERSIONTEXT="privgold100" # What you want the hidden folder to be called
DATAMODULE="privateer" # The folder with the data in it
MUSICMODULE="xmusic" # The folder with the (high quality) music
DESTRUCTIVE=0 # Move music/binaries/data ... or just copy
REPOSITORY=".svn" # Either CVS or .svn
CLEANREPOSITORY=0 # Strip this info from the folders?
# /\ /\ /\ /\ /\ /\ /\ /\ /\
#
# Don't touch anything below here, unless you know what you are doing :-)
ARG=$1
SETUPARG=${ARG:="noarg"}
CURPWD=$PWD
BASEDIR=$CURPWD/../vegastrike-base
MUSICDIR=$CURPWD/../vegastrike-music
# Verify that the required binaries are built or in the relevant place.
if [ $SETUPARG = "prepare" ] || [ $SETUPARG = "release" ]; then
for BINFILE in $CURPWD/../vegastrike/privgold $CURPWD/../vegastrike/privserver $CURPWD/../vegastrike/soundserver $CURPWD/../vegastrike/privsetup $CURPWD/vsinstall.sh $CURPWD/privateer.sh ; do
{
if [ \! -s $BINFILE ]; then
echo Binary $BINFILE not built.
break
fi
} ; done
# Copy the required setup files.
mkdir -p $BASEDIR
mkdir -p $MUSICDIR
cp -r $CURPWD/../loki_setup/image/* $BASEDIR/
cp -r $CURPWD/../loki_setup/image/* $MUSICDIR/
fi
# Or copy the binaries and data to the package dir.
if [ $SETUPARG = "organise" ] || [ $SETUPARG = "release" ]; then
if [ $CLEANREPOSITORY = 1 -a $DESTRUCTIVE = 1 ] ; then
# First remove unwanted/conflicting files
echo "Cleaning Data"
find $CURPWD/../$DATAMODULE -type d -name $REPOSITORY -exec /bin/rm -rf {} \; #Removes repository dirs
echo "Cleaning Music"
find $CURPWD/../$MUSICMODULE -type d -name $REPOSITORY -exec /bin/rm -rf {} \; #Removes repository dirs
# find $CURPWD/../$DATAMODULE -name *.xmesh -exec /bin/rm -rf {} \; #Removes xmesh files
fi
echo "Cleaning Base Package"
find $BASEDIR -type d -name .svn -exec /bin/rm -r {} \; #Removes CVS dirs
echo "Cleaning Music Package"
find $MUSICDIR -type d -name .svn -exec /bin/rm -r {} \; #Removes CVS dirs
mkdir -p $BASEDIR/.$NEWVERSIONTEXT
if [ $DESTRUCTIVE = 1 ] ; then
# Move the vegastrike data, but not this script!
# mv $CURPWD/../$DATAMODULE/m3uloki_add.sh $MUSICDIR/setup.data/
# mv $CURPWD/../$DATAMODULE/m3uloki_remove.sh $MUSICDIR/setup.data/
mv $CURPWD/../$DATAMODULE/* $BASEDIR/
mv $BASEDIR/makeloki.sh $CURPWD/
mv $CURPWD/../$DATAMODULE/.$OLDVERSIONTEXT/*.m3u $BASEDIR/.$NEWVERSIONTEXT/
else
# Copy the vegastrike data
# cp $CURPWD/../$DATAMODULE/m3uloki_add.sh $MUSICDIR/setup.data/
# cp $CURPWD/../$DATAMODULE/m3uloki_remove.sh $MUSICDIR/setup.data/
cp -r $CURPWD/../$DATAMODULE/* $BASEDIR/
cp $CURPWD/../$DATAMODULE/.$OLDVERSIONTEXT/*.m3u $BASEDIR/.$NEWVERSIONTEXT/
fi
# Update Version.txt
echo '.'$NEWVERSIONTEXT > $BASEDIR/Version.txt
# Get rid of windows binaries -- not optional!
rm -rf $CURPWD/../$DATAMODULE/bin/* #Removes windows binaries
rmdir $CURPWD/../$DATAMODULE/bin
if [ $DESTRUCTIVE = 1 ] ; then
# Move the vegastrike music
mv $CURPWD/../$MUSICMODULE $MUSICDIR/
else
mkdir -p $MUSICDIR/music
cp -r $CURPWD/../$MUSICMODULE/* $CURPWD/../$MUSICMODULE/.[^.]* $MUSICDIR/music/
fi
# If there is a hidden file with new m3us in it, move it up a level
if [ -d $MUSICDIR/music/.$OLDVERSIONTEXT ]; then
mv $MUSICDIR/music/.$OLDVERSIONTEXT $MUSICDIR/.$NEWVERSIONTEXT
elif [ -d $MUSICDIR/music/.$NEWVERSIONTEXT ]; then
mv $MUSICDIR/music/.$NEWVERSIONTEXT $MUSICDIR/
fi
# If there are sounds, ie music becomes a speech and music pack
if [ -d $MUSICDIR/music/sounds ]; then
mv $MUSICDIR/music/sounds $MUSICDIR/
fi
# Copy the vegastrike binaries
mkdir -p $BASEDIR/bin
for BINFILE in $CURPWD/../vegastrike/privgold $CURPWD/../vegastrike/privserver $CURPWD/../vegastrike/soundserver $CURPWD/../vegastrike/privsetup $CURPWD/vsinstall.sh $CURPWD/privateer.sh ; do
if [ $DESTRUCTIVE = 1 ] ; then
mv $BINFILE $BASEDIR/bin/
else
cp $BINFILE $BASEDIR/bin
fi ; done
mv $BASEDIR/bin/vssetup $BASEDIR/bin/setup
#cant call it that in source directory cus there is a dir by that name
# Move the required files to their expected positions for Base
mv $BASEDIR/setup.base.xml $BASEDIR/setup.data/setup.xml
mv $BASEDIR/vslogo.xpm $BASEDIR/setup.data/splash.xpm
cp $CURPWD/../vegastrike/COPYING $BASEDIR/
# Move the required files to their expected positions for Music
mv $BASEDIR/setup.music.xml $MUSICDIR/setup.data/setup.xml
cp $BASEDIR/setup.data/splash.xpm $MUSICDIR/setup.data/splash.xpm
if [ $CLEANREPOSITORY = 1 -a $DESTRUCTIVE = 0 ] ; then
echo "Cleaning Base Package"
find $BASEDIR -type d -name $REPOSITORY -exec /bin/rm -rf {} \; #Removes repository dirs
echo "Cleaning Music Package"
find $MUSICDIR -type d -name $REPOSITORY -exec /bin/rm -rf {} \; #Removes repository dirs
fi
fi
if [ $SETUPARG = "package" ] || [ $SETUPARG = "release" ]; then
# Create the packages
cd $CURPWD/../loki_setup/makeself/
echo "Making the Base Installer"
sh makeself.sh --bzip2 $BASEDIR $CURPWD/../privgold-1.0.3.run.bz2.sh "Privateer Gemini Gold 1.03 - Base" sh setup.sh
echo "Making the Music Installer"
sh makeself.sh --bzip2 $MUSICDIR $CURPWD/../privgold-music.run.bz2.sh "Privateer Gemini Gold 1.03 - Music" sh setup.sh
cd $CURPWD
fi