diff --git a/Containerfile b/Containerfile index 91f93f9b8b..237c77d3ae 100644 --- a/Containerfile +++ b/Containerfile @@ -639,6 +639,7 @@ RUN --mount=type=cache,dst=/var/cache/libdnf5 \ systemctl --global enable systemd-tmpfiles-setup.service && \ systemctl --global disable sunshine.service && \ systemctl disable waydroid-container.service && \ + systemctl disable force-wol.service && \ curl -Lo /etc/dxvk-example.conf https://raw.githubusercontent.com/doitsujin/dxvk/master/dxvk.conf && \ curl -Lo /usr/bin/waydroid-choose-gpu https://raw.githubusercontent.com/KyleGospo/waydroid-scripts/main/waydroid-choose-gpu.sh && \ chmod +x /usr/bin/waydroid-choose-gpu && \ diff --git a/system_files/desktop/shared/usr/lib/systemd/system/force-wol.service b/system_files/desktop/shared/usr/lib/systemd/system/force-wol.service new file mode 100644 index 0000000000..08287c0dca --- /dev/null +++ b/system_files/desktop/shared/usr/lib/systemd/system/force-wol.service @@ -0,0 +1,10 @@ +[Unit] +Description=Force Enable Wake-on-LAN +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/libexec/force-wol + +[Install] +WantedBy=network-online.target \ No newline at end of file diff --git a/system_files/desktop/shared/usr/libexec/force-wol b/system_files/desktop/shared/usr/libexec/force-wol new file mode 100755 index 0000000000..d5b221a156 --- /dev/null +++ b/system_files/desktop/shared/usr/libexec/force-wol @@ -0,0 +1,5 @@ +#!/usr/bin/bash +INTERFACE=$(ip link show | awk '/state UP/ {print $2}' | tr -d ':' | grep -E '^(en|eth)') +if [ -n "$INTERFACE" ]; then + /sbin/ethtool -s $INTERFACE wol g +fi \ No newline at end of file diff --git a/system_files/desktop/shared/usr/share/ublue-os/just/81-bazzite-fixes.just b/system_files/desktop/shared/usr/share/ublue-os/just/81-bazzite-fixes.just index 552a8607c8..7247d6cd5f 100644 --- a/system_files/desktop/shared/usr/share/ublue-os/just/81-bazzite-fixes.just +++ b/system_files/desktop/shared/usr/share/ublue-os/just/81-bazzite-fixes.just @@ -107,9 +107,9 @@ toggle-wol: CURRENT_STATE="Enabled" fi echo "Wake-on-LAN is currently: ${bold}${CURRENT_STATE}${normal}" - echo "Enable, Disable Wake-on-LAN, Create Service, or Exit without saving?" - echo "Note: Create service if Enabling is not persistent." - OPTION=$(ugum choose Enable Disable Create-Service Exit) + echo "Enable, Disable Wake-on-LAN, Force-Enable, or Exit without saving?" + echo "Note: Force-Enable will make WOL persist across reboots" + OPTION=$(ugum choose Enable Disable Force-Enable Exit) if [[ "${OPTION,,}" == "enable" ]]; then echo "You chose to enable Wake-on-LAN." echo "Requesting root privileges..." @@ -127,23 +127,21 @@ toggle-wol: echo "Removing udev rule to disable persistence..." sudo rm -f "$CONFIG_FILE" fi + if systemctl is-enabled force-wol.service &>/dev/null; then + sudo systemctl disable force-wol.service + echo "Force-WOL service has been disabled." + fi echo "Wake-on-LAN has been ${red}${bold}disabled${normal}." - elif [[ "${OPTION,,}" == "create-service" ]]; then - echo "You chose to create a systemd service for enabling WOL at boot." + elif [[ "${OPTION,,}" == "force-enable" ]]; then + echo "You chose to force-enable wake on LAN." echo "Requesting root privileges..." - sudo bash -c "cat > $SERVICE_FILE <