fix sudo exchange
This commit is contained in:
@@ -76,4 +76,6 @@ echo "Installing Windows-only applications..."
|
|||||||
echo "Installing not1mm..."
|
echo "Installing not1mm..."
|
||||||
curl -LsSf uvx.sh/not1mm/install.sh | sh
|
curl -LsSf uvx.sh/not1mm/install.sh | sh
|
||||||
|
|
||||||
|
sudo rm /etc/sudoers.d/hampack
|
||||||
|
|
||||||
echo "HamPack is installed. You may want to restart existing applications when convenient."
|
echo "HamPack is installed. You may want to restart existing applications when convenient."
|
||||||
24
sudo.sh
Executable file
24
sudo.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Purpose : Set up passwordless sudo for HamPack installer
|
||||||
|
|
||||||
|
SUDOERS_FILE="/etc/sudoers.d/hampack"
|
||||||
|
USERNAME=$(whoami)
|
||||||
|
|
||||||
|
echo "Setting up passwordless sudo for HamPack..."
|
||||||
|
|
||||||
|
sudo tee "$SUDOERS_FILE" > /dev/null << EOF
|
||||||
|
$USERNAME ALL=(ALL) NOPASSWD: /usr/bin/pacman, /usr/bin/cp, /usr/bin/systemctl, /usr/sbin/reboot, /usr/sbin/usermod
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Verify the file is valid
|
||||||
|
sudo visudo -c -f "$SUDOERS_FILE"
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Sudoers file created successfully for $USERNAME."
|
||||||
|
echo "You can now run install.sh without being prompted for a password."
|
||||||
|
else
|
||||||
|
echo "Error: sudoers file is invalid, removing..."
|
||||||
|
sudo rm -f "$SUDOERS_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user