-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·229 lines (214 loc) · 7.03 KB
/
bootstrap
File metadata and controls
executable file
·229 lines (214 loc) · 7.03 KB
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/bin/bash
# Copyright 2013-2015 - Peter Maersk-Moller
if [ "X$BASH" != X ] ; then
echo="echo -e"
else
echo=echo
fi
os=`uname`
osvariant=""
lsbvariant=""
osversion=""
bootstrapdir=bootstrapd
bootstrapvariant=""
LIBTOOLIZE=libtoolize
echo "If you are missing any software packages, you need access to the sudo command"
echo "for this script to be able to fetch them and install them. If you do not have"
echo "access to sudo or do not want to grant this script access through your passwd"
echo "this script will fail. However if all packages are installed, then sudo access"
echo "is not needed. Do you want to check if you have sudo access by providing"
$echo "your password to sudo (Y/N)? \c"
read reply
if [ "$reply" = Y -o "$reply" = y ] ; then
echo "Checking for sudo access. You may be promted for password"
sudo -v
if [ $? != 0 ] ; then
echo "You do not have access to run the sudo command."
echo "You will need sudo access to install packages if needed."
echo "You can get access to sudo by adding your username to the sudo group in the /etc/group file. Then log out and in again."
echo "You do not need access to sudo if all packages are installed."
$echo "Press return to continue \c"
read reply
else
echo "You have access to run sudo."
fi
else
echo "Skipping test for sudo access."
fi
if [ "$os" = "Linux" ] ; then
if [ -f /etc/os-release ] ; then
osvariant=`grep '^ID=' /etc/os-release | cut -f2 -d= | tr 'A-Z' 'a-z'`
# VERSION_ID="16.04"
osversion=`grep '^VERSION_ID=' /etc/os-release | cut -f2 -d= | sed 's/\"//g'`
else
if [ -f /etc/lsb-release ] ; then
osvariant=`grep '^DISTRIB_DESCRIPTION=' /etc/lsb-release | cut -f2 -d= | cut -f1 -d' ' | tr 'A-Z' 'a-z' | sed 's/\"//g'`
fi
fi
#/etc/lsb-release:DISTRIB_DESCRIPTION="Linaro 12.11"
if [ -f /etc/lsb-release ] ; then
lsbvariant=-`grep '^DISTRIB_ID=' /etc/lsb-release | cut -f2 -d= | tr 'A-Z' 'a-z'`
fi
fi
#echo "osvariant : $osvariant"
#echo "lsbvariant : $lsbvariant"
echo "$os-$osvariant$lsbvariant os_version $osversion"
prefix=/usr/local
variant=""
case "$os-$osvariant$lsbvariant" in
*-linuxmint)
echo "This is Linux Mint Ubuntu variant"
bootstrapvariant=$bootstrapdir/bootstrap-ubuntu
variant=mint
;;
Linux-linaro-ubuntu)
echo "This is Linux Linaro Ubuntu variant"
bootstrapvariant=$bootstrapdir/bootstrap-ubuntu
variant=linaro
;;
Linux-ubuntu | Linux-ubuntu-ubuntu)
echo "This is Ubuntu Linux"
bootstrapvariant=$bootstrapdir/bootstrap-ubuntu
variant=ubuntu
;;
Linux-debian | Linux-debian-ubuntu | Linux-raspbian )
echo "This is Debian Linux"
bootstrapvariant=$bootstrapdir/bootstrap-debian
;;
Linux-*opensuse*)
echo "This is OpenSUSE Linux"
bootstrapvariant=$bootstrapdir/bootstrap-opensuse
;;
Linux-*centos*)
echo "This is CentOS Linux, a Fedora variant"
bootstrapvariant=$bootstrapdir/bootstrap-centos
;;
Linux-*fedora*)
echo "This is Fedora Linux"
bootstrapvariant=$bootstrapdir/bootstrap-fedora
;;
Linux-*mageia*)
echo "This is Mageia Linux"
bootstrapvariant=$bootstrapdir/bootstrap-mageia
;;
Linux-manjaro* )
echo "This is Manjaro Linux, an Arch a variant"
bootstrapvariant=$bootstrapdir/bootstrap-arch
;;
Linux-arch* | Linux-chakra*)
echo "This is Chakra Linux, an Arch a variant"
bootstrapvariant=$bootstrapdir/bootstrap-arch
;;
Darwin*)
echo "This is Darwin (OS X)"
bootstrapvariant=$bootstrapdir/bootstrap-OSX
LIBTOOLIZE=glibtoolize
export PATH=/opt/local/bin:$PATH
export CPPFLAGS="-I/opt/local/include $CPPFLAGS"
export LDFLAGS="-L/opt/local/lib $LDFLAGS"
prefix=/opt/local
;;
FreeBSD*)
echo "This is a FreeBSD or FreeBSD variant"
export CPPFLAGS="-I/usr/local/include $CPPFLAGS"
export LDFLAGS="-L/usr/local/lib $LDFLAGS"
bootstrapvariant=$bootstrapdir/bootstrap-freebsd
;;
*)
echo "Unsupported OS. $os-$osvariant$lsbvariant Selecting a generic bootstrap"
bootstrapvariant=$bootstrapdir/bootstrap-generic
if [ $? != 0 ] ; then exit ; fi
;;
esac
$echo "Press return to execute $bootstrapvariant \c"
read reply
which bash 1>/dev/null 2>&1
if [ $? = 0 ] ; then
bash ./$bootstrapvariant $variant
else
sh ./$bootstrapvariant $variant
fi
if [ $? != 0 ] ; then exit ; fi
# Check for build essentials
echo
echo "Checking for build essentials."
for prog in aclocal autoconf $LIBTOOLIZE automake make awk bc head pkg-config nc; do
which $prog >/dev/null 2>&1
if [ X$? != X0 ]
then
echo
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ERROR <<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
echo ' ERROR : '$prog' not found. Please install the application and rerun the the bootstrap script.'
exit 1
else
echo " found $prog"
fi
done
# Generating configure and makefiles
echo
echo "Generating configure and makefiles. Please stand by"
if [ ! -d m4 ] ; then mkdir m4 ; fi
echo " aclocal"
aclocal
echo " autoconf"
autoconf
echo " $LIBTOOLIZE --force"
$LIBTOOLIZE --force
echo " automake --add-missing"
automake --add-missing
if [ -s VERSION ] ; then
head -1 VERSION | awk '{ printf("#define SNOWMIX_VERSION \"%s\"\n", $0);}' >src/version.h
version=`head -1 VERSION`
fi
echo
if [ -f ./configure ] ; then
echo "Running ./configure --prefix=$prefix to setup compilation environment"
./configure --prefix=$prefix --libdir=$prefix/lib
if [ $? != 0 ] ; then
echo 'Running ./configure failed. This needs to be resolved'
exit 1
else
echo "Configure was run with --prefx=$prefix"
echo 'You can rerun ./configure --prefix=YOUR_INSTALLATION_DIR if you need to change the installation path for Snowmix'
echo
fi
else
echo 'Could not find ./configure'
echo 'This needs to be resolved before you can compile Snowmix'
exit 1
fi
echo "You can revert the bootstrap script by executing the command './strapboot'"
installdir=`grep '^prefix = ' Makefile | awk '{ print $3 }'`
echo
echo ">>>>>>>>>> PLEASE NOTE <<<<<<<<<<<<"
echo "By default the Snowmix will be installed in $installdir. If you want to"
echo "change this, please run ./configure --prefix=YOUR_CHOICE"
echo
echo "If Snowmix is installed into $installdir you need to set the enviroment"
echo "variable SNOWMIX to $installdir/lib/Snowmix-$version"
echo
echo "Consider adding the following to your ~/.bashrc or ~/.bash_profile"
echo
echo " export SNOWMIX=$installdir/lib/Snowmix-$version"
echo
echo "Then after finishing this script, logout and login again to continue"
echo
$echo "Press return to continue \c"
read reply
echo
echo "Now you can compile Snowmix and install snowmix using the following commands:"
echo
echo " make"
echo " sudo make install"
echo
echo "After that, you can run Snowmix by executing the command"
echo
echo " snowmix ini/YOUR_INI_FILE"
echo
echo "Or you can run the demo by executing the command 'snowmix_demo'"
echo
echo "For questions and help, please use the discussion forum at http://sourceforge.net/projects/snowmix/"
echo "where you in the Wiki also can find a lot of documentation, examples and help."
echo "See also website http://snowmix.sourceforge.net/ for ressources and documentation"
echo
exit 0