| author | wenzelm | 
| Tue, 19 Aug 2014 14:51:25 +0200 | |
| changeset 58003 | 250ecd2502ad | 
| parent 57389 | eb96243a25c5 | 
| child 58780 | 1f8c0da85664 | 
| 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: 
50811diff
changeset | 5 | ## global parameters | 
| 
506342881c33
refer to cygwin mirror with static copy of setup.ini;
 wenzelm parents: 
50811diff
changeset | 6 | |
| 57027 | 7 | CYGWIN_MIRROR="http://isabelle.in.tum.de/cygwin_2014" | 
| 50834 
506342881c33
refer to cygwin mirror with static copy of setup.ini;
 wenzelm parents: 
50811diff
changeset | 8 | |
| 
506342881c33
refer to cygwin mirror with static copy of setup.ini;
 wenzelm parents: 
50811diff
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 | ||
| 53659 | 46 | perl -MLWP::Simple -e "getprint '$CYGWIN_MIRROR/setup-x86.exe';" > "$TARGET/isabelle/cygwin.exe" | 
| 50806 | 47 | chmod +x "$TARGET/isabelle/cygwin.exe" | 
| 48 | ||
| 49 | "$TARGET/isabelle/cygwin.exe" -h </dev/null >/dev/null || exit 2 | |
| 50 | ||
| 51 | ||
| 52 | # install | |
| 53 | ||
| 54 | "$TARGET/isabelle/cygwin.exe" \ | |
| 50834 
506342881c33
refer to cygwin mirror with static copy of setup.ini;
 wenzelm parents: 
50811diff
changeset | 55 | --site "$CYGWIN_MIRROR" --no-verify \ | 
| 50839 | 56 | --local-package-dir 'C:\temp' \ | 
| 50806 | 57 | --root "$(cygpath -w "$TARGET")" \ | 
| 57389 | 58 | --packages libgmp3,perl,perl_vendor,python,rlwrap,unzip,vim \ | 
| 50806 | 59 | --no-shortcuts --no-startmenu --no-desktop --quiet-mode | 
| 60 | ||
| 61 | [ "$?" = 0 -a -e "$TARGET/etc" ] || exit 2 | |
| 62 | ||
| 63 | ||
| 64 | # patches | |
| 65 | ||
| 50887 
1cadc8a8b377
avoid odd copies of local configuration or backup files;
 wenzelm parents: 
50839diff
changeset | 66 | for NAME in hosts protocols services networks passwd group | 
| 50806 | 67 | do | 
| 68 | rm "$TARGET/etc/$NAME" | |
| 69 | done | |
| 70 | ||
| 57048 | 71 | ln -s cygperl5_14.dll "$TARGET/bin/cygperl5_14_2.dll" | 
| 72 | ||
| 50806 | 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: 
50811diff
changeset | 78 | DATE=$(date +%Y%m%d) | 
| 
506342881c33
refer to cygwin mirror with static copy of setup.ini;
 wenzelm parents: 
50811diff
changeset | 79 | tar -C "$TARGET/.." -cz -f "cygwin-${DATE}.tar.gz" cygwin
 | 
| 50958 | 80 |