-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·192 lines (162 loc) · 5.7 KB
/
install.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
186
187
188
189
190
191
192
#!/bin/sh
HEADER_STR="Installation of Mizar System Version 7.13.01 (Linux/FPC) (MML 4.181.1147)"
LDIR=`pwd`
INSTALL_BIN='/usr/local/bin'
INSTALL_DOC='/usr/local/doc/mizar'
INSTALL_MIZ='/usr/local/share/mizar'
INSTALL_TEMP=/tmp/mizar-install-`date +$y%m%d%H%M%S`
exit_install()
{
echo "Installation aborted"
echo "$1"
if [ -f "$INSTALL_TEMP" ]; then rm "$INSTALL_TEMP"; fi
exit 1
}
start_install()
{
dialog \
--title Executables \
--inputbox "Enter the path for installing Mizar executables" 10 60 "$INSTALL_BIN" 2> "$INSTALL_TEMP"
if [ ! -s "$INSTALL_TEMP" ]; then exit_install; fi
read INSTALL_BIN < "$INSTALL_TEMP"
if [ ! -d "$INSTALL_BIN" ]; then
mkdir -p "$INSTALL_BIN" || exit_install "Unable to create directory $INSTALL_BIN"
chmod a+r "$INSTALL_BIN"
fi
cd "$INSTALL_BIN"
gzip -c -d "$LDIR"/mizbin.tar.gz | tar -xf - || exit_install "Error while unpacking to $INSTALL_BIN"
cd "$LDIR"
dialog \
--title "Shared files" \
--inputbox "Enter the path for installing Mizar shared files" 10 60 "$INSTALL_MIZ" 2> "$INSTALL_TEMP"
if [ ! -s "$INSTALL_TEMP" ]; then exit_install; fi
read INSTALL_MIZ < "$INSTALL_TEMP"
if [ ! -d "$INSTALL_MIZ" ]
then
mkdir -p "$INSTALL_MIZ" || exit_install "Unable to create directory $INSTALL_MIZ"
chmod a+r "$INSTALL_MIZ"
else
rm -r -f "$INSTALL_MIZ"/prel/* || exit_install "Unable to clear directory $INSTALL_MIZ/prel"
rm -f "$INSTALL_MIZ"/abstr/* || exit_install "Unable to clear directory $INSTALL_MIZ/abstr"
rm -f "$INSTALL_MIZ"/mml/* || exit_install "Unable to clear directory $INSTALL_MIZ/mml"
fi
dialog \
--title "Shared files installation" \
--infobox "It may take some time..." 3 60
cd "$INSTALL_MIZ"
gzip -c -d "$LDIR"/mizshare.tar.gz | tar -xf - || exit_install "Error while unpacking to $INSTALL_MIZ"
cd $LDIR
dialog \
--title "Mizar documentation" \
--inputbox "Enter the path for installing Mizar documentation" 10 60 $INSTALL_DOC 2> $INSTALL_TEMP
if [ ! -s "$INSTALL_TEMP" ]; then exit_install; fi
read INSTALL_DOC < "$INSTALL_TEMP"
if [ ! -d "$INSTALL_DOC" ]
then
mkdir -p "$INSTALL_DOC" || exit_install "Unable to create directory $INSTALL_DOC"
chmod a+r "$INSTALL_DOC"
fi
cd "$INSTALL_DOC"
gzip -c -d "$LDIR"/mizdoc.tar.gz | tar -xf - || exit_install "Error while unpacking to $INSTALL_DOC"
cd "$LDIR"
dialog \
--title "Installation completed" \
--clear \
--msgbox \
"\nThe installation process of the Mizar system is completed.\n\n\
Note:\n\n\
The Mizar system requires a variable MIZFILES\n\
which should be set to $INSTALL_MIZ.\n\n\
If $INSTALL_BIN is not in your PATH \n\n\
please add it before running Mizar.\n\n\
With questions or comments contact [email protected]" 20 80 ;
rm "$INSTALL_TEMP"
}
start_old_install()
{
echo " "
echo "$HEADER_STR"
echo " "
echo "Enter the path for installing Mizar executables"
echo "[default is $INSTALL_BIN]"
if [ "$DEFAULT" != "yes" ]; then
read ANS
if [ "$ANS" != "" ]; then INSTALL_BIN="$ANS"; fi
fi
echo "Unpacking to $INSTALL_BIN"
echo " "
if [ ! -d "$INSTALL_BIN" ]; then
mkdir -p "$INSTALL_BIN" || exit_install "Unable to create directory $INSTALL_BIN"
chmod a+r "$INSTALL_BIN"
fi
cd "$INSTALL_BIN"
gzip -c -d "$LDIR"/mizbin.tar.gz | tar -xf - || exit_install "Error while unpacking to $INSTALL_BIN"
cd "$LDIR"
echo "Enter the path for installing Mizar shared files"
echo "[default is $INSTALL_MIZ]"
if [ "$DEFAULT" != "yes" ]; then
read ANS
if [ "$ANS" != "" ]; then INSTALL_MIZ="$ANS"; fi
fi
echo "Unpacking to $INSTALL_MIZ"
echo " "
if [ ! -d "$INSTALL_MIZ" ]
then
mkdir -p "$INSTALL_MIZ" || exit_install "Unable to create directory $INSTALL_MIZ"
chmod a+r "$INSTALL_MIZ"
else
rm -r -f "$INSTALL_MIZ"/prel/* || exit_install "Unable to clear directory $INSTALL_MIZ/prel"
rm -f "$INSTALL_MIZ"/abstr/* || exit_install "Unable to clear directory $INSTALL_MIZ/abstr"
rm -f "$INSTALL_MIZ"/mml/* || exit_install "Unable to clear directory $INSTALL_MIZ/mml"
fi
echo "It may take some time..."
echo " "
cd "$INSTALL_MIZ"
gzip -c -d "$LDIR"/mizshare.tar.gz | tar -xf - || exit_install "Error while unpacking to $INSTALL_MIZ"
cd "$LDIR"
echo "Enter the path for installing Mizar documentation"
echo "[default is $INSTALL_DOC]"
if [ "$DEFAULT" != "yes" ]; then
read ANS
if [ "$ANS" != "" ]; then INSTALL_DOC="$ANS"; fi
fi
echo "Unpacking to $INSTALL_DOC"
echo " "
if [ ! -d "$INSTALL_DOC" ]
then
mkdir -p "$INSTALL_DOC" || exit_install "Unable to create directory $INSTALL_DOC"
chmod a+r "$INSTALL_DOC"
fi
cd "$INSTALL_DOC"
gzip -c -d "$LDIR"/mizdoc.tar.gz | tar -xf - || exit_install "Error while unpacking to $INSTALL_DOC"
cd "$LDIR"
echo "The installation process of the Mizar system is completed."
echo " "
echo "Note:"
echo "The Mizar system requires a variable MIZFILES"
echo "which should be set to $INSTALL_MIZ."
echo " "
echo "If $INSTALL_BIN is not in your PATH please add it before running Mizar."
echo " "
echo "With questions or comments contact [email protected]"
}
######################## Proper installation #######################
case $1 in
'--default') DEFAULT="yes"; start_old_install; exit ;;
'--nodialog') start_old_install; exit ;;
*)
dialog > /dev/null 2>&1
if [ "$?" != 0 -a ! -x /usr/bin/dialog ]; then start_old_install; else
dialog \
--title Info \
--textbox README 20 70
dialog \
--title Start \
--yesno "Start the installation ?" 6 30
case $? in
0) start_install ;;
*) exit_install ;;
esac;
fi
;;
esac