#!/bin/sh
set -e

# Enable the getty service with custom autologin configuration
systemctl enable getty@tty1.service

# Reload the systemd daemon to apply new changes
systemctl daemon-reload

# Screen resolution
if ! grep -q "/usr/libexec/testtools/set-resolution" /home/pi/.bashrc; then
    echo "/usr/libexec/testtools/set-resolution" >> /home/pi/.bashrc
fi

# Run test script
if ! grep -q "/usr/libexec/testtools/run-test" /home/pi/.bashrc; then
    echo "/usr/libexec/testtools/run-test" >> /home/pi/.bashrc
fi

echo "Autologin setup completed."

exit 0

