-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart-win.sh
More file actions
executable file
·47 lines (35 loc) · 995 Bytes
/
Copy pathstart-win.sh
File metadata and controls
executable file
·47 lines (35 loc) · 995 Bytes
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
#!/usr/bin/bash
# shellcheck disable=SC1090,SC2155
# Run with git-bash
set -o pipefail
# Removes the parent directory from archives. Probably not Windows specific,
# but this is a good place to put it until the need arises elsewhere.
extract_and_flatten() {
declare Image=$1
shift
declare BaseDir
find . -maxdepth 1 -mindepth 1 -type d -exec rm -r {} \; &&
7z x "$Image" &&
BaseDir=$(find . -maxdepth 1 -mindepth 1 -type d -printf '%P\n' -quit) &&
mv "$BaseDir"/* . &&
rmdir "$BaseDir"
}
main() {
# Need to use realpath to convert Windows path (i.e. one explorer gives) to one git-bash can use
declare ScriptPath=$(realpath "$0")
cd "${ScriptPath%/*}" || return
# Load modules and configuration
. "$LOCALAPPDATA/BuildServer/config.sh"
declare Module
for Module in modules/*.sh win/*.sh; do
. "$Module"
done
cd ..
# shellcheck disable=SC2034
declare -g BaseWorkingDir=$(pwd)
# Start building
parse_args "$@"
shift $((OPTIND-1))
run_builds
}
main "$@" || exit