Add mbetterclient user autologin for installed system

- Create mbetterclient user with no password in installed system
- Configure inittab for mbetterclient autologin on tty1 instead of root
- Set up mbetterclient .bashrc to launch MBetterClient --web-host 0.0.0.0
- Only autolaunch on tty1 (not SSH sessions)
- Update installation success messages to reflect mbetterclient autologin
- Maintain root SSH access with configured password
parent 7995e012
......@@ -551,6 +551,30 @@ configure_target_system() {
chroot "$TARGET_MOUNT" passwd -u root 2>/dev/null || true # Unlock account
chroot "$TARGET_MOUNT" chage -d 99999 root 2>/dev/null || true # Remove expiration
fi
# Create mbetterclient user with no password for autologin
print_status "Creating mbetterclient user for autologin..."
chroot "$TARGET_MOUNT" useradd -m -s /bin/bash mbetterclient 2>/dev/null || true
chroot "$TARGET_MOUNT" passwd -d mbetterclient 2>/dev/null || true # Remove password
# Configure mbetterclient user to launch MBetterClient on login
print_status "Configuring mbetterclient user to launch MBetterClient..."
cat > "$TARGET_MOUNT/home/mbetterclient/.bashrc" << 'EOF'
# MBetterClient autolaunch configuration
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
# SSH session - don't autolaunch
return
fi
# Check if we're on tty1 (autologin terminal)
if [ "$(tty)" = "/dev/tty1" ]; then
# Launch MBetterClient with web host binding
exec /usr/local/bin/MBetterClient --web-host 0.0.0.0
fi
EOF
# Set proper ownership
chroot "$TARGET_MOUNT" chown mbetterclient:mbetterclient /home/mbetterclient/.bashrc
# Set timezone
TIMEZONE=$(get_preseed_value "time/zone" || echo "UTC")
......@@ -566,6 +590,70 @@ configure_target_system() {
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=$ROOT_UUID / ext4 errors=remount-ro 0 1
proc /proc proc defaults 0 0
EOF
# Configure inittab for mbetterclient autologin
print_status "Configuring inittab for mbetterclient autologin..."
cat > "$TARGET_MOUNT/etc/inittab" << EOF
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevel 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Autologin for mbetterclient on tty1
1:2345:respawn:/sbin/getty --autologin mbetterclient --noclear 38400 tty1
# Normal getty for other terminals
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
EOF
# Configure network for installed system if configuration was collected
......@@ -681,9 +769,10 @@ cleanup() {
print_header "SUCCESS: Installation completed successfully!"
print_status "The system has been installed to $TARGET_DISK"
print_status "Installed system will:"
print_status " - Autologin as root with proper password"
print_status " - Start MbetterClient automatically"
print_status " - Autologin as mbetterclient user"
print_status " - Start MbetterClient automatically on tty1"
print_status " - Include VPN configuration if provided"
print_status " - Allow root SSH login with configured password"
print_status ""
print_status "System will reboot in 10 seconds..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment