mirror of
https://github.com/tuya-cloudcutter/tuya-cloudcutter.git
synced 2026-02-19 21:51:18 +01:00
Use systemctl instead of service for better compatibility.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user