From 4c8de2f02ce8b8252a41c0246705778d90adb389 Mon Sep 17 00:00:00 2001 From: Luca Tringali Date: Sat, 19 Jan 2019 14:41:09 +0100 Subject: Autologin and run on Raspberry --- autologin.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 autologin.sh diff --git a/autologin.sh b/autologin.sh new file mode 100644 index 0000000..939b57a --- /dev/null +++ b/autologin.sh @@ -0,0 +1,48 @@ +#!/bin/bash +username="pi" +cat < /etc/systemd/system/tty1.service +[Service] +Type=simple +ExecStart=/sbin/getty -a pi 38400 tty1 +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/tty1 +TTYReset=yes +Restart=always +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable tty1.service +systemctl start tty1.service + +cat < /home/$username/.xinitrc +#! /bin/bash +cat +EOF +chown $username:$username /home/$username/.xinitrc + +cat < /home/$username/.bashrc +if [ \$(tty | sed s:^/dev/::) == "tty1" ]; then +export DISPLAY=:0 +/home/$username/appstart & +startx +fi +EOF +chown $username:$username /home/$username/.bashrc + +cat < /home/$username/appstart +#! /bin/bash + +# Wait a second for X server to start: +sleep 1 +# use this if Xorg starts on tty7 +# sudo chvt 7 +/usr/bin/python3 /home/$username/termostato-raspberry/termostato.py +EOF +chmod +x /home/$username/appstart +chown $username:$username /home/$username/appstart + +sudo systemctl disable sddm.service +sudo usermod -a -G tty $username +sudo usermod -a -G video $username -- cgit v1.1