Add new file

This commit is contained in:
Cédric Abonnel 2022-06-01 18:26:18 +00:00
parent b86a3267c1
commit c8591f83f3
1 changed files with 27 additions and 0 deletions

27
firstrun.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set +e
CURRENT_HOSTNAME=`cat /etc/hostname | tr -d " \t\n\r"`
echo rpibooth >/etc/hostname
sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\trpibooth/g" /etc/hosts
FIRSTUSER=`getent passwd 1000 | cut -d: -f1`
FIRSTUSERHOME=`getent passwd 1000 | cut -d: -f6`
install -o "$FIRSTUSER" -m 700 -d "$FIRSTUSERHOME/.ssh"
install -o "$FIRSTUSER" -m 600 <(printf "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQDCVxACo2PA3AV9ALBwt7m0U5TgL1h5Fb8qlgJFfVjUnqyTxXyEnd7NKA5BvUV2xxLY/xEfamJ3T5h6HQBXckdrsdfUZxY/KFxtVkX05YZTQVnKPGlyOE3VWLhWQg5B9Q6Rv32Cb5c7nOJCr2zRnRha1UNHEEpWjEucP+C45vQhU+Ag1+dIZIUszvmfO3uNdM7NoZPlm5jGvbsZqaqO4Clk2Ysdf594SuCkfH6BT+8yLS8qM7dYdLDJKQCQY2icZRq5L6myLJNIlv cedric@localhost.localdomain") "$FIRSTUSERHOME/.ssh/authorized_keys"
echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config
systemctl enable ssh
rm -f /etc/localtime
echo "Europe/Paris" >/etc/timezone
dpkg-reconfigure -f noninteractive tzdata
cat >/etc/default/keyboard <<'KBEOF'
XKBMODEL="pc105"
XKBLAYOUT="fr"
XKBVARIANT=""
XKBOPTIONS=""
KBEOF
dpkg-reconfigure -f noninteractive keyboard-configuration
rm -f /boot/firstrun.sh
sed -i 's| systemd.run.*||g' /boot/cmdline.txt
exit 0