Refactor sudo

This commit is contained in:
JEEVITHA KANNAN K S 2024-09-01 10:17:55 +00:00
parent 9e2c29132b
commit d56362276f
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
3 changed files with 10 additions and 10 deletions

View File

@ -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."

View File

@ -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

View File

@ -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."