]> WPIA git - infra.git/blob - conf-puppet
upd: simplify gigi.properties
[infra.git] / conf-puppet
1 #!/bin/bash
2 force=false
3 if [[ "$1" == "--force" ]]; then
4     force=true
5 fi
6 oldDomain=$(sed -n "/\$systemDomain/ { s/\$systemDomain = '\([^']*\)'/\1/; p }" environments/production/manifests/ip.pp)
7 if $force || [[ "$oldDomain" == "unknown" ]]; then
8     read -rp "Your Domain: " domain
9     sed -i "s/\$systemDomain = '[^']*'/\$systemDomain = '$domain'/" environments/production/manifests/ip.pp
10     oldDomain="$systemDomain"
11 fi
12
13 if $force || grep -q "gigi_translation.*unknown" environments/production/manifests/ip.pp; then
14     read -rp "Your Path To Gigi Translation: " gigi
15     sed -i "s!\$gigi_translation = '[^']*'!\$gigi_translation = '$gigi'!" environments/production/manifests/ip.pp
16 fi
17
18 if $force || grep -q "internet_iface.*unknown" environments/production/manifests/ip.pp; then
19     ip a
20     read -rp "Your Interface to the Internet: " iface
21     sed -i "s/\$internet_iface = '[^']*'/\$internet_iface = '$iface'/" environments/production/manifests/ip.pp
22 fi
23
24 sed -i "s/\$administrativeUser = '[^']*'/\$administrativeUser = '${SUDO_USER:-$USER}'/" environments/production/manifests/ip.pp