-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·98 lines (70 loc) · 1.85 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·98 lines (70 loc) · 1.85 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
#!/bin/bash
# The tag can be "master" or a full git check-in hash in lower case hex
# like for example:
#tag=dc184319be9a272ffa4528f5bb5d0902f1edbbbb
tag=0.1
url=https://raw.githubusercontent.com/lanceman2/quickbuild/$tag/quickbuild.make
# If we wanted a particular file, so we checks it's sha512 sum.
# Run:
#
# sha512sum quickbuild.make
#
# to get this long hex number
sha512sum=4bb12b01391d1c62cc7cebd0705ba2cd5409c8d4e275f4952a120\
2e0b1d442c435b2b9403eeffecbcd85e625325f2337ef60ec176840aa7f0c7a\
e5efc57f1b13
function usage()
{
cat <<EOF
Usage: $0
This bootstrap script downloads and compresses a make file
from the web via url:
$url
We call it bootstrap because you need this make file before
you can configure and make this package.
EOF
exit 1
}
[ "$1" = "--help" ] && usage
[ "$1" = "-h" ] && usage
set -ex
# Go to the directory there this script is.
cd $(dirname ${BASH_SOURCE[0]})
if [ -z "$*" ] && [ -e quickbuild.make ] ; then
set +x
cat <<EOF
The file quickbuild.make exists.
If you wish to regenerate it remove it first.
Or run
$0 -f
EOF
exit 1
fi
set -e
cat <<EOF > quickbuild.make.tmp
# This is a generated file
#
# You can get the uncompressed and better commented original version
# of this file from:
#
# $url
#
EOF
# get the quickbuild.make file from the web
wget --no-check-certificate $url -O quickbuild.make.org
if [ -n "$sha512sum" ] ; then
set +x
# We wanted a particular file, so we checks it's sha512 sum.
echo "$sha512sum quickbuild.make.org" | sha512sum -c
set -x
else
set +x
echo "The sha512sum of the downloaded file, before compressing it:"
set -x
sha512sum quickbuild.make.org
fi
sed quickbuild.make.org -e 's/^\s*\#.*$//g' -e '/^$/d' >> quickbuild.make.tmp
rm quickbuild.make.org
mv quickbuild.make.tmp quickbuild.make
set +x
echo "SUCCESS"