-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakesite
executable file
·209 lines (174 loc) · 5.57 KB
/
makesite
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
# Written by M. De Graef; 10/11/18
# Project Funding: NSF DMR-1564550
#
# This script is Mac OS X specific... but might work on Linux with minor modifications
#
# This script is the top level script for building all the Magnetic Point Group web site files
# It should be called simply as follows:
#
# ./makesite
#
# All options should be set in the WebSiteParameters file before running this script.
# To edit this file, first copy it from the WebSiteParameters.template file, and then edit the
# parameters for your site.
echo ""
date
echo ""
echo "Please note that the web files generated by this script will need to be accessed via a properly"
echo "installed web server. The files use a number of scripts that will cause javascript security issues "
echo "when the index.html file is opened directly in a browser... the dropdown menus will almost certainly"
echo "not work correctly when opening the file from your local drive. They only work when served via a "
echo "web server."
echo ""
# -------------------------------------------------------
# read the web site parameter(s)
WEB_FILE="WebSiteParameters"
if [ -f $WEB_FILE ]; then
. $WEB_FILE
else
echo "$WEB_FILE not found; exiting"
exit
fi
# -------------------------------------------------------
# read the rendering parameters; needed to set the image/movie sizes
# in the various template files
RENDER_FILE="RenderParameters"
if [ -f $RENDER_FILE ]; then
. $RENDER_FILE
else
echo "$RENDER_FILE not found; exiting"
exit
fi
CURDIR=`pwd`
# do we need to create the WEBSITE_FOLDER?
if [ -e "$WEBSITE_FOLDER" ]
then
echo "$WEBSITE_FOLDER already exists"
else
mkdir $WEBSITE_FOLDER
fi
# define the subfolders and then create them
HTML_FOLDER=$WEBSITE_FOLDER/html
STILLS_FOLDER=$WEBSITE_FOLDER/stills
MOVIES_FOLDER=$WEBSITE_FOLDER/movies
ARCHIVE_FOLDER=$WEBSITE_FOLDER/mpgarchive
mkdir $HTML_FOLDER
mkdir $STILLS_FOLDER
mkdir $MOVIES_FOLDER
mkdir $ARCHIVE_FOLDER
cd htmlgen
# place the main index.html file
echo "Generating $WEBSITE_FOLDER/index.html"
cp index.html "$WEBSITE_FOLDER"/index.html
# place the intro.html file
echo "Generating $HTML_FOLDER/intro.html"
cp intro.html "$HTML_FOLDER"/intro.html
# place the contacts.html file
echo "Generating $HTML_FOLDER/contacts.html"
cp contacts.html "$HTML_FOLDER"/contacts.html
# place the archives.html file
echo "Generating $HTML_FOLDER/archives.html"
cp archives.html "$HTML_FOLDER"/archives.html
# place the FAQ.html file
echo "Generating $HTML_FOLDER/FAQ.html"
cp FAQ.html "$HTML_FOLDER"/FAQ.html
# generate the navigation dropdown menus
echo "Generating navigation dropdown menus in $WEBSITE_FOLDER/menubar.html"
./mkall >"$WEBSITE_FOLDER"/menubar.html
echo "copying the point group label png files into the pglabels folder"
unzip pglabels.zip >/dev/null
mv pglabels $WEBSITE_FOLDER
# substitute the image/movie sizes in the html template files
echo "Initializing html point group template files with correct image and movie dimensions"
cd pages
cp still_template.original still_template
HEIGHTs=$(expr 32 + ${STILL_SIZE_MONTAGE})
sed -i back "s/WIDTH/${STILL_SIZE_MONTAGE}/g" still_template
sed -i back "s/HEIGHT/${STILL_SIZE_MONTAGE}/g" still_template
sed -i back "s/HEIGHTs/${HEIGHTs}/g" still_template
sed -i back "s/HIRESW/${STILL_SIZE}/g" still_template
rm still_templateback
cp movie_template.original movie_template
sed -i back "s/\$WIDTH\$/${MOVIE_SIZE}/g" movie_template
sed -i back "s/\$HEIGHT\$/${MOVIE_SIZE}/g" movie_template
rm movie_templateback
# generate the still and movie html files for all point groups and representation modes
echo "Generating all individual stills and movie pages in $HTML_FOLDER"
./mkallpages $HTML_FOLDER
cd $CURDIR
# then extract all the archive files into the correct folders
echo "Unpacking all individual stills $STILLS_FOLDER"
cd $STILLS_FOLDER
mkdir anaglyph axial polar scalar raw pseudoscalar
echo " --> anaglyphs"
cd anaglyph
cp $BUILD_FOLDER/anaglyph.tar.gz .
gunzip anaglyph.tar.gz
tar -xf anaglyph.tar
rm *.tar
echo " --> axial"
cd ../axial
cp $BUILD_FOLDER/axial_stills.tar.gz .
gunzip axial_stills.tar.gz
tar -xf axial_stills.tar
rm *.tar
echo " --> polar"
cd ../polar
cp $BUILD_FOLDER/polar_stills.tar.gz .
gunzip polar_stills.tar.gz
tar -xf polar_stills.tar
rm *.tar
echo " --> raw"
cd ../raw
cp $BUILD_FOLDER/raw_stills.tar.gz .
gunzip raw_stills.tar.gz
tar -xf raw_stills.tar
rm *.tar
echo " --> scalar"
cd ../scalar
cp $BUILD_FOLDER/scalar_stills.tar.gz .
gunzip scalar_stills.tar.gz
tar -xf scalar_stills.tar
rm *.tar
echo " --> pseudoscalar"
cd ../pseudoscalar
cp $BUILD_FOLDER/pseudoscalar_stills.tar.gz .
gunzip pseudoscalar_stills.tar.gz
tar -xf pseudoscalar_stills.tar
rm *.tar
echo "Unpacking all individual movies $MOVIES_FOLDER"
cd $MOVIES_FOLDER
mkdir axial polar scalar pseudoscalar
echo " --> axial"
cd axial
cp $BUILD_FOLDER/axial_movies.tar.gz .
gunzip axial_movies.tar.gz
tar -xf axial_movies.tar
rm *.tar
echo " --> polar"
cd ../polar
cp $BUILD_FOLDER/polar_movies.tar.gz .
gunzip polar_movies.tar.gz
tar -xf polar_movies.tar
rm *.tar
echo " --> scalar"
cd ../scalar
cp $BUILD_FOLDER/scalar_movies.tar.gz .
gunzip scalar_movies.tar.gz
tar -xf scalar_movies.tar
rm *.tar
echo " --> pseudoscalar"
cd ../pseudoscalar
cp $BUILD_FOLDER/pseudoscalar_movies.tar.gz .
gunzip pseudoscalar_movies.tar.gz
tar -xf pseudoscalar_movies.tar
rm *.tar
cd $CURDIR
# finally, place all the tar.gz files in the correct folder
echo "Copying archive tar.gz files to mpgarchive folder"
cp $BUILD_FOLDER/*.tar.gz $ARCHIVE_FOLDER
echo "- - - - - - - - - - - - - - - - - - - - - - - - - "
echo "All is well that ends well ..."
date
exit