From c8591f83f386d967a1a90f4e73a7b6dc16eab977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Abonnel?= Date: Wed, 1 Jun 2022 18:26:18 +0000 Subject: [PATCH] Add new file --- firstrun.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 firstrun.sh diff --git a/firstrun.sh b/firstrun.sh new file mode 100644 index 0000000..3a7925d --- /dev/null +++ b/firstrun.sh @@ -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