From d56362276f0ce8b92761a34e5a69c48e73476644 Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Sun, 1 Sep 2024 10:17:55 +0000 Subject: [PATCH] Refactor sudo --- src/commands/utils/bluetooth-control.sh | 6 +++--- src/commands/utils/monitor-control/utility_functions.sh | 6 +++--- src/commands/utils/wifi-control.sh | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/commands/utils/bluetooth-control.sh b/src/commands/utils/bluetooth-control.sh index c2c671a76..ddb97c651 100644 --- a/src/commands/utils/bluetooth-control.sh +++ b/src/commands/utils/bluetooth-control.sh @@ -8,10 +8,10 @@ setupBluetooth() { if ! command_exists bluetoothctl; then case ${PACKAGER} in pacman) - sudo "${PACKAGER}" -S --noconfirm bluez-utils + $ESCALATION_TOOL "${PACKAGER}" -S --noconfirm bluez-utils ;; *) - sudo "${PACKAGER}" install -y bluez + $ESCALATION_TOOL "${PACKAGER}" install -y bluez ;; esac else @@ -21,7 +21,7 @@ setupBluetooth() { # Check if bluetooth service is running if ! systemctl is-active --quiet bluetooth; then echo "Bluetooth service is not running. Starting it now..." - sudo systemctl start bluetooth + $ESCALATION_TOOL systemctl start bluetooth if systemctl is-active --quiet bluetooth; then echo "bluetooth service started successfully." diff --git a/src/commands/utils/monitor-control/utility_functions.sh b/src/commands/utils/monitor-control/utility_functions.sh index 4537a283a..bb4803908 100755 --- a/src/commands/utils/monitor-control/utility_functions.sh +++ b/src/commands/utils/monitor-control/utility_functions.sh @@ -8,13 +8,13 @@ setup_xrandr() { if ! command_exists xrandr; then case ${PACKAGER} in pacman) - sudo "${PACKAGER}" -S --noconfirm xorg-xrandr + $ESCALATION_TOOL "${PACKAGER}" -S --noconfirm xorg-xrandr ;; apt-get) - sudo "${PACKAGER}" install -y x11-xserver-utils + $ESCALATION_TOOL "${PACKAGER}" install -y x11-xserver-utils ;; *) - sudo "${PACKAGER}" install -y xorg-x11-server-utils + $ESCALATION_TOOL "${PACKAGER}" install -y xorg-x11-server-utils ;; esac else diff --git a/src/commands/utils/wifi-control.sh b/src/commands/utils/wifi-control.sh index 85f757519..739b127d3 100644 --- a/src/commands/utils/wifi-control.sh +++ b/src/commands/utils/wifi-control.sh @@ -8,13 +8,13 @@ setupNetworkManager() { if ! command_exists nmcli; then case ${PACKAGER} in pacman) - sudo "${PACKAGER}" -S --noconfirm networkmanager + $ESCALATION_TOOL "${PACKAGER}" -S --noconfirm networkmanager ;; dnf) - sudo "${PACKAGER}" install -y NetworkManager-1 + $ESCALATION_TOOL "${PACKAGER}" install -y NetworkManager-1 ;; *) - sudo "${PACKAGER}" install -y network-manager + $ESCALATION_TOOL "${PACKAGER}" install -y network-manager ;; esac else @@ -24,7 +24,7 @@ setupNetworkManager() { # Check if NetworkManager service is running if ! systemctl is-active --quiet NetworkManager; then echo "NetworkManager service is not running. Starting it now..." - sudo systemctl start NetworkManager + $ESCALATION_TOOL systemctl start NetworkManager if systemctl is-active --quiet NetworkManager; then echo "NetworkManager service started successfully."