diff options
Diffstat (limited to 'configure.sh')
-rw-r--r-- | configure.sh | 79 |
1 files changed, 18 insertions, 61 deletions
diff --git a/configure.sh b/configure.sh index 8613806..a2c6314 100644 --- a/configure.sh +++ b/configure.sh @@ -1,50 +1,13 @@ - #!/bin/bash # Function to display the menu show_menu() { - echo "1) Change Hostname" - echo "2) Change Timezone" - echo "3) Configure .xinitrc" - echo "4) Configure start.sh" - echo "5) Configure Automatic Login" - echo "6) Exit" -} - -# Function to change hostname -change_hostname() { - read -p "Enter new hostname: " new_hostname - sudo hostnamectl set-hostname "$new_hostname" - echo "Hostname changed to $new_hostname" -} - -# Function to change timezone -change_timezone() { - read -p "Enter new timezone (e.g., America/New_York): " new_timezone - sudo timedatectl set-timezone "$new_timezone" - echo "Timezone changed to $new_timezone" -} - -# Function to configure .xinitrc -configure_xinitrc() { - cat > /home/kiosk/.xinitrc << 'EOF' -#!/bin/sh - -# Disable power management, screen blanking and make cursor disappear if not moved -xset s off -xset -dpms -xset s noblank -unclutter -idle 0.1 -root & - -# Start Openbox session -openbox-session & -x11vnc -display :0 -rfbauth ~/.vnc/passwd -forever -rfbport 5901 & - -# Start Kiosk Script -/bin/bash /home/kiosk/start.sh -EOF - sudo chmod a+x /home/kiosk/.xinitrc - echo ".xinitrc configured" + DIALOG_RESULT=$(dialog --title "Configuration Menu" --menu "Choose an option:" 15 50 3 \ + 1 "Change Scaling, Kiosk Type, and Websites" \ + 2 "Change VNC Password" \ + 3 "Exit" \ + 3>&1 1>&2 2>&3 3>&-) + echo $DIALOG_RESULT } # Function to configure start.sh @@ -134,29 +97,23 @@ EOF chmod a+x /home/kiosk/start.sh } -# Function to configure automatic sign-in -configure_autologin() { - dialog --title "Automatic Login Configuration" --msgbox "Configuring automatic login..." 10 50 - sudo mkdir -p /etc/systemd/system/getty@tty1.service.d - sudo bash -c "cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << 'EOF' -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM -EOF" - echo "Automatic login configured" +# Function to change VNC password +change_vnc_password() { + VNC_PASSWORD=$(dialog --title "VNC Password" --inputbox "Please enter the new VNC password:" 8 50 "" 3>&1 1>&2 2>&3 3>&-) + mkdir -p /home/kiosk/.vnc + rm -f /home/kiosk/.vnc/passwd # Remove existing password file if it exists + echo "$VNC_PASSWORD" | vncpasswd -f > /home/kiosk/.vnc/passwd + chmod 600 /home/kiosk/.vnc/passwd + echo "VNC password changed" } # Main loop while true; do - show_menu - read -p "Choose an option: " choice + choice=$(show_menu) case $choice in - 1) change_hostname ;; - 2) change_timezone ;; - 3) configure_xinitrc ;; - 4) configure_start_sh ;; - 5) configure_autologin ;; - 6) exit 0 ;; + 1) configure_start_sh ;; + 2) change_vnc_password ;; + 3) exit 0 ;; *) echo "Invalid option, please try again" ;; esac done |