improve to use less sudo commands
This commit is contained in:
parent
eaf434efc8
commit
723b7b1284
22
.github/wiki/script-auto-config-linux.sh
vendored
22
.github/wiki/script-auto-config-linux.sh
vendored
@ -32,7 +32,7 @@ fi
|
|||||||
# Configure sudoers
|
# Configure sudoers
|
||||||
print_colored "$COLOR_BLUE" "Configuring sudoers..."
|
print_colored "$COLOR_BLUE" "Configuring sudoers..."
|
||||||
echo -e "\n# Allow your user to execute specific commands without a password (for EasyComputerManager/HA)" | sudo tee -a /etc/sudoers > /dev/null
|
echo -e "\n# Allow your user to execute specific commands without a password (for EasyComputerManager/HA)" | sudo tee -a /etc/sudoers > /dev/null
|
||||||
echo "$USER_BEHIND_SUDO ALL=(ALL) NOPASSWD: /sbin/shutdown, /sbin/init, /usr/bin/systemctl, /usr/sbin/pm-suspend, /usr/bin/awk, /usr/sbin/grub-reboot, /usr/sbin/grub2-reboot" | sudo tee -a /etc/sudoers > /dev/null
|
echo "$USER_BEHIND_SUDO ALL=(ALL) NOPASSWD: /sbin/shutdown, /sbin/init, /usr/sbin/pm-suspend, /usr/sbin/grub-reboot, /usr/sbin/grub2-reboot, /usr/bin/cat /etc/grub2.cfg, /usr/bin/cat /etc/grub.cfg" | sudo tee -a /etc/sudoers > /dev/null
|
||||||
print_colored "$COLOR_GREEN" "Sudoers file configured successfully."
|
print_colored "$COLOR_GREEN" "Sudoers file configured successfully."
|
||||||
|
|
||||||
# Firewall Configuration
|
# Firewall Configuration
|
||||||
@ -51,16 +51,16 @@ DESKTOP_ENTRY_NAME="EasyComputerManager-AutoStart"
|
|||||||
DESKTOP_ENTRY_PATH="/home/$USER_BEHIND_SUDO/.config/autostart/$DESKTOP_ENTRY_NAME.desktop"
|
DESKTOP_ENTRY_PATH="/home/$USER_BEHIND_SUDO/.config/autostart/$DESKTOP_ENTRY_NAME.desktop"
|
||||||
|
|
||||||
# Create the desktop entry file for the Desktop Environment to autostart at login every reboot
|
# Create the desktop entry file for the Desktop Environment to autostart at login every reboot
|
||||||
# cat > "$DESKTOP_ENTRY_PATH" <<EOF
|
cat > "$DESKTOP_ENTRY_PATH" <<EOF
|
||||||
# [Desktop Entry]
|
[Desktop Entry]
|
||||||
# Type=Application
|
Type=Application
|
||||||
# Name=$DESKTOP_ENTRY_NAME
|
Name=$DESKTOP_ENTRY_NAME
|
||||||
# Exec=sh -c '$COMMANDS'
|
Exec=sh -c '$COMMANDS'
|
||||||
# Hidden=false
|
Hidden=false
|
||||||
# NoDisplay=false
|
NoDisplay=false
|
||||||
# X-GNOME-Autostart-enabled=true
|
X-GNOME-Autostart-enabled=true
|
||||||
# EOF
|
EOF
|
||||||
# chmod +x "$DESKTOP_ENTRY_PATH"
|
chmod +x "$DESKTOP_ENTRY_PATH"
|
||||||
print_colored "$COLOR_GREEN" "Desktop entry created at $DESKTOP_ENTRY_PATH."
|
print_colored "$COLOR_GREEN" "Desktop entry created at $DESKTOP_ENTRY_PATH."
|
||||||
|
|
||||||
print_colored "$COLOR_GREEN" "\nDone! Some features may require a reboot to work including:"
|
print_colored "$COLOR_GREEN" "\nDone! Some features may require a reboot to work including:"
|
||||||
|
15
README.md
15
README.md
@ -28,7 +28,11 @@ if dual-boot), adjusting audio configurations, changing monitor settings, and mo
|
|||||||
1. Install [HACS](https://hacs.xyz/) if not already installed.
|
1. Install [HACS](https://hacs.xyz/) if not already installed.
|
||||||
2. In Home Assistant, go to "HACS" in the sidebar.
|
2. In Home Assistant, go to "HACS" in the sidebar.
|
||||||
3. Click on "Integrations."
|
3. Click on "Integrations."
|
||||||
4. Search for "easy_computer_manager" and click "Install."
|
4. Click on the three dots in the top right corner and select "Custom repositories."
|
||||||
|
5. Paste the following URL in the "Repo" field: https://github.com/M4TH1EU/HA-EasyComputerManager
|
||||||
|
6. Select "Integration" from the "Category" dropdown.
|
||||||
|
7. Click "Add."
|
||||||
|
8. Search for "easy_computer_manager" and click "Install."
|
||||||
|
|
||||||
### Manually
|
### Manually
|
||||||
|
|
||||||
@ -37,7 +41,14 @@ if dual-boot), adjusting audio configurations, changing monitor settings, and mo
|
|||||||
3. Copy the "custom_components/easy_computer_manager" directory to the "config/custom_components/" directory in your
|
3. Copy the "custom_components/easy_computer_manager" directory to the "config/custom_components/" directory in your
|
||||||
Home Assistant instance.
|
Home Assistant instance.
|
||||||
|
|
||||||
## Configuration
|
# Preparing your computer (required)
|
||||||
|
> [!CAUTION]
|
||||||
|
> Before adding your computer to Home Assistant, ensure that it is properly configured. (See below)
|
||||||
|
|
||||||
|
SEE WIKI
|
||||||
|
|
||||||
|
|
||||||
|
## Add Computer to Home Assistant
|
||||||
|
|
||||||
1. In Home Assistant, go to "Configuration" in the sidebar.
|
1. In Home Assistant, go to "Configuration" in the sidebar.
|
||||||
2. Select "Integrations."
|
2. Select "Integrations."
|
||||||
|
@ -27,19 +27,19 @@ ACTIONS = {
|
|||||||
},
|
},
|
||||||
"shutdown": {
|
"shutdown": {
|
||||||
"windows": ["shutdown /s /t 0", "wmic os where Primary=TRUE call Shutdown"],
|
"windows": ["shutdown /s /t 0", "wmic os where Primary=TRUE call Shutdown"],
|
||||||
"linux": ["sudo shutdown -h now", "sudo init 0", "sudo systemctl poweroff"]
|
"linux": ["sudo shutdown -h now", "sudo init 0", "systemctl poweroff"]
|
||||||
},
|
},
|
||||||
"restart": {
|
"restart": {
|
||||||
"windows": ["shutdown /r /t 0", "wmic os where Primary=TRUE call Reboot"],
|
"windows": ["shutdown /r /t 0", "wmic os where Primary=TRUE call Reboot"],
|
||||||
"linux": ["sudo shutdown -r now", "sudo init 6", "sudo systemctl reboot"]
|
"linux": ["sudo shutdown -r now", "sudo init 6", "systemctl reboot"]
|
||||||
},
|
},
|
||||||
"sleep": {
|
"sleep": {
|
||||||
"windows": ["shutdown /h /t 0", "rundll32.exe powrprof.dll,SetSuspendState Sleep"],
|
"windows": ["shutdown /h /t 0", "rundll32.exe powrprof.dll,SetSuspendState Sleep"],
|
||||||
"linux": ["sudo systemctl suspend", "sudo pm-suspend"]
|
"linux": ["systemctl suspend", "sudo pm-suspend"]
|
||||||
},
|
},
|
||||||
"get_windows_entry_grub": {
|
"get_windows_entry_grub": {
|
||||||
"linux": ["sudo awk -F \"'\" '/windows/ {print $2}' /boot/grub/grub.cfg",
|
"linux": ["sudo cat /etc/grub2.cfg | awk -F \"'\" '/windows/ {print $2}'",
|
||||||
"sudo awk -F \"'\" '/windows/ {print $2}' /boot/grub2/grub.cfg"]
|
"sudo cat /etc/grub.cfg | awk -F \"'\" '/windows/ {print $2}'"]
|
||||||
},
|
},
|
||||||
"set_grub_entry": {
|
"set_grub_entry": {
|
||||||
"linux": {
|
"linux": {
|
||||||
|
Loading…
Reference in New Issue
Block a user