9 ssh_key
="$HOME/.ssh/raspi"
10 iso
="/mnt/4tb/os/raspberry/ArchLinuxARM-rpi-latest.tar.gz"
12 if [[ ! -f "$iso" ]]; then
14 echo "select other iso or download"
15 # wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
19 # select from unmouted
24 echo -e "o\nn\np\n+100M\nt\nc\nn\np\nw\n" | fdisk
/dev
/$disk
26 sudo mkfs.vfat
/dev
/$disk'1'
27 sudo mkfs.ext4
/dev
/$disk'2'
30 sudo mount
/dev
/$disk'1' /tmp
/boot
/
31 sudo mount
/dev
/$disk'2' /tmp
/root
/
32 bsdtar
-xpf $iso -C /tmp
/root
33 mv /tmp
/root
/boot
/* /tmp
/boot
/
35 echo "disable.overscan=1" > /tmp
/boot
/config.txt
37 ln -s /usr
/lib
/systemd
/system
/dhcpcd@.service
/tmp
/root
/etc
/systemd
/system
/multi-user.target.wants
/dhcpcd@wlan0.service
38 ln -s /usr
/share
/dhcpcd
/hooks
/10-wpa_supplicant /tmp
/root
/usr
/lib
/dhcpcd
/dhcpcd-hooks
/
39 echo "ctrl_interface=DIR=/var/run/wpa_supplicant" > /tmp
/root
/etc
/wpa_supplicant
/wpa_supplicant-wlan0.conf
40 wpa_passphrase
"${ssid}" "${pass}" >> /tmp
/root
/etc
/wpa_supplicant
/wpa_supplicant-wlan0.conf
41 vim
/tmp
/root
/etc
/wpa_supplicant
/wpa_supplicant-wlan0.conf
# known bug (check pass)
43 mkdir
/tmp
/root
/root
/.
ssh
44 chmod 0700 /tmp
/root
/root
/.
ssh
45 cat "$ssh_key" > /tmp
/root
/root
/.ssh
/authorized_keys
46 chmod 0600 /tmp
/root
/root
/.ssh
/authorized_keys
47 echo -e "# Raspberry pi\nHost $ip\nIdentityFile $ssh_key"> ~
/.ssh
/config
48 sudo umount
/tmp
/boot
/tmp
/root
51 ssh root@
$ip -i "$ssh_key"
54 pacman-key
--populate archlinuxarm
56 useradd
-m -g users
-s /bin
/bash
$new_user
58 echo "$new_user ALL=(ALL) ALL" >> /etc
/sudoers
60 new_user_h
="/home/$new_user"
61 mkdir
$new_user_h/.
ssh
62 cp .ssh
/authorized_keys
$new_user_h/.
ssh
63 chown
$new_user $new_user_h/.ssh
/authorized_keys
64 chmod 700 $new_user_h/.ssh
/authorized_keys
66 pacman
-S --needed - < .
scripts
/pacman_arm.txt
67 systemctl
enable nginx
68 systemctl
enable cronie
70 systemctl start cronie