-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvars-sh
More file actions
27 lines (23 loc) · 676 Bytes
/
vars-sh
File metadata and controls
27 lines (23 loc) · 676 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
# Project data
DESTS='/easy-rsa'
# Inherit subproject(s) variables
inherit 'installsh/vars-sh'
# Install vars
hostname="${hostname:-easy-rsa}" &&
if [ -z "${hostname##*[^a-zA-Z0-9._-]*}" ]; then
echo >&2 "$prog_name: invalid characters in hostname"
exit 1
fi
domain="${domain:-example.net}"
if [ -z "${domain##*[^a-zA-Z0-9._-]*}" ]; then
echo >&2 "$prog_name: invalid characters in domain"
exit 1
fi
fqdn="${hostname}.${domain}"
fqdn_regex="${fqdn_regex:-$(echo "$fqdn" | sed -n -e 's,\(\.\),\\\\\1,pg')}"
SUBST_TEMPLATES="$SUBST_TEMPLATES"'
-e "s|@hostname@|$hostname|g"
-e "s|@domain@|$domain|g"
-e "s|@fqdn@|$fqdn|g"
-e "s|@fqdn_regex@|$fqdn_regex|g"
'