33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#/bin/sh
|
|
|
|
RASPIOS_IMG=2022-04-04-raspios-bullseye-arm64-lite.img
|
|
|
|
echo "Fetching image"
|
|
curl -O https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-04-07/2022-04-04-raspios-bullseye-arm64-lite.img.xz
|
|
|
|
echo "Uncompressing image"
|
|
unxz $RASPIOS_IMG.xz
|
|
|
|
OFFSET_IMG=$(file $RASPIOS_IMG | cut -d';' -f3 | cut -d',' -f8 | cut -d' ' -f3)
|
|
|
|
mkdir -p mnt
|
|
|
|
echo "Mounting second partition"
|
|
mount $RASPIOS_IMG -o offset=$((512*$OFFSET_IMG)) mnt
|
|
|
|
echo "Chroot into partition to start edition"
|
|
chroot mnt /bin/sh <<"EOT"
|
|
|
|
usermod -l creator pi
|
|
usermod -d /home/creator -m creator
|
|
sudo -u creator mkdir -p -m 700 /home/creator/.ssh
|
|
sudo -u creator sh -c 'echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDYsz4jdyzf9UcJ8eEavVmi+DNYE3ioeJBfTlVMw7Vsb tanguy@Diogenes" > /home/creator/.ssh/authorized_keys'
|
|
chmod 600 /home/creator/.ssh/authorized_keys
|
|
sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
|
|
systemctl enable ssh
|
|
echo "kenoma" > /etc/hostname
|
|
EOT
|
|
|
|
umount mnt
|
|
xz $RASPIOS_IMG
|