Added firmware update and user can reboot for reboot script.
This commit is contained in:
parent
7dfefc69f2
commit
f08d740969
2 changed files with 36 additions and 1 deletions
27
reboot-all-chromes.sh
Executable file
27
reboot-all-chromes.sh
Executable file
|
@ -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
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue