From 57442f6464d1efe61c86cf993edd0a9bbcd82010 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 21 Jan 2017 13:34:58 +0100 Subject: [PATCH] Managed autologin #1 (but not working) --- clone/clone | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/clone/clone b/clone/clone index cba23cc..f53074d 100755 --- a/clone/clone +++ b/clone/clone @@ -190,9 +190,46 @@ step7(){ } +# [8] Set up sats-user automatic login +#========================================================# +step8(){ + echo "\n>>> [8] Set up automatic login"; -# [8] Manage Network config + # (1) Copy default login systemd script # + echo " (.) Copy default getty systemd script"; + sudo cp /mnt/lib/systemd/system/getty@.service /mnt/etc/systemd/system/autologin@.service; + + # (2) Create link in order to be handled # + echo " (.) Create script link to be handled"; + sudo ln -s /mnt/etc/systemd/system/autologin@.service /mnt/etc/systemd/system/getty.target.wants/getty@tty1.service; + + # (3) Update autologin script # + echo " (.) Update script to autologin as 'sats-user'"; + sudo cat /mnt/etc/systemd/system/autologin@.service | \ + sed 's/^ExecStart=-\/sbin\/agetty --noclear/ExecStart=-\/sbin\/agetty --autologin sats-user/' | \ + sed 's/^Restart=.\+$/Restart=no/' | \ + sed 's/^Restart=.\+$/Restart=no/' | \ + tee ./autologin.tmp > /dev/null; + + # Add 'Alias` instruction # + echo "Alias=getty.target.wants/getty@tty1.service" > ./autologin.tmp; + + # (4) Updating file from tmp update # + echo " (.) Copying temporary update to real file"; + cat ./autologin.tmp | sudo tee /mnt/etc/systemd/system/autologin@.service > /dev/null; + rm ./autologin.tmp; + + echo "<<< done"; + + step9; +} + + + + + +# [9] Manage Network config #========================================================# @@ -207,6 +244,7 @@ echo "(4) Mount / partition"; echo "(5) Update users"; echo "(6) Update groups"; echo "(7) Manage ssh keys"; +echo "(8) Set up automatic sats-user login"; read -p "step: " step; case $step in @@ -217,5 +255,6 @@ case $step in "5") step5;; "6") step6;; "7") step7;; + "8") step8;; *) echo "wrong step"; exit;; esac;