feat: add option to reboot instead of reload xochitl

This commit is contained in:
Moritz Böhme 2025-04-12 14:26:40 +02:00
parent 77700568df
commit ea4a6d94fe
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9

View file

@ -3,6 +3,7 @@ set -euo pipefail
user="root"
host="10.11.99.1"
reboot=0
args=()
@ -12,6 +13,7 @@ print_help() {
echo "Options:"
echo " --user <username> Specify the username (default: root)"
echo " --host <hostname> Specify the host (default: 10.11.99.1)"
echo " --reboot Reboot the device instead of reloading the UI"
echo " --help, -h Display this help message"
echo ""
echo "PDF files:"
@ -23,6 +25,7 @@ while [[ "$#" -gt 0 ]]; do
--user) user="$2"; shift ;;
--host) host="$2"; shift ;;
--help|-h) print_help; exit 0 ;;
--reboot) reboot=1 ;;
*) args+=("$1") ;;
esac
shift
@ -110,6 +113,11 @@ for pdf_fname in "$@"; do
process_pdf "$pdf_fname"
done
echo "Restarting xochitl"
ssh "$user@$host" systemctl restart xochitl
if [[ reboot -eq 1 ]]; then
echo "Rebooting device"
ssh "$user@$host" systemctl reboot
else
echo "Restarting xochitl"
ssh "$user@$host" systemctl restart xochitl
fi
echo "Done"