#!/bin/bash set +e FIRSTUSER=`getent passwd 1000 | cut -d: -f1` FIRSTUSERHOME=`getent passwd 1000 | cut -d: -f6` if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then /usr/lib/raspberrypi-sys-mods/imager_custom enable_ssh else systemctl enable ssh fi if [ -f /usr/lib/userconf-pi/userconf ]; then /usr/lib/userconf-pi/userconf 'pi' '$5$nI92OMl4c.CLlr5D$3t8fHwPV3R0.DyayqWgz.n8HTc.UE6MQTRWZL1ufVW2' else echo "$FIRSTUSER:"'$5$nI92OMl4c.CLlr5D$3t8fHwPV3R0.DyayqWgz.n8HTc.UE6MQTRWZL1ufVW2' | chpasswd -e if [ "$FIRSTUSER" != "pi" ]; then usermod -l "pi" "$FIRSTUSER" usermod -m -d "/home/pi" "pi" groupmod -n "pi" "$FIRSTUSER" if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/autologin-user=pi/" fi if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then sed /etc/systemd/system/getty@tty1.service.d/autologin.conf -i -e "s/$FIRSTUSER/pi/" fi if [ -f /etc/sudoers.d/010_pi-nopasswd ]; then sed -i "s/^$FIRSTUSER /pi /" /etc/sudoers.d/010_pi-nopasswd fi fi fi if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then /usr/lib/raspberrypi-sys-mods/imager_custom set_wlan 'SSID_TEST' '0c1faf2119bbafcaa4cbd97ba674727951b3ae958317178e4655fa1298a3b24c' 'JP' else cat >/etc/wpa_supplicant/wpa_supplicant.conf <<'WPAEOF' country=JP ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev ap_scan=1 update_config=1 network={ ssid="SSID_TEST" psk=0c1faf2119bbafcaa4cbd97ba674727951b3ae958317178e4655fa1298a3b24c } WPAEOF chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf rfkill unblock wifi for filename in /var/lib/systemd/rfkill/*:wlan ; do echo 0 > $filename done fi if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then /usr/lib/raspberrypi-sys-mods/imager_custom set_keymap 'jp' /usr/lib/raspberrypi-sys-mods/imager_custom set_timezone 'Asia/Tokyo' else rm -f /etc/localtime echo "Asia/Tokyo" >/etc/timezone dpkg-reconfigure -f noninteractive tzdata cat >/etc/default/keyboard <<'KBEOF' XKBMODEL="pc105" XKBLAYOUT="jp" XKBVARIANT="" XKBOPTIONS="" KBEOF dpkg-reconfigure -f noninteractive keyboard-configuration fi rm -f /boot/firstrun.sh sed -i 's| systemd.run.*||g' /boot/cmdline.txt exit 0