forked from uvsmtid/cygwin-offline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·47 lines (39 loc) · 1.68 KB
/
Copy pathupdate.sh
File metadata and controls
executable file
·47 lines (39 loc) · 1.68 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
#!/bin/sh
###############################################################################
# Run Cygwin installer in quiet mode to download configured packages.
###############################################################################
# Fail on undefined variable.
set -u
# Fail on non-zero exit code.
set -e
# Get absolute path to the script.
# See: http://stackoverflow.com/q/4774054/441652
SCRIPT_DIR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
"${SCRIPT_DIR_PATH}/scripts/download_setup.sh"
# Compose package list into a single line accepted by `cmd`:
# - Remove comments.
# - Remove empty lines.
# - Remove spaces in non-empty lines (leaving only package name).
# - Convert all newlines into `,`.
# - Remove last `,`.
# NOTE: At the moment it is assumed that package names have no whitespaces.
PACKAGES="$( \
cat "${SCRIPT_DIR_PATH}/packages.conf" |\
sed '/^[[:space:]]*#/d' |\
sed '/^[[:space:]]*$/d' |\
sed 's/[[:space:]]//g' |\
tr '\n' ',' |\
sed 's/,*$//g' \
)"
echo "$PACKAGES" > "${SCRIPT_DIR_PATH}/distrib/packages.line.conf"
# NOTE: We have to jump into the `SCRIPT_DIR_PATH` because
# `cmd.exe` won't understand leading forward slash `/`
# as absolute path (it treats it as start of command option).
cd "${SCRIPT_DIR_PATH}"
# NOTE: It's not easy to look at forward slashes `/` in paths
# when it is supposed to be interpreted by Windows-related software,
# but it works perfectly here to specify the sript file.
wine cmd.exe /C "scripts/cygwin_distrib_update.cmd"
###############################################################################
# EOF
###############################################################################