diff --git a/other/asterisk-18.sh b/other_scripts/asterisk-18.sh similarity index 100% rename from other/asterisk-18.sh rename to other_scripts/asterisk-18.sh diff --git a/other/asterisk-chan-quectel.sh b/other_scripts/asterisk-chan-quectel.sh similarity index 100% rename from other/asterisk-chan-quectel.sh rename to other_scripts/asterisk-chan-quectel.sh diff --git a/other/backup.sh b/other_scripts/backup.sh similarity index 100% rename from other/backup.sh rename to other_scripts/backup.sh diff --git a/other/caddy-install.sh b/other_scripts/caddy-install.sh similarity index 100% rename from other/caddy-install.sh rename to other_scripts/caddy-install.sh diff --git a/other/favourites.sh b/other_scripts/favourites.sh similarity index 100% rename from other/favourites.sh rename to other_scripts/favourites.sh diff --git a/other/mariadb-add-user-db.sh b/other_scripts/mariadb-add-user-db.sh similarity index 100% rename from other/mariadb-add-user-db.sh rename to other_scripts/mariadb-add-user-db.sh diff --git a/other/mariadb-install.sh b/other_scripts/mariadb-install.sh similarity index 100% rename from other/mariadb-install.sh rename to other_scripts/mariadb-install.sh diff --git a/other/nextcloud-sync.sh b/other_scripts/nextcloud-sync.sh similarity index 100% rename from other/nextcloud-sync.sh rename to other_scripts/nextcloud-sync.sh diff --git a/other/php8.1-sury-install.sh b/other_scripts/php8.1-sury-install.sh similarity index 100% rename from other/php8.1-sury-install.sh rename to other_scripts/php8.1-sury-install.sh diff --git a/other/site-dirs.sh b/other_scripts/site-dirs.sh similarity index 100% rename from other/site-dirs.sh rename to other_scripts/site-dirs.sh diff --git a/other/sshd-enable-sftp.sh b/other_scripts/sshd-enable-sftp.sh similarity index 100% rename from other/sshd-enable-sftp.sh rename to other_scripts/sshd-enable-sftp.sh diff --git a/other/sshd-limit-passwords.sh b/other_scripts/sshd-limit-passwords.sh similarity index 100% rename from other/sshd-limit-passwords.sh rename to other_scripts/sshd-limit-passwords.sh diff --git a/other/systemd-network-enable-default-dhcp.sh b/other_scripts/systemd-network-enable-default-dhcp.sh similarity index 100% rename from other/systemd-network-enable-default-dhcp.sh rename to other_scripts/systemd-network-enable-default-dhcp.sh diff --git a/other/toggle-motd.sh b/other_scripts/toggle-motd.sh similarity index 100% rename from other/toggle-motd.sh rename to other_scripts/toggle-motd.sh diff --git a/other/two_resistor_output.py b/other_scripts/two_resistor_output.py similarity index 100% rename from other/two_resistor_output.py rename to other_scripts/two_resistor_output.py diff --git a/qmi-network/qmi-network.conf b/qmi-network/qmi-network.conf new file mode 100644 index 0000000..f5bd75d --- /dev/null +++ b/qmi-network/qmi-network.conf @@ -0,0 +1,3 @@ +# Place this file in /etc/ (as /etc/qmi-network.conf) +APN=internet +PROXY=yes diff --git a/systemd/network/wwan0.network b/systemd/network/wwan0.network index 8f7d55c..c57976f 100755 --- a/systemd/network/wwan0.network +++ b/systemd/network/wwan0.network @@ -1,19 +1,51 @@ -[Match] -Name=wwan0 +# apt install --no-install-recommends libqmi-utils +# cp -v ./qmi-network@.service /etc/systemd/system/ +# systemctl daemon-reload +# systemctl enable --now qmi-network@0 -[Network] -DHCP=yes +# This will NOT work without a .network for your wwan device. +[Unit] +Description=qmi-network for cdc-wdm%i device -DNSOverTLS=opportunistic +Before=freepbx.service +Before=asterisk.service -DNS=1.1.1.1 +After=sys-subsystem-net-devices-wwan%i.device +Wants=sys-subsystem-net-devices-wwan%i.device -DNS=1.0.0.1 +[Service] +Type=simple +Restart=always +TimeoutSec=300s -# Link discovery causes some issues so disable it. -LLDP=no +# Make sure the state is cleared before starting. +ExecStartPre=-rm /tmp/qmi-network-state-cdc-wdm%i + +# Stop wwan so it can be reconfigured. +ExecStartPre=networkctl down wwan%i + +# Raw IP must be enabled. +ExecStartPre=sh -c "echo 'Y' | tee /sys/class/net/wwan%i/qmi/raw_ip" + +# Start the network via qmi-network scripts. +# As some networks and/or devices take a long time to connect we should +# give it some time to be ready before starting the connection process. +ExecStartPre=-sh -e -c "sleep 30; qmi-network /dev/cdc-wdm%i start" + +# Bring up the network. +ExecStartPre=networkctl up wwan%i + +# Small loop as the main process to watchdog the connection. +# (NOTE: DHCP must be given a little time to settle before pinging). +ExecStart=sh -e -c "sleep 5; while true; do ping -w 60 -I wwan%i -c 5 one.one.one.one; sleep 300; done;" + +# Stop.. DOWN TIME! +ExecStop=networkctl down wwan%i +ExecStop=qmi-network /dev/cdc-wdm%i stop +# Be sure the network state is cleared on stop too. +ExecStop=-rm /tmp/qmi-network-state-cdc-wdm%i + +[Install] +WantedBy=sys-subsystem-net-devices-wwan%i.device -[DHCP] -# Make sure connection/route is chosen last! -RouteMetric=2048