Managed autologin #1 (but not working)

This commit is contained in:
xdrm-brackets 2017-01-21 13:34:58 +01:00
parent 747eb90df1
commit 57442f6464
1 changed files with 40 additions and 1 deletions

View File

@ -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;