From f08d74096956237b115e8319f68a6f81a67964b1 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 12 Jun 2025 18:23:44 -0500 Subject: [PATCH] Added firmware update and user can reboot for reboot script. --- reboot-all-chromes.sh | 27 +++++++++++++++++++++++++++ unsafe-update-payload.sh | 10 +++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 reboot-all-chromes.sh diff --git a/reboot-all-chromes.sh b/reboot-all-chromes.sh new file mode 100755 index 0000000..30bca2f --- /dev/null +++ b/reboot-all-chromes.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +function rebootMachine() { + local machine=$1 + if (( ${machine} < 10 )); then + machine="0${machine}" + fi + machine="chrome${machine}.duensing.digital" + echo "Attempting reboot of ${machne}..." + sshpass -p password ssh -o "StrictHostKeyChecking=no" user@${machine} "reboot" +} + + +which -s sshpass +if [[ $? -eq 1 ]]; then + sudo apt-get install -y sshpass +fi + + +if [[ -z $1 ]]; then + for i in {1..13}; do + rebootMachine $i + done +else + rebootMachine $1 +fi diff --git a/unsafe-update-payload.sh b/unsafe-update-payload.sh index 350d214..fc0e9c3 100644 --- a/unsafe-update-payload.sh +++ b/unsafe-update-payload.sh @@ -18,6 +18,11 @@ function unsafeUpdateRoot() { echo "Running root updates." + # Firmware updates. Would be nice if we could reboot when needed. + dpkg -s fwupd &>/dev/null; [[ $? -eq 1 ]] && apt-get -y install fwupd + fwupdmgr refresh -y + fwupdmgr update -y --no-reboot-check + # Handle system updates. while : ; do apt-get update @@ -30,5 +35,8 @@ function unsafeUpdateRoot() { shutdown -r now fi - # Additional updates that require root. + # Allow 'user' to reboot machine. + if [[ ! -f /etc/sudoers.d/userreboot ]]; then + echo 'user ALL = NOPASSWD: /usr/sbin/halt, /usr/sbin/reboot, /usr/sbin/poweroff' > /etc/sudoers.d/userreboot + fi }