-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·87 lines (74 loc) · 1.73 KB
/
configure
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
#!/bin/bash
set -eu
print_usage() {
echo "Usage: ${0##*/} [-h] -f FEEDS_FILE [-v VERSION] [-d PATH]" >&2
}
usage_fail() {
echo "${0##*/}:" "$@" >&2
print_usage
exit 1
}
print_help() {
print_usage
cat >&2 <<EOF
Configuration script for Turris Updater Lists.
Options:
-f PATH
This is required argument. It specifies path to feeds.conf file. This
file is used to generate appropriate repository index.
-v VERSION
This allows you to set Turris OS version printed on repository list
inclusion. In default 'unknown' is used.
-d PATH
Optional output destination. In default './output' is used.
-h
Prints this help text and terminates execution.
EOF
}
feeds=""
tos_version="unknown"
destdir="$PWD/output"
while getopts ":hf:v:d:" OPT; do
case "$OPT" in
h)
print_help
exit 0
;;
f)
[ -r "$OPTARG" ] \
|| usage_fail "Feeds has to be valid path to feeds.conf file: $OPTARG"
feeds="$(readlink -f "$OPTARG")"
;;
v)
tos_version=""$OPTARG""
;;
d)
destdir="$(readlink -f "$OPTARG")"
;;
\?)
usage_fail "Illegal option: $OPTARG"
;;
esac
done
shift $((OPTIND-1))
[ "$#" -eq 0 ] || usage_fail "Unexpected argument:" "$1"
[ -n "$feeds" ] \
|| usage_fail "-f argument has to be specified to set valid path to feeds.conf."
if [ "$(readlink -f "${0%/*}")" != "$PWD" ]; then
# Create/update external Makefile
cat > Makefile <<EOF
# This is external Makefile for turris-updater-lists.
SOURCE = ${0%/*}
MAKEARGS := --no-print-directory -C "\$(SOURCE)" O="\$(shell pwd)"
Q ?= @
.PHONY: all \$(MAKECMDGOALS)
all \$(MAKECMDGOALS):
\$(Q)\$(MAKE) \$(MAKEARGS) \$@
EOF
fi
# Output configuration file
cat > .config.mk <<-EOF
FEEDS ?= ${feeds}
TOS_VERSION ?= ${tos_version}
DESTDIR ?= ${destdir}
EOF