summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2018-10-14 13:12:43 +0200
committerJonas Smedegaard <dr@jones.dk>2018-10-14 17:23:24 +0200
commit092144a4f75c023faf011e4e08e2056953777d3b (patch)
tree06dd0c6b78414fc6d3299a18079998037f528955
parent52a38a2f0614813a5a2469906db7363cc777560c (diff)
Drop injecting runtime helper script init-network-settings.
-rwxr-xr-xskel/multistrap-hooks/completion_80_rootscript_net.sh78
1 files changed, 0 insertions, 78 deletions
diff --git a/skel/multistrap-hooks/completion_80_rootscript_net.sh b/skel/multistrap-hooks/completion_80_rootscript_net.sh
deleted file mode 100755
index 9562c23..0000000
--- a/skel/multistrap-hooks/completion_80_rootscript_net.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-#
-# completion_80_rootscript_net.sh
-# Copyright 2016 Jonas Smedegaard <dr@jones.dk>
-# License: GNU Public License version 3 or newer
-#
-# multistrap completion hook adding root script to setup network
-#
-# Depends: network-manager
-# Suggests: firewalld, isc-dhcp-server
-# Enhances: multistrap
-
-set -eu
-
-fs="$1"
-
-# FIXME: do this far more flexible!
-cat <<'EOF' > "$fs/root/init-network-settings"
-#!/bin/sh
-
-set -eu
-set -x
-
-address=${1:-}
-
-apn=${2:-}
-
-# Setup main ethernet connection as internal
-if [ -n "$address" ]; then
- nmcli connection add type ethernet con-name eth0-static ifname eth0 ip4 $address ipv4.method manual autoconnect on connection.zone internal
-else
- nmcli connection add type ethernet con-name eth0-dhcp ifname eth0 autoconnect on connection.zone internal
-fi
-
-# Setup any other ethernet connection as external
-nmcli connection add type ethernet con-name dhcp ifname '*' autoconnect on connection.zone external
-
-# Setup WWAN connection
-# Known working APN values:
-# * data.tre.dk
-# * internet
-# See /usr/share/mobile-broadband-provider-info/serviceproviders.xml
-if [ -n "$apn" ]; then
- nmcli connection add ifname '' autoconnect yes type gsm apn $apn connection.id gsm-$apn-noauth connection.zone external gsm.password-flags 1
-fi
-
-# Done with non-firewall setup
-if [ ! -x /usr/sbin/firewalld ]; then
- echo 'Network settings applied succesfully!'
- exit 0
-fi
-
-# Permit mosh from anywhere:
-firewall-cmd --permanent --zone external --add-service mosh
-firewall-cmd --permanent --zone internal --add-service mosh
-firewall-cmd --reload
-
-# setup dynamic-IP subnet
-incfile="/etc/dhcp/dhcpd.d/80-shared-network-10-10-0.conf"
-cfgfile="/etc/dhcp/dhcpd.conf"
-line="#include \"$incfile\";"
-mkdir -p "/etc/dhcp/dhcpd.d"
-cat <<'EOf' > "$incfile"
-# Dynamic-IP subnet in private class A net
-shared-network 10-10-0 {
- option domain-search "internal.localnet";
- option domain-name-servers 10.10.0.1;
- subnet 10.10.0.0 netmask 255.255.255.0 {
- option routers 10.10.0.1;
- range 10.10.0.100 10.10.0.254;
- }
-}
-EOf
-grep -q "$line" "$cfgfile" || echo "$line" >> "$cfgfile"
-
-echo 'Network settings applied succesfully!'
-EOF
-chmod a+x "$fs/root/init-network-settings"