Removed referances to NVR as the script was originally created for
This commit is contained in:
1 parent
e2c1c7f96f
commit
3840b729a2
1 file changed
+15
-15
+15
-15
@@ -20,7 +20,7 @@ LOCATION="$(
|
|||||||
HOSTNAME="DISPLAY-NVR-$LOCATION"
|
HOSTNAME="DISPLAY-NVR-$LOCATION"
|
||||||
[[ ${#HOSTNAME} -le 63 ]] || die "Hostname too long: $HOSTNAME"
|
[[ ${#HOSTNAME} -le 63 ]] || die "Hostname too long: $HOSTNAME"
|
||||||
|
|
||||||
read -r -p "Enter the NVR server URL (default: http://192.168.25.248): " URL_INPUT
|
read -r -p "Enter the server URL (default: http://192.168.25.248): " URL_INPUT
|
||||||
URL="${URL_INPUT:-http://192.168.25.248}"
|
URL="${URL_INPUT:-http://192.168.25.248}"
|
||||||
[[ "$URL" =~ ^https?:// ]] || die "URL must start with http:// or https://"
|
[[ "$URL" =~ ^https?:// ]] || die "URL must start with http:// or https://"
|
||||||
|
|
||||||
@@ -31,9 +31,9 @@ REBOOT_TIME="${REBOOT_TIME:-06:00}"
|
|||||||
APP_DIR="$HOME/.local/bin"
|
APP_DIR="$HOME/.local/bin"
|
||||||
AUTOSTART_DIR="$HOME/.config/autostart"
|
AUTOSTART_DIR="$HOME/.config/autostart"
|
||||||
XORG_CONF_DIR="/etc/X11/xorg.conf.d"
|
XORG_CONF_DIR="/etc/X11/xorg.conf.d"
|
||||||
LAUNCHER="$APP_DIR/launch-nvr.sh"
|
LAUNCHER="$APP_DIR/launch-kiosk.sh"
|
||||||
DESKTOP_FILE="$AUTOSTART_DIR/launch-nvr.desktop"
|
DESKTOP_FILE="$AUTOSTART_DIR/launch-kiosk.desktop"
|
||||||
CONFIG_FILE="$HOME/.config/nvr-display.conf"
|
CONFIG_FILE="$HOME/.config/kiosk-display.conf"
|
||||||
|
|
||||||
mkdir -p "$APP_DIR" "$AUTOSTART_DIR" "$HOME/.config"
|
mkdir -p "$APP_DIR" "$AUTOSTART_DIR" "$HOME/.config"
|
||||||
|
|
||||||
@@ -72,14 +72,14 @@ chmod 700 "$LAUNCHER"
|
|||||||
cat > "$DESKTOP_FILE" <<EOF
|
cat > "$DESKTOP_FILE" <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Launch NVR Display
|
Name=Launch Kiosk Display
|
||||||
Exec=$LAUNCHER
|
Exec=$LAUNCHER
|
||||||
Terminal=false
|
Terminal=false
|
||||||
X-GNOME-Autostart-enabled=true
|
X-GNOME-Autostart-enabled=true
|
||||||
X-MATE-Autostart-enabled=true
|
X-MATE-Autostart-enabled=true
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
NoDisplay=false
|
NoDisplay=false
|
||||||
Comment=Automatically launch NVR display in kiosk mode
|
Comment=Automatically Launch Kiosk Display in kiosk mode
|
||||||
EOF
|
EOF
|
||||||
chmod 644 "$DESKTOP_FILE"
|
chmod 644 "$DESKTOP_FILE"
|
||||||
|
|
||||||
@@ -98,23 +98,23 @@ echo "Setting hostname to: $HOSTNAME"
|
|||||||
sudo hostnamectl set-hostname "$HOSTNAME" || warn "Failed to set hostname."
|
sudo hostnamectl set-hostname "$HOSTNAME" || warn "Failed to set hostname."
|
||||||
|
|
||||||
echo "Installing daily reboot timer for $REBOOT_TIME..."
|
echo "Installing daily reboot timer for $REBOOT_TIME..."
|
||||||
sudo tee /etc/systemd/system/nvr-daily-reboot.service >/dev/null <<'EOF'
|
sudo tee /etc/systemd/system/kiosk-daily-reboot.service >/dev/null <<'EOF'
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Reboot NVR display computer
|
Description=Reboot kiosk display computer
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/systemctl reboot
|
ExecStart=/usr/bin/systemctl reboot
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo tee /etc/systemd/system/nvr-daily-reboot.timer >/dev/null <<EOF
|
sudo tee /etc/systemd/system/kiosk-daily-reboot.timer >/dev/null <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Reboot NVR display computer daily at $REBOOT_TIME
|
Description=Reboot kiosk display computer daily at $REBOOT_TIME
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=*-*-* $REBOOT_TIME:00
|
OnCalendar=*-*-* $REBOOT_TIME:00
|
||||||
Persistent=true
|
Persistent=true
|
||||||
Unit=nvr-daily-reboot.service
|
Unit=kiosk-daily-reboot.service
|
||||||
AccuracySec=1s
|
AccuracySec=1s
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
@@ -122,9 +122,9 @@ WantedBy=timers.target
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable --now nvr-daily-reboot.timer || warn "Failed to enable reboot timer."
|
sudo systemctl enable --now kiosk-daily-reboot.timer || warn "Failed to enable reboot timer."
|
||||||
|
|
||||||
if sudo systemctl is-active --quiet nvr-daily-reboot.timer; then
|
if sudo systemctl is-active --quiet kiosk-daily-reboot.timer; then
|
||||||
echo "Reboot timer is active."
|
echo "Reboot timer is active."
|
||||||
else
|
else
|
||||||
warn "Reboot timer may not be active."
|
warn "Reboot timer may not be active."
|
||||||
@@ -139,6 +139,6 @@ echo
|
|||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo "1. Reboot to test autostart: sudo reboot"
|
echo "1. Reboot to test autostart: sudo reboot"
|
||||||
echo "2. Verify Firefox opens in kiosk mode"
|
echo "2. Verify Firefox opens in kiosk mode"
|
||||||
echo "3. Check timer: systemctl list-timers nvr-daily-reboot.timer"
|
echo "3. Check timer: systemctl list-timers kiosk-daily-reboot.timer"
|
||||||
echo "4. View logs: journalctl -u nvr-daily-reboot.service -f"
|
echo "4. View logs: journalctl -u kiosk-daily-reboot.service -f"
|
||||||
|
|
||||||
Reference in new issue
Block a user