diff options
Diffstat (limited to 'bin/yoda')
| -rwxr-xr-x | bin/yoda | 51 |
1 files changed, 48 insertions, 3 deletions
@@ -22,6 +22,7 @@ options: -F format root filesystem without journal (USB-Flash) -H host set hostnanme to host -S steps skips some steps (i.e. -S 02 to avoid crypt) +-u user create user login and transfer ssh credentials -V print version ' } @@ -135,12 +136,53 @@ EOT echo 'LANG=en_US.UTF-8' > /mnt/etc/locale.conf ln -sf /usr/share/zoneinfo/Europe/Paris /mnt/etc/localtime - arch-chroot /mnt << \EOT + cat > /mnt/etc/systemd/network/20-wired.network << \EOT +[Match] +Name=e* + +[Network] +DHCP=ipv4 + +[DHCP] +RouteMetric=10 +EOT + + cat > /mnt/etc/systemd/network/25-wireless.network << \EOT +[Match] +Name=wl* + +[Network] +DHCP=ipv4 + +[DHCP] +RouteMetric=20 +EOT + + cat > /mnt/etc/systemd/resolved.conf << \EOT +[Resolve] +DNSSEC=no +EOT + + packages="linux linux-firmware vi wireless_tools wpa_supplicant openssh arch-install-scripts" + + arch-chroot /mnt << EOT locale-gen -pacman --noconfirm -S linux linux-firmware vi wireless_tools wpa_supplicant +pacman --noconfirm -S $packages +systemctl enable systemd-networkd +systemctl enable systemd-resolved +systemctl enable wpa_supplicant@wlan0 +systemctl enable sshd bootctl --path=/boot install EOT + cp "$myself" /mnt/usr/bin/yoda + if [ "$user" ]; then + useradd -R /mnt -m "$user" + cp -a /home/$user/.ssh /mnt/home/$user/.ssh + fi + + cat /etc/wpa_supplicant/wpa_supplicant*.conf > /mnt/etc/wpa_supplicant/wpa_supplicant-wlan0.conf + cat > /mnt/boot/loader/loader.conf << \EOT default arch timeout 4 @@ -170,12 +212,14 @@ cleanup() { } # Main -while getopts :CFH:S:V opt; do +toskip='02' +while getopts :CFH:S:u:V opt; do case $opt in (C) crypto=1 ;; (F) flash=1 ;; (H) hostname=$OPTARG ;; (S) toskip="$toskip$OPTARG" ;; + (u) user=$OPTARG;; (V) echo $version && exit ;; (*) help; exit 1 ;; esac @@ -186,6 +230,7 @@ shift $((OPTIND - 1)) [ "$1" ] && dev=$1 || die 'no device' par=${dev##*/}root rootpart="${dev}2" +myself=$(type -p $0) echo -n "Device $dev will be completely erased. Continue ? Y/N " read -r resp && [ "$resp" = 'Y' ] || exit |
