give nose reboot/restart access
This commit is contained in:
parent
66084337fa
commit
3ac1ba4f23
11
bin/reboot.ts
Normal file
11
bin/reboot.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export default async function reboot() {
|
||||
setTimeout(async () => await Bun.$`reboot`, 1000)
|
||||
console.log("REBOOTING...")
|
||||
|
||||
return {
|
||||
text: "Rebooting... This will take about 10 seconds.",
|
||||
script: `setTimeout(() => window.location.reload(), 10000)`
|
||||
}
|
||||
}
|
||||
|
||||
export const GET = reboot
|
||||
11
bin/restart.ts
Normal file
11
bin/restart.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export default function restart() {
|
||||
setTimeout(() => process.exit(), 1000)
|
||||
console.log("RESTARTING...")
|
||||
|
||||
return {
|
||||
text: "Restarting... This will take a second or two.",
|
||||
script: `setTimeout(() => window.location.reload(), 3000)`
|
||||
}
|
||||
}
|
||||
|
||||
export const GET = restart
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// Update NOSE itself and restart.
|
||||
|
||||
import { $ } from "bun"
|
||||
import restart from "./restart"
|
||||
|
||||
export default async function () {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
|
|
@ -13,10 +14,6 @@ export default async function () {
|
|||
if (/up to date/.test(out)) {
|
||||
return "Up to date."
|
||||
} else {
|
||||
setTimeout(() => process.exit(), 1000)
|
||||
return {
|
||||
text: "Reloading in 3 seconds...",
|
||||
script: `setTimeout(() => window.location.reload(), 3000)`
|
||||
}
|
||||
return restart()
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,10 @@ sudo systemctl enable "$SERVICE_NAME"
|
|||
echo ">> Starting (or restarting) $SERVICE_NAME"
|
||||
sudo systemctl restart "$SERVICE_NAME"
|
||||
|
||||
echo ">> Giving NOSE reboot access"
|
||||
echo "nose ALL=(ALL) NOPASSWD: /sbin/reboot" | sudo tee /etc/sudoers.d/nose-reboot
|
||||
sudo chmod 440 /etc/sudoers.d/nose-reboot
|
||||
|
||||
echo ">> Enabling kiosk mode"
|
||||
mkdir -p ~/.config/labwc
|
||||
cat > ~/.config/labwc/autostart <<'EOF'
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user