author | wenzelm |
Tue, 02 Aug 2016 11:49:30 +0200 | |
changeset 63578 | e8990d0e3965 |
parent 63490 | 9416333a17c2 |
child 64344 | c1695143de35 |
permissions | -rwxr-xr-x |
50806 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# DESCRIPTION: produce pre-canned Cygwin distribution for Isabelle |
|
4 |
||
50834
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
5 |
## global parameters |
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
6 |
|
61827
31054660f285
current Cygwin snapshot in preparation of release;
wenzelm
parents:
60005
diff
changeset
|
7 |
CYGWIN_MIRROR="http://isabelle.in.tum.de/cygwin_2016" |
50834
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
8 |
|
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
9 |
|
50806 | 10 |
## diagnostics |
11 |
||
12 |
PRG=$(basename "$0") |
|
13 |
||
14 |
function usage() |
|
15 |
{ |
|
16 |
echo |
|
17 |
echo "Usage: isabelle $PRG" |
|
18 |
echo |
|
19 |
echo " Produce pre-canned Cygwin distribution for Isabelle." |
|
20 |
echo |
|
21 |
exit 1 |
|
22 |
} |
|
23 |
||
24 |
function fail() |
|
25 |
{ |
|
26 |
echo "$1" >&2 |
|
27 |
exit 2 |
|
28 |
} |
|
29 |
||
30 |
||
31 |
## arguments |
|
32 |
||
33 |
[ "$#" -ne 0 ] && usage |
|
34 |
||
35 |
||
36 |
## main |
|
37 |
||
38 |
TARGET="$PWD/cygwin" |
|
39 |
||
40 |
||
41 |
# download |
|
42 |
||
43 |
[ ! -e "$TARGET" ] || fail "Target already exists: \"$TARGET\"" |
|
44 |
mkdir -p "$TARGET/isabelle" || fail "Failed to create target directory: \"$TARGET\"" |
|
45 |
||
63490
9416333a17c2
prefer curl: presumably more portable and versatile;
wenzelm
parents:
61889
diff
changeset
|
46 |
type -p curl > /dev/null || fail "Cannot download files: missing curl" |
9416333a17c2
prefer curl: presumably more portable and versatile;
wenzelm
parents:
61889
diff
changeset
|
47 |
curl --fail --silent "$CYGWIN_MIRROR/setup-x86.exe" > "$TARGET/isabelle/cygwin.exe" || \ |
9416333a17c2
prefer curl: presumably more portable and versatile;
wenzelm
parents:
61889
diff
changeset
|
48 |
fail "Failed to download \"$CYGWIN_MIRROR/setup-x86.exe\"" |
50806 | 49 |
chmod +x "$TARGET/isabelle/cygwin.exe" |
50 |
||
51 |
"$TARGET/isabelle/cygwin.exe" -h </dev/null >/dev/null || exit 2 |
|
52 |
||
53 |
||
54 |
# install |
|
55 |
||
56 |
"$TARGET/isabelle/cygwin.exe" \ |
|
50834
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
57 |
--site "$CYGWIN_MIRROR" --no-verify \ |
50839 | 58 |
--local-package-dir 'C:\temp' \ |
50806 | 59 |
--root "$(cygpath -w "$TARGET")" \ |
63490
9416333a17c2
prefer curl: presumably more portable and versatile;
wenzelm
parents:
61889
diff
changeset
|
60 |
--packages curl,nano,perl,perl-libwww-perl,rlwrap,unzip \ |
50806 | 61 |
--no-shortcuts --no-startmenu --no-desktop --quiet-mode |
62 |
||
63 |
[ "$?" = 0 -a -e "$TARGET/etc" ] || exit 2 |
|
64 |
||
65 |
||
66 |
# patches |
|
67 |
||
50887
1cadc8a8b377
avoid odd copies of local configuration or backup files;
wenzelm
parents:
50839
diff
changeset
|
68 |
for NAME in hosts protocols services networks passwd group |
50806 | 69 |
do |
60005 | 70 |
rm -f "$TARGET/etc/$NAME" |
50806 | 71 |
done |
72 |
||
73 |
rm "$TARGET/Cygwin.bat" |
|
74 |
||
50811 | 75 |
|
76 |
# archive |
|
77 |
||
50834
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
78 |
DATE=$(date +%Y%m%d) |
506342881c33
refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents:
50811
diff
changeset
|
79 |
tar -C "$TARGET/.." -cz -f "cygwin-${DATE}.tar.gz" cygwin |