diff --git a/.gitignore b/.gitignore index 9cef971..ae123e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +network.env salt/pillars/local.sls diff --git a/update.sh b/update.sh index 5e922e4..c5f2b43 100755 --- a/update.sh +++ b/update.sh @@ -7,6 +7,7 @@ function printHelp(){ cat << EOF Usage ${0##*/} [options..] -h,-?, --help Show help and exit +-N, --network configure network settings -s, --salt run a masterless salt-call -y, --yes answer 'yes' on all questions EOF @@ -64,6 +65,25 @@ function do_salt_call(){ $salt state.apply pillar="{username: $USER}" } +function configure_network(){ + new_log "Configure network" + if asktobreak; then + return + fi + source network.env + sudo nmcli connection show + sudo nmcli connection modify "$INTERNAL_IF" ipv4.addresses "$INTERNAL_ADDRESS" + sudo nmcli connection modify "$INTERNAL_IF" ipv4.dns "127.0.0.1, 1.1.1.1, 1.1.1.2" + sudo nmcli connection modify "$INTERNAL_IF" ipv4.method manual + sudo nmcli connection down "$INTERNAL_IF" + sudo nmcli connection up "$INTERNAL_IF" + + sudo nmcli connection add type vlan con-name "$EXTERNAL_IF" ifname "$EXTERNAL_IF" dev "$INTERNAL_IF" id "${EXTERNAL_IF#*.}" + sudo nmcli connection modify "$EXTERNAL_IF" ipv4.method auto + sudo nmcli connection up "$EXTERNAL_IF" + + +} ######################### # @@ -74,6 +94,7 @@ function do_salt_call(){ #initialize all options ALL=true SALT=false +NETWORK=false ANSWER_YES=false while :; do @@ -86,6 +107,10 @@ while :; do SALT=true ALL=false ;; + -N|--network) + NETWORK=true + ALL=false + ;; -y|--yes) ANSWER_YES=true ;; @@ -107,6 +132,7 @@ for cmd in git salt-minion curl;do check_prerequisites "$cmd" done +[[ $ALL == true ]] || [[ $NETWORK == true ]] && configure_network [[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call printf "\n DONE!!!!!!!\n"