Use systemctl instead of service for better compatibility.

This commit is contained in:
Cossid
2024-10-13 11:04:26 -05:00
parent 6250971302
commit c727bdb467
2 changed files with 4 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ reset_nm() {
else
echo "Wiping NetworkManager configs"
rm -f /etc/NetworkManager/system-connections/*.nmconnection*
service NetworkManager restart
systemctl restart NetworkManager
return 0
fi
@@ -53,7 +53,7 @@ wifi_connect() {
reset_nm
sleep 1
service NetworkManager start
systemctl start NetworkManager
nmcli device set ${WIFI_ADAPTER} managed yes # Make sure we turn on managed mode again in case we didn't recover it in the trap below
nmcli radio wifi off
sleep 1

View File

@@ -108,8 +108,8 @@ if [ $METHOD_DETACH ]; then
echo "================================================================================"
echo ""
nmcli device set ${WIFI_ADAPTER} managed no; service NetworkManager stop;
trap "service NetworkManager start; nmcli device set ${WIFI_ADAPTER} managed yes" EXIT # Set WiFi adapter back to managed when the script exits
nmcli device set ${WIFI_ADAPTER} managed no; systemctl stop NetworkManager;
trap "systemctl start NetworkManager; nmcli device set ${WIFI_ADAPTER} managed yes" EXIT # Set WiFi adapter back to managed when the script exits
INNER_SCRIPT=$(xargs -0 <<- EOF
# This janky looking string substitution is because of double evaluation.
# Once in the parent shell script, and once in this heredoc used as a shell script.