├── README.md ├── fix_libarchive.sh ├── functions ├── functionCheckForImage.sh ├── functionCleanup.sh ├── functionDisableSystemctlServices.sh ├── functionDisableSystemdServices.sh ├── functionFindSource.sh ├── functionFormatDisk.sh ├── functionHandleFileCache.sh ├── functionLocalVsDownload.sh ├── functionNetAccpCredentials.sh ├── functionNetDualIpType.sh ├── functionNetHostName.sh ├── functionNetIpEthernetStatic.sh ├── functionNetIpWifiDynamic.sh ├── functionNetIpWifiStatic.sh ├── functionNetNetworkType.sh ├── functionNetSingleIpType.sh ├── functionRootCheck.sh ├── functionRootPassword.sh ├── functionSelectArmVersion.sh ├── functionShowConfig.sh ├── functionSystemPreConfiguration.sh ├── functionsNetworkProfileSelection.sh ├── masterFunctions.sh └── masterVariables.sh ├── images ├── arch_pizero_docker_logo.png └── rpi_arm_banner.png ├── installer.sh ├── networking ├── eth0 ├── netctl@eth0.service ├── netctl@wlan0.service ├── wlan0 └── wlan0.network ├── packages ├── b43-fwcutter-019-1-armv6h.pkg.tar.xz ├── libnl-3.2.26-1-armv6h.pkg.tar.xz ├── libnl-3.4.0-1-aarch64.pkg.tar.xz ├── libnl-3.4.0-1-armv6h.pkg.tar.xz ├── libnl-3.4.0-1-armv7h.pkg.tar.xz ├── libnl_wpa_package.tar.gz └── wpa_supplicant-1&%2.3-1-armv6h.pkg.tar.xz └── sources ├── ArchLinuxARM-rpi-2-latest.tar.gz.md5 ├── ArchLinuxARM-rpi-latest.tar.gz.md5 ├── configure-system.sh ├── eth0.network └── wlan0.network /README.md: -------------------------------------------------------------------------------- 1 | # Create an Arch Linux ARM (Raspberry Pi - All versions) microSD Card image. 2 | 3 | ![Raspberry Pi and Arch Linux ARM](/images/rpi_arm_banner.png) 4 | 5 | For some reason the Arch Linux community stopped providing an pre-build image for the Raspberry Pi. 6 | However they provide instructions how to build an Arch Linux ARM "image" on the projects website @ (http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2) however it's still a lot of work to build the image, and no automate options are available like wifi configuration etc. 7 | 8 | To make things simple I've created a little script to automate some of the steps. 9 | 10 | ## What does this script do? 11 | Here's what it does? 12 | - It will partition the microSD card (one 100MB boot partition and a root partition that consumes the rest of the space) NOTE: it will wipe/remove all data on the SD card!!. 13 | - It will download the correct version of the Arch Linux ARM image (v6, v7 and when available the v8 version) 14 | - It extract the image to the microSD card 15 | - It sets the GPU memory from 64MB to 16MB (so you have more memory available your apps, assume you don't need a desktop) 16 | - It fixes the rotation issue with the Raspberry Pi 7" screen, check https://github.com/remonlam/rpi-touch-display-fix 17 | - Installs/extracts "libnl" and "wpa" packages 18 | - Copy eth0/wlan0 configuration files and create a netctl service for eth0/wlan0 19 | - Enable root access trough SSH 20 | - Sets the hostname 21 | 22 | What it won't do! 23 | - Assume the correct drive name for the microSD card, that's up to you!!! 24 | 25 | ## SD Card Creation 26 | Replace sdX in the following instructions with the device name for the SD card as it appears on your computer. 27 | 28 | ## Questions 29 | This script will ask you a couple of things; 30 | - ARM version, this will be either version 6 (all versions except RPI 2B) or version 7 (RPI 2B only). 31 | - Device name of the microSD card, this could be /dev/sdb, so you need to enter "sdb". 32 | - Hostname, sounds obvious :-) 33 | - WiFi access point name 34 | - WiFI password (PSK) 35 | 36 | ## Usage 37 | Clone the repo using git like this: 38 | Execute: ```git clone https://github.com/remonlam/rpi-arch-builder.git``` 39 | Then browse to ```cd ./rpi-arch-builder/``` and execute the script like ```sudo ./install.sh``` 40 | 41 | ## Can't get it to work? 42 | Well the script have some dependencies that needs to be in-place in order get it working. 43 | To make things a bit more simple, I have tested it on an CentOS 7 Live [moving to Debian] distro, so it should work on this version of CentOS [moving to Debian]. 44 | 45 | ## Why this script? 46 | This repo contains everything that is needed to create a Arch Linux ARM image for the Raspberry Pi (any Pi version that contains an ARM version 6, 7 or 8). 47 | 48 | Why I created this script? Because it's kinda easy to write the image to a microSD card your self! 49 | That's true but with the Pi Zero that's not as easy as with the other Pi models, because the Pi Zero only have on micro USB connector that's in use for WiFi it's not that easy to put a keyboard to the Pi Zero. 50 | For that reason I created this script that make the Pi Zero headless, it will connect to you're WiFi network and setup root access with SSH, so you don't need to attached a KVM to the Pi. 51 | 52 | That's all for now ;-) 53 | -------------------------------------------------------------------------------- /fix_libarchive.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | wget https://www.libarchive.org/downloads/libarchive-3.3.1.tar.gz 4 | tar xzf libarchive-3.3.1.tar.gz 5 | cd libarchive-3.3.1 6 | ./configure 7 | make 8 | sudo make install 9 | -------------------------------------------------------------------------------- /functions/functionCheckForImage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will check if the Arch Linux image is present on the disk 5 | function functionCheckForImage { 6 | FILE="ArchLinuxARM-rpi-latest.tar.gz" 7 | if [ -f "$FILE" ]; 8 | then 9 | echo "File $FILE exist." 10 | else 11 | echo "File $FILE does not exist" >&2 12 | fi 13 | } 14 | -------------------------------------------------------------------------------- /functions/functionCleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function unmount disk and cleanup /temp/. 5 | ### 6 | function functionCleanup { 7 | ### UNMOUNT DISK & CLEANUP 8 | echo "#########################################################################" 9 | echo "Unmount disks and cleanup /temp directory" 10 | echo "#########################################################################" 11 | # Do a final sync, and wait 5 seconds before unmouting 12 | sync 13 | echo "Wait 5 seconds before unmouting 'boot' and 'root' mount points" 14 | sleep 5 15 | 16 | #Unmount the boot and root partitions: 17 | umount /temp/boot /temp/root 18 | echo "Unmount completed, it's safe to remove the microSD card!" 19 | 20 | # Removing data sources 21 | echo "Remove datasources, waiting until mount points are removed" 22 | sleep 5 23 | rm -rf /temp/ 24 | echo "All files in /temp/ are removed!" 25 | echo "#########################################################################" 26 | } 27 | 28 | # Remove armversion 29 | rm ../armversion 30 | -------------------------------------------------------------------------------- /functions/functionDisableSystemctlServices.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will remove the SystemctlNetwork and SystemctlDNS services - 5 | ### to prevent DHCP from kicking in during boot and make DNS to point to the - 6 | ### configured addresses. 7 | function functionDisableSystemctlServices { 8 | # Remove SystemctlNetwork 9 | rm /temp/root/etc/systemctl/../../../ 10 | 11 | # Remove Systemctl-DNS 12 | rm /temp/root/etc/systemctl/../../../ 13 | } 14 | -------------------------------------------------------------------------------- /functions/functionDisableSystemdServices.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will remove the SystemctlNetwork and SystemctlDNS services - 5 | ### to prevent DHCP from kicking in during boot and make DNS to point to the - 6 | ### configured addresses. 7 | function functionDisableSystemdServices { 8 | # Remove systemd-networkd & systemd-resolved 9 | rm -rf /temp/root/etc/systemd/system/multi-user.target.wants/systemd-networkd.service 10 | rm -rf /temp/root/etc/systemd/system/multi-user.target.wants/systemd-resolved.service 11 | rm -rf /temp/root/etc/systemd/system/socket.target.wants/systemd-resolved.socket 12 | 13 | # Remove old resolv.conf 14 | rm -rf /etc/resolv.conf 15 | 16 | # Create new resolv.conf file 17 | if [ "$varNetworkType" = "WIFI" ]; then 18 | echo "Setup Fixed IP settings for: ##" 19 | echo "#########################################################################" 20 | echo -e "search $dnsSearch\nnameserver $wifiDns1\nnameserver $wifiDns2" > /etc/resolv.conf 21 | elif [ "$varNetworkType" = "ETH" ]; then 22 | echo "Setup Fixed IP settings for: ##" 23 | echo "#########################################################################" 24 | echo -e "search $dnsSearch\nnameserver $ethernetDns1\nnameserver $ethernetDns2" > /etc/resolv.conf 25 | elif [ "$varNetworkType" = "DUAL" ]; then 26 | echo "Setup Fixed IP settings for: ##" 27 | echo "#########################################################################" 28 | echo -e "search $dnsSearch\nnameserver $ethernetDns1\nnameserver $ethernetDns2" > /etc/resolv.conf 29 | fi 30 | #fi 31 | } 32 | -------------------------------------------------------------------------------- /functions/functionFindSource.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create function call disabled for now. 4 | function functionFindSource { 5 | . ./functions/functionLocalVsDownload.sh 6 | echo "Mounting an ISO?" 7 | read -p "Enter full location path to source file (to skip this just press ENTER): " FILE 8 | if [ -f "$FILE" ]; 9 | then 10 | echo "File $FILE exist." 11 | varCheckForLocalSource="TRUE" 12 | #md5 -q $FILE 13 | echo "File found..." 14 | echo $varCheckForLocalSource 15 | functionLocalVsDownload 16 | else 17 | echo "File $FILE does not exist" >&2 18 | varCheckForLocalSource="FALSE" 19 | echo "File not found..." 20 | echo $varCheckForLocalSource 21 | functionLocalVsDownload 22 | fi 23 | } 24 | -------------------------------------------------------------------------------- /functions/functionFormatDisk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will format the disk, create new partitions / filesystem - 5 | ### Mount it to /temp/boot & /temp/root. 6 | function functionFormatDisk { 7 | echo "################################################################################" 8 | echo "# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING #" 9 | echo "# #" 10 | echo "# This script will remove any data on the disk that will be entered bellow!! #" 11 | echo "# Make sure that you entered the correct drive!! #" 12 | echo "# #" 13 | echo "################################################################################" 14 | read -p 'Enter device name (SD-Card): like sdX: ' sdCard 15 | 16 | echo "Are you sure that device '$sdCard' can be used, all data will be removed!!" 17 | echo "####################################################################################" 18 | select yn in "Yes" "No"; do 19 | case $yn in 20 | Yes ) echo; break;; 21 | No ) exit;; 22 | esac 23 | done 24 | echo "Removing all data from disk: '$sdCard'" 25 | echo "####################################################################################" 26 | 27 | # Set fixed variables 28 | part1=p1 29 | part2=p2 30 | 31 | # Unmount partitions 32 | { 33 | sudo umount /dev/$sdCard$part1 34 | sudo umount /dev/$sdCard$part2 35 | } &> /dev/null 36 | 37 | # Remove each partition 38 | for partition in $(parted -s /dev/$sdCard print|awk '/^ / {print $1}') 39 | do 40 | parted -s /dev/$sdCard rm ${partition} 41 | done 42 | { 43 | dd if=/dev/zero of=/dev/$sdCard bs=105M count=1 44 | } &> /dev/null 45 | echo "Device '$sdCard' has been successfully partitioned" 46 | echo "####################################################################################" 47 | echo "" 48 | echo "" 49 | 50 | # Partition DISK 51 | echo "#########################################################################" 52 | echo "Create parition layout on '$sdCard'" 53 | echo "#########################################################################" 54 | echo "Create new parition layout on '$sdCard'" 55 | # NOTE: This will create a partition layout as beeing described in the README... 56 | { 57 | (echo o; echo n; echo p; echo 1; echo ; echo +100M; echo t; echo c; echo n; echo p; echo 2; echo ; echo ; echo w) | fdisk /dev/$sdCard 58 | # Sync disk 59 | sync 60 | } &> /dev/null 61 | echo "#########################################################################" 62 | echo "" 63 | echo "" 64 | 65 | # Create new filesystem & mount it to /temp/* 66 | echo "#########################################################################" 67 | echo "Create temporary mount point for 'root' and 'boot'" 68 | echo "#########################################################################" 69 | echo "Create and mount the FAT filesystem on '$sdCard"1"'" 70 | { 71 | sleep 10 72 | sudo mkfs.vfat /dev/$sdCard"1" 73 | sleep 5 74 | mkdir -p /temp/boot # make a variable of this mountpint $mount_boot 75 | mount /dev/$sdCard"1" $mount_boot 76 | } &> /dev/null 77 | echo "" 78 | 79 | echo "Create and mount the ext4 filesystem on '$sdCard"2"'" 80 | { 81 | sudo mkfs -t ext4 /dev/$sdCard"2" 82 | mkdir -p /temp/root 83 | mount /dev/$sdCard"2" $mount_root # make a variable of this mountpint $mount_root 84 | } &> /dev/null 85 | echo "#########################################################################" 86 | echo "" 87 | echo "" 88 | } 89 | -------------------------------------------------------------------------------- /functions/functionHandleFileCache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################################################### 3 | ### NOTE: This function will download an Arch ARM Version if necessary, and extract it to 4 | ### the temporary folder 5 | function functionHandleFileCache { 6 | echo "Downloading $2 Checksum" 7 | CHECKSUM="`wget -qO- http://os.archlinuxarm.org/os/$1.md5 | awk '{ print $1 }'`" 8 | DOWNLOADPATH="./downloads/$1/$1" 9 | DOWNLOADED=false 10 | echo "Checking Download Cache For $2" 11 | if [ -e "$DOWNLOADPATH" ]; then 12 | echo "File Already Downloaded... Checking Checksum" 13 | DOWNLOADEDCHECKSUM="`md5sum ${DOWNLOADPATH} | awk '{ print $1 }'`" 14 | 15 | if [[ "$CHECKSUM" = "$DOWNLOADEDCHECKSUM" ]]; then 16 | echo "Valid cached image found"; 17 | DOWNLOADED=true 18 | else 19 | echo "Downloaded file DOES NOT match latest checksum." 20 | echo "This could be because of corruption or an older version" 21 | while true; do 22 | read -p "Would you like to download a fresh version? " yn 23 | case $yn in 24 | [Yy]* ) break;; 25 | [Nn]* ) DOWNLOADED=true; break;; 26 | * ) echo "Please answer yes or no.";; 27 | esac 28 | done 29 | fi 30 | fi 31 | 32 | if [ "$DOWNLOADED" = false ] ; then 33 | echo "Downloading $2..." 34 | wget -P ./downloads/$1 http://archlinuxarm.org/os/$1 35 | echo "Download complete" 36 | fi 37 | 38 | echo "Expanding image to root, this may take a few minutes." 39 | { 40 | bsdtar -xpf "./downloads/$1/$1" -C /temp/root 41 | sync 42 | } #&> /dev/null 43 | } 44 | -------------------------------------------------------------------------------- /functions/functionLocalVsDownload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function functionLocalVsDownload { 4 | if [ "$varCheckForLocalSource" = "TRUE" ]; then 5 | echo "Using local ISO source, no download required..." 6 | echo "#########################################################################" 7 | echo "Download complete, expanding image to root" 8 | { 9 | bsdtar -xpf $FILE -C /temp/root 10 | sync 11 | #Move boot files to the first partition: 12 | cp -r /temp/root/boot/* /temp/boot 13 | rm -rf /temp/root/boot 14 | } &> /dev/null 15 | 16 | echo "#########################################################################" 17 | echo "" 18 | echo "" 19 | elif [ "$varCheckForLocalSource" = "FALSE" ]; then 20 | echo "No local ISO source found, download is required :-( " 21 | echo "#########################################################################" 22 | functionSelectArmVersion 23 | fi 24 | } 25 | -------------------------------------------------------------------------------- /functions/functionNetAccpCredentials.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for the accespoint credentials and write it - 5 | ### back as a variable. 6 | ### It will write back the values to the corresponding netctl configuration files. 7 | function functionNetAccpCredentials { 8 | echo "####################################################################################" 9 | echo "Enter the credentials for your accesspoint" 10 | echo "####################################################################################" 11 | read -p 'Enter wifi name (Accesspoint): ' wifiAp 12 | read -p 'Enter wifi password: ' wifiKey 13 | 14 | echo "Prepping WiFi netctl config files" 15 | sed -i "s/ESSID='SSID-NAME'/ESSID='$wifiAp'/" /temp/root/etc/netctl/wlan0 16 | sed -i "s/Key='SSID-KEY'/Key='$wifiKey'/" /temp/root/etc/netctl/wlan0 17 | } 18 | -------------------------------------------------------------------------------- /functions/functionNetDualIpType.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for DHCP or Static IP configuraton and write - 5 | ### it back as a variable. 6 | ### 7 | ### NOTE: This function is used when a user want's to use both WiFi and Ethernet. 8 | function functionNetDualIpType { 9 | echo "###########################################################################################" 10 | echo "Both WiFI and Ethernet needs to be configurd, please select the required IP configuration;" 11 | echo "###########################################################################################" 12 | select yn in "WiFi: DHCP & Eth: DHCP" "WiFi: DHCP & Eth: Static" "WiFi: Static & Eth: DHCP" "WiFi: Static & Eth: Static" "Exit"; do 13 | case $yn in 14 | 'WiFi: DHCP & Eth: DHCP' ) varIpType="$varNetworkType-DHCP_DHCP"; break;; 15 | 'WiFi: DHCP & Eth: Static' ) varIpType="$varNetworkType-DHCP_STATIC"; break;; 16 | 'WiFi: Static & Eth: DHCP' ) varIpType="$varNetworkType-STATIC_DHCP"; break;; 17 | 'WiFi: Static & Eth: Static' ) varIpType="$varNetworkType-STATIC_STATIC"; break;; 18 | 'Exit' ) exit 1; break;; 19 | esac 20 | done 21 | } 22 | -------------------------------------------------------------------------------- /functions/functionNetHostName.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for a hostname and write it back as a variable. 5 | function functionNetHostName { 6 | echo "####################################################################################" 7 | echo "Enter a hostname only, do no include a domain name!;" 8 | echo "####################################################################################" 9 | read -p 'Enter a hostname: ' varHostName 10 | 11 | # Change hostname 12 | sed -i 's/alarmpi/'$varHostName'/' /temp/root/etc/hostname 13 | } 14 | -------------------------------------------------------------------------------- /functions/functionNetIpEthernetStatic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for Static IP configuration and write - 5 | ### it back as a variable. 6 | ### 7 | ### NOTE: This function is used only for Ethernet 8 | function functionNetIpEthernetStatic { 9 | echo "Setup Fixed IP settings for Ethernet: $varIpType" 10 | echo "#########################################################################" 11 | read -p 'Enter IP Address: ' ethernetIp 12 | read -p 'Enter IP Subnet, example: 24: ' ethernetMask 13 | read -p 'Enter Gateway: ' ethernetGateway 14 | read -p 'Enter DNS 1: ' ethernetDns1 15 | read -p 'Enter DNS 2: ' ethernetDns2 16 | read -p 'Enter DNS Search domain: ' dnsSearch 17 | 18 | # Downloading netctl template files 19 | { 20 | # Copy netctl eth0 config file 21 | cp -rf sources/eth0.network /temp/root/etc/systemd/network/ 22 | #cp -rf /temp/netctl@eth0.service /temp/root/etc/systemd/system/ 23 | # Copy wlan0.service file to systemd and create symlink to make it work at first boot 24 | cp -rf sources/wlan0.network /temp/root/etc/systemd/network/ 25 | #cp -rf /temp/netctl@eth0.service /temp/root/etc/systemd/system/ 26 | #ln -s '/temp/root/etc/systemd/system/netctl@eth0.service' '/temp/root/etc/systemd/system/multi-user.target.wants/netctl@eth0.service' 27 | } &> /dev/null 28 | 29 | # Prepping Ethernet configuration files 30 | echo "Prepping Ethernet netctl config files" 31 | sed -i "s/NETIP/$ethernetIp/" /temp/root/etc/systemd/network/eth0.network 32 | sed -i "s/NETSUB/$ethernetMask/" /temp/root/etc/systemd/network/eth0.network 33 | sed -i "s/NETGW/$ethernetGateway/" /temp/root/etc/systemd/network/eth0.network 34 | sed -i "s/NETDNS1/$ethernetDns1/" /temp/root/etc/systemd/network/eth0.network 35 | sed -i "s/NETDNS2/$ethernetDns2/" /temp/root/etc/systemd/network/eth0.network 36 | 37 | # Remove "systemd-networkd.service" 38 | rm -rf /temp/root/etc/systemd/network/eth.network 39 | #rm -rf /temp/root/etc/systemd/system/multi-user.target.wants/systemd-networkd.service 40 | #rm -rf /temp/root/etc/systemd/system/socket.target.wants/systemd-networkd.service 41 | } 42 | 43 | 44 | ##### TEMP STUFF 45 | #/etc/systemd/network/eth0.network 46 | 47 | #Address=IPSUB 48 | #Gateway=GW 49 | #DNS=8.8.8.8 50 | #DNS=8.8.4.4 51 | -------------------------------------------------------------------------------- /functions/functionNetIpWifiDynamic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will write netctl configuration files when using WiFi. 5 | ### 6 | ### NOTE: This function is used only for Wifi 7 | function functionNetIpWifiDynamic { 8 | echo "Setup Dynamic IP settings for: $varIpType" 9 | echo "#########################################################################" 10 | 11 | # libnl platform select 12 | source ./armversion 13 | PLATFORM=FALSE 14 | if [ $armversion = 6 ]; then 15 | PLATFORM="armv6h" 16 | elif [ $armversion = 7 ]; then 17 | PLATFORM="armv7h" 18 | elif [ $armversion = 8 ]; then 19 | PLATFORM="aarch64" 20 | fi 21 | 22 | echo "The platform is $PLATFORM." 23 | rm ./armversion 24 | # Downloading netctl template files and wpa packages 25 | { 26 | # Download "libnl" and "wpa_supplicant" package tar.gz file from GitHub 27 | cp -rf packages/libnl-3.4.0-1-${PLATFORM}.pkg.tar.xz /temp/ 28 | # Extract tar.gz file to root/ 29 | tar -xf /temp/libnl-3.4.0-1-${PLATFORM}.pkg.tar.xz -C /temp/root/ 30 | # Copy netctl wlan0 config file 31 | wget -P /temp/ https://raw.githubusercontent.com/remonlam/rpi-zero-arch/master/networking/wlan0 32 | cp -rf /temp/wlan0 /temp/root/etc/netctl/ 33 | # Copy wlan0.service file to systemd and create symlink to make it work at first boot 34 | wget -P /temp/ https://raw.githubusercontent.com/remonlam/rpi-zero-arch/master/networking/netctl%40wlan0.service 35 | cp -rf /temp/netctl@wlan0.service /temp/root/etc/systemd/system/ 36 | ln -s '/temp/root/etc/systemd/system/netctl@wlan0.service' '/temp/root/etc/systemd/system/multi-user.target.wants/netctl@wlan0.service' 37 | } &> /dev/null 38 | } 39 | -------------------------------------------------------------------------------- /functions/functionNetIpWifiStatic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for Static IP configuration and write - 5 | ### it back as a variable. 6 | ### 7 | ### NOTE: This function is used only for WiFi 8 | function functionNetIpWifiStatic { 9 | echo "Setup Fixed IP settings for WiFi: $varIpType" 10 | echo "#########################################################################" 11 | read -p 'Enter IP Address: ' wifiIp 12 | read -p 'Enter IP Subnet, example: 24: ' wifiMask 13 | read -p 'Enter Gateway: ' wifiGateway 14 | read -p 'Enter DNS 1: ' wifiDns1 15 | read -p 'Enter DNS 2: ' wifiDns2 16 | read -p 'Enter DNS Search domain: ' dnsSearch 17 | 18 | # Downloading netctl template files and wpa packages 19 | { 20 | # Download "libnl" and "wpa_supplicant" package tar.gz file from GitHub 21 | wget -P /temp/ https://github.com/remonlam/rpi-zero-arch/raw/master/packages/libnl_wpa_package.tar.gz 22 | # Extract tar.gz file to root/ 23 | tar -xf /temp/libnl_wpa_package.tar.gz -C /temp/root/ 24 | # Copy netctl wlan0 config file 25 | wget -P /temp/ https://raw.githubusercontent.com/remonlam/rpi-zero-arch/master/networking/wlan0 26 | cp -rf /temp/wlan0 /temp/root/etc/netctl/ 27 | # Copy wlan0.service file to systemd and create symlink to make it work at first boot 28 | wget -P /temp/ https://raw.githubusercontent.com/remonlam/rpi-zero-arch/master/networking/netctl%40wlan0.service 29 | cp -rf /temp/netctl@wlan0.service /temp/root/etc/systemd/system/ 30 | ln -s '/temp/root/etc/systemd/system/netctl@wlan0.service' '/temp/root/etc/systemd/system/multi-user.target.wants/netctl@wlan0.service' 31 | } &> /dev/null 32 | 33 | # Prepping Ethernet configuration files 34 | echo "Prepping WiFi netctl config files" 35 | sed -i "s/IP=dhcp/IP=static/" /temp/root/etc/netctl/wlan0 36 | sed -i "/IP=static/ a Address=('$wifiIp/$wifiMask')" /temp/root/etc/netctl/wlan0 37 | sed -i "/Address=/ a Gateway=('$wifiGateway')" /temp/root/etc/netctl/wlan0 38 | sed -i "/Gateway=/ a DNS=('$wifiDns1' '$wifiDns2')" /temp/root/etc/netctl/wlan0 39 | } 40 | -------------------------------------------------------------------------------- /functions/functionNetNetworkType.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for a network type and write it back as - 5 | ### a variable. 6 | function functionNetNetworkType { 7 | echo "####################################################################################" 8 | echo "Select the network type you want to configure 'Wi-Fi', 'Ethernet' or 'Both';" 9 | echo "####################################################################################" 10 | select yn in "Wi-Fi" "Ethernet" "Wi-Fi & Ethernet"; do 11 | case $yn in 12 | 'Wi-Fi' ) varNetworkType="WIFI"; break;; 13 | 'Ethernet' ) varNetworkType="ETH"; break;; 14 | 'Wi-Fi & Ethernet' ) varNetworkType="DUAL"; break;; 15 | esac 16 | done 17 | } 18 | -------------------------------------------------------------------------------- /functions/functionNetSingleIpType.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will ask the user for DHCP or Static IP configuraton and write - 5 | ### it back as a variable. 6 | function functionNetSingleIpType { 7 | echo "####################################################################################" 8 | echo "Select what type of IP address needs to be configured: 'DHCP' or 'STATIC' IP;" 9 | echo "####################################################################################" 10 | select yn in "DHCP" "STATIC"; do 11 | case $yn in 12 | 'DHCP' ) varIpType="$varNetworkType-DHCP"; break;; 13 | 'STATIC' ) varIpType="$varNetworkType-STATIC"; break;; 14 | esac 15 | done 16 | } 17 | -------------------------------------------------------------------------------- /functions/functionRootCheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function functionRootCheck { 4 | echo "#########################################################################" 5 | echo "THIS SCRIPT NEEDS TO BE RUN AS ROOT, CHECKING..." 6 | if [ `id -u` = 0 ] ; then 7 | echo "Running as ROOT, continue with script..." 8 | echo "#########################################################################" 9 | ### PRE-REQUIREMENTS 10 | # Check or install wget, tar and badtar 11 | { 12 | echo "Install 'wget, bsdtar & tar'" 13 | apt install -y wget bsdtar tar 14 | } &> /dev/null 15 | echo "#########################################################################" 16 | echo "" 17 | echo "" 18 | else 19 | echo "#########################################################################" 20 | echo "Not running as ROOT, exit script..." 21 | echo "#########################################################################" 22 | exit 1 23 | fi 24 | } 25 | -------------------------------------------------------------------------------- /functions/functionRootPassword.sh: -------------------------------------------------------------------------------- 1 | #!bin/bash 2 | 3 | # This function will ask the user for a password and writes it back to the "root" mount of the SD disk. 4 | # 5 | # This script have the following dependencies 6 | # - USB/SD mountpoint to "root" $mount_root 7 | 8 | function functionSetRootPassword { 9 | read -s -p "Enter root password: " inRootPass 10 | echo -n root:$inRootPass | sudo chpasswd -c SHA512 -R $mount_root 11 | echo "Root password has been set" 12 | } 13 | -------------------------------------------------------------------------------- /functions/functionSelectArmVersion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ######################################################################################### 3 | ### NOTE: This function will select the correct Arch Linux ARM version, download and - 4 | ### extract the image to the SD card. 5 | function functionSelectArmVersion { 6 | # Ask user for system specific variables 7 | echo "#########################################################################" 8 | echo "NOTE: Select the correct version of ARM is nessesarly for downloading" 9 | echo " the corresponding version of the Arch ARM Linux image" 10 | echo "" 11 | echo "Select 'ARM v6' when using models like: PI 1 MODEL A+" 12 | echo " PI 1 MODEL B+" 13 | echo " PI ZERO" 14 | echo " PI ZERO W" 15 | echo "" 16 | echo "Select 'ARM v7' when using models like: PI 2 MODEL B" 17 | echo "" 18 | echo "Select 'ARM v8' when using models like: PI 3 MODEL B" 19 | echo "#########################################################################" 20 | echo "" 21 | echo "" 22 | 23 | # Ask user for type or ARM processor 24 | echo "Select version of the correct ARM version, see info above for more information;" 25 | echo "####################################################################################" 26 | select yn in "ARM v6" "ARM v7" "ARM v8"; do 27 | case $yn in 28 | 'ARM v6' ) armVersion="6"; break;; 29 | 'ARM v7' ) armVersion="7"; break;; 30 | 'ARM v8' ) armVersion="8"; break;; 31 | esac 32 | done 33 | echo "armversion=${armVersion}" > ./armversion 34 | # Download Arch Linux ARM image, check what version ARM v6, v7 or v8 35 | echo "#########################################################################" 36 | echo "Download and extract Arch Linux ARM image" 37 | echo "#########################################################################" 38 | mkdir -p downloads 39 | 40 | # Import function; 41 | . ./functions/functionHandleFileCache.sh 42 | 43 | FILENAME=false 44 | NAME=false 45 | if [ $armVersion = 6 ]; then 46 | FILENAME="ArchLinuxARM-rpi-latest.tar.gz" 47 | NAME="Arch Linux ARM v6" 48 | elif [ $armVersion = 7 ]; then 49 | FILENAME="ArchLinuxARM-rpi-2-latest.tar.gz" 50 | NAME="Arch Linux ARM v7" 51 | elif [ $armVersion = 8 ]; then 52 | FILENAME="ArchLinuxARM-rpi-3-latest.tar.gz" 53 | NAME="Arch Linux ARM v8" 54 | fi 55 | 56 | if [ "$FILENAME" = false ] ; then 57 | echo "'Something went wrong with the arm version selection... script will exit..." 58 | exit 1 59 | else 60 | functionHandleFileCache "$FILENAME" "$NAME" 61 | fi 62 | 63 | echo "Download and extract complete" 64 | 65 | #Move boot files to the first partition: 66 | cp -r /temp/root/boot/* /temp/boot 67 | rm -rf /temp/root/boot 68 | echo "#########################################################################" 69 | echo "" 70 | echo "" 71 | } 72 | -------------------------------------------------------------------------------- /functions/functionShowConfig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################################### 4 | ### NOTE: This function will print all configuration information at the end of this script. 5 | ### 6 | function functionShowConfig { 7 | echo "#########################################################################" 8 | echo "Display configuration information;" 9 | echo "#########################################################################" 10 | echo "IP: " $wifiIp $ethernetIp 11 | echo "Hostname: " $varHostName 12 | 13 | } 14 | ######################################################################################### 15 | -------------------------------------------------------------------------------- /functions/functionSystemPreConfiguration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function functionSystemPreConfiguration { 4 | # System configuration 5 | echo "#########################################################################" 6 | echo "System pre-configuration" 7 | echo "#########################################################################" 8 | # Change rotation of Pi Screen' >> /temp/boot/config.txt 9 | echo lcd_rotate=2 >> /temp/boot/config.txt 10 | # Change GPU memory from 64MB to 16MB 11 | sed -i 's/gpu_mem=64/gpu_mem=16/' /temp/boot/config.txt 12 | # Enable root logins for sshd 13 | sed -i "s/"#"PermitRootLogin prohibit-password/PermitRootLogin yes/" /temp/root/etc/ssh/sshd_config ### <--- FIX ME!!!! 14 | # Download post configuration script and make file executable 15 | { 16 | wget -P /temp/ https://raw.githubusercontent.com/remonlam/rpi-zero-arch/master/sources/configure-system.sh ### <--- FIX ME!!!! 17 | chmod 755 /temp/configure-system.sh 18 | } &> /dev/null 19 | # Copy "configure-system.sh" script to "root" 20 | mv /temp/configure-system.sh /temp/root 21 | echo "#########################################################################" 22 | echo "" 23 | echo "" 24 | } 25 | -------------------------------------------------------------------------------- /functions/functionsNetworkProfileSelection.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## THIS SCRIPT DEPENDS ON THE FOLLOWING FUNCTIONS; 4 | ## - hostName 5 | ## - networkType 6 | ## - singleIpType 7 | ## - ipWifiStatic 8 | ## - accpCredentials 9 | ## - ipEthernetStatic 10 | ## - dualIpType 11 | ## 12 | 13 | ### Import other functions before running this function 14 | . ./functions/functionNetHostName.sh 15 | . ./functions/functionNetNetworkType.sh 16 | . ./functions/functionNetAccpCredentials.sh 17 | . ./functions/functionNetSingleIpType.sh 18 | . ./functions/functionNetDualIpType.sh 19 | . ./functions/functionNetIpWifiStatic.sh 20 | . ./functions/functionNetIpWifiDynamic.sh 21 | . ./functions/functionNetIpEthernetStatic.sh 22 | 23 | 24 | ######################################################################################### 25 | ### NOTE: This function will ask the user for a network and IP type and write it back - 26 | ### as a variable. 27 | ### After selecting WIFI/ETH/DUAL it selects IP configuration for DHCP/STATIC. 28 | ### 29 | ### NOTE: This function has several dependencies of other functions! 30 | ### 31 | function functionsNetworkProfileSelection { 32 | functionNetHostName 33 | functionNetNetworkType 34 | if [ "$varNetworkType" = "WIFI" ]; then 35 | echo "Setup Fixed IP settings for: ##" 36 | echo "#########################################################################" 37 | functionNetSingleIpType 38 | echo "show varIpType:" $varIpType 39 | if [ "$varIpType" = "WIFI-STATIC" ]; then 40 | functionNetIpWifiStatic 41 | functionNetAccpCredentials 42 | elif [ "$varIpType" = "WIFI-DHCP" ]; then 43 | functionNetIpWifiDynamic 44 | functionNetAccpCredentials 45 | fi 46 | elif [ "$varNetworkType" = "ETH" ]; then 47 | echo "Setup Fixed IP settings for: ##" 48 | echo "#########################################################################" 49 | functionNetSingleIpType 50 | echo "show varIpType:" $varIpType 51 | if [ "$varIpType" = "ETH-STATIC" ]; then 52 | functionNetIpEthernetStatic 53 | fi 54 | elif [ "$varNetworkType" = "DUAL" ]; then 55 | echo "Setup Fixed IP settings for: ##" 56 | echo "#########################################################################" 57 | functionNetDualIpType 58 | if [ "$varIpType" = "DUAL-STATIC_DHCP" ]; then 59 | echo "DEBUG: setup config for 'DUAL-STATIC_DHCP'" 60 | functionNetIpWifiStatic 61 | functionNetAccpCredentials 62 | elif [ "$varIpType" = "DUAL-DHCP_STATIC" ]; then 63 | echo "DEBUG: setup config for 'DUAL-DHCP_STATIC'" 64 | functionNetIpWifiDynamic 65 | functionNetAccpCredentials 66 | functionNetIpEthernetStatic 67 | elif [ "$varIpType" = "DUAL-STATIC_STATIC" ]; then 68 | echo "DEBUG: setup config for 'DUAL-STATIC_STATIC'" 69 | functionNetIpWifiStatic 70 | functionNetAccpCredentials 71 | functionNetIpEthernetStatic 72 | elif [ "$varIpType" = "DUAL-DHCP_DHCP" ]; then 73 | echo "DEBUG: setup config for 'DUAL-DHCP_DHCP'" 74 | functionNetIpWifiDynamic 75 | functionNetAccpCredentials 76 | fi 77 | fi 78 | } 79 | -------------------------------------------------------------------------------- /functions/masterFunctions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Master function script 4 | ## this script will call all functions in this directory 5 | ## Network functions will be loaded in "../functions/functionsNetworkProfileSelection" 6 | 7 | ## This is just a master test script it wont be used for something :-) 8 | . ./functions/masterVariables.sh 9 | 10 | # Import other functions 11 | . ./functions/functionCheckForImage.sh 12 | . ./functions/functionCleanup.sh 13 | . ./functions/functionDisableSystemctlServices.sh 14 | . ./functions/functionDisableSystemdServices.sh 15 | . ./functions/functionFindSource.sh 16 | . ./functions/functionFormatDisk.sh 17 | . ./functions/functionRootCheck.sh 18 | . ./functions/functionRootPassword.sh 19 | . ./functions/functionSelectArmVersion.sh 20 | . ./functions/functionShowConfig.sh 21 | . ./functions/functionSystemPreConfiguration.sh 22 | . ./functions/functionsNetworkProfileSelection.sh 23 | -------------------------------------------------------------------------------- /functions/masterVariables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # Set fixed variables, need to move this part to function 5 | part1=p1 6 | part2=p2 7 | 8 | # Set fixed variables for mounting sd card 9 | mount_boot=/temp/boot 10 | mount_root=/temp/root 11 | -------------------------------------------------------------------------------- /images/arch_pizero_docker_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/images/arch_pizero_docker_logo.png -------------------------------------------------------------------------------- /images/rpi_arm_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/images/rpi_arm_banner.png -------------------------------------------------------------------------------- /installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Import Variables & Functions from external sources 4 | . ./functions/masterVariables.sh 5 | . ./functions/masterFunctions.sh 6 | 7 | ######################################################################################### 8 | ### RUNTIME ### 9 | ######################################################################################### 10 | 11 | # Run functions 12 | functionRootCheck 13 | functionFormatDisk 14 | #functionFindSource # some kind of loop, needs more work! 15 | functionSelectArmVersion 16 | #functionDisableSystemctlServices #need to check if this is the right place to execute this function 17 | 18 | functionsNetworkProfileSelection 19 | #functionSetRootPassword # function does not work on Debian 20 | #functionSystemPreConfiguration 21 | #functionCleanup 22 | functionShowConfig 23 | -------------------------------------------------------------------------------- /networking/eth0: -------------------------------------------------------------------------------- 1 | Description='Network - eth0' 2 | Interface=eth0 3 | Connection=ethernet 4 | IP=dhcp 5 | -------------------------------------------------------------------------------- /networking/netctl@eth0.service: -------------------------------------------------------------------------------- 1 | .include /usr/lib/systemd/system/netctl@.service 2 | 3 | [Unit] 4 | Description=Network - eth0 5 | BindsTo=sys-subsystem-net-devices-eth0.device 6 | After=sys-subsystem-net-devices-eth0.device 7 | -------------------------------------------------------------------------------- /networking/netctl@wlan0.service: -------------------------------------------------------------------------------- 1 | .include /usr/lib/systemd/system/netctl@.service 2 | 3 | [Unit] 4 | Description=Network - wlan0 5 | BindsTo=sys-subsystem-net-devices-wlan0.device 6 | After=sys-subsystem-net-devices-wlan0.device 7 | -------------------------------------------------------------------------------- /networking/wlan0: -------------------------------------------------------------------------------- 1 | Description='Network - wlan0' 2 | Interface=wlan0 3 | Connection=wireless 4 | IP=dhcp 5 | Security='wpa' 6 | ESSID='SSID-NAME' 7 | Key='SSID-KEY' 8 | Restart=always 9 | -------------------------------------------------------------------------------- /networking/wlan0.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=wlan0 3 | 4 | [Network] 5 | DHCP=both 6 | -------------------------------------------------------------------------------- /packages/b43-fwcutter-019-1-armv6h.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/b43-fwcutter-019-1-armv6h.pkg.tar.xz -------------------------------------------------------------------------------- /packages/libnl-3.2.26-1-armv6h.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/libnl-3.2.26-1-armv6h.pkg.tar.xz -------------------------------------------------------------------------------- /packages/libnl-3.4.0-1-aarch64.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/libnl-3.4.0-1-aarch64.pkg.tar.xz -------------------------------------------------------------------------------- /packages/libnl-3.4.0-1-armv6h.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/libnl-3.4.0-1-armv6h.pkg.tar.xz -------------------------------------------------------------------------------- /packages/libnl-3.4.0-1-armv7h.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/libnl-3.4.0-1-armv7h.pkg.tar.xz -------------------------------------------------------------------------------- /packages/libnl_wpa_package.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/libnl_wpa_package.tar.gz -------------------------------------------------------------------------------- /packages/wpa_supplicant-1&%2.3-1-armv6h.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remonlam/rpi-arch-builder/c364bd8175c502e3f5606e9f3d219be35bef78a7/packages/wpa_supplicant-1&%2.3-1-armv6h.pkg.tar.xz -------------------------------------------------------------------------------- /sources/ArchLinuxARM-rpi-2-latest.tar.gz.md5: -------------------------------------------------------------------------------- 1 | 6092ba916f277a93aa12a90490357183 ArchLinuxARM-rpi-2-latest.tar.gz 2 | -------------------------------------------------------------------------------- /sources/ArchLinuxARM-rpi-latest.tar.gz.md5: -------------------------------------------------------------------------------- 1 | fa882aa7dca663d83457aa1b81cb9a49 ArchLinuxARM-rpi-latest.tar.gz 2 | -------------------------------------------------------------------------------- /sources/configure-system.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ### SCRIPT VARIABLES 4 | ## Ask user for system specific variables 5 | read -s -p 'Enter Root password: ' systemRootPassword 6 | 7 | 8 | # Network variables 9 | #networkHostname= 10 | #networkIp= 11 | #networkSubnet=24 12 | #networkGateway=192.168.0.1 13 | #networkDns1=192.168.0.100 14 | #networkDns2=192.168.0.200 15 | #networkDnsSearch=domain.local 16 | networkDevice=eth0 # This is the default LAN port on the raspbeery Pi, if you're using WiFi use wlan0 17 | 18 | # System Variables 19 | #systemRootPassword=P@ssword, 20 | 21 | # Time servicess 22 | # Note: uses the Dutch time server 23 | systemNtp0=0.nl.pool.ntp.org 24 | systemNtp1=1.nl.pool.ntp.org 25 | systemNtp2=2.nl.pool.ntp.org 26 | systemNtp3=3.nl.pool.ntp.org 27 | 28 | 29 | ## Configure networking 30 | 31 | # Configure networking on eth0 with a static IP: 32 | #echo -e "Description='Network - $networkDevice'\nInterface=$networkDevice\nConnection=ethernet\nIP=static\nAddress=('$networkIp/$networkSubnet')\nGateway=('$networkGateway')\nDNS=('$networkDns1' '$networkDns2')" > /etc/netctl/eth0 33 | 34 | # Enable the new interface so it starts the next time the system boots: 35 | #netctl enable $networkDevice 36 | 37 | # Stoping all unwanted network related services, because we configured the config file in /etc/netctl/eth0: 38 | #systemctl stop systemd-networkd.service 39 | #systemctl disable systemd-networkd.service 40 | #systemctl stop systemd-resolved.service 41 | #systemctl disable systemd-resolved.service 42 | 43 | # Remove the old /etc/resolv.conf, otherwise we can't populate it: 44 | #rm /etc/resolv.conf 45 | 46 | # Populate /etc/resolv.conf with new dns servers: 47 | #echo -e "search $networkDnsSearch\nnameserver $networkDns1\nnameserver $networkDns2" > /etc/resolv.conf 48 | 49 | # Sets hostname to pi-n1: 50 | #echo $networkHostname > /etc/hostname 51 | 52 | # Fill the hostfile with local cluster Pi nodes: 53 | #echo -e "127.0.0.1 localhost.localdomain localhost\n10.100.10.120 pi-n0.domain.local pi-n0\n10.100.10.121 pi-n1.domain.local pi-n1\n10.100.10.122 pi-n2.domain.local pi-n2\n10.100.10.123 pi-n3.domain.local pi-n3" > /etc/hosts 54 | 55 | 56 | ## Configure system 57 | 58 | # Time zone configuration, sets it to Europe/Amsterdam: 59 | timedatectl set-timezone Europe/Amsterdam 60 | 61 | # Populate NTP source file "etc/systemd/timesyncd.conf": 62 | echo -e "NTP=$systemNtp0 $systemNtp1 $systemNtp2 $systemNtp3" > /etc/systemd/timesyncd.conf 63 | 64 | # Check if everything configured correctly, and check the system time using "date": 65 | #timedatectl status 66 | #date 67 | 68 | # Sets root password to what the user has filled in: 69 | echo root:$systemRootPassword | chpasswd 70 | 71 | # Remove all SSH keys: 72 | rm -f /etc/ssh/ssh_host_dsa_key 73 | rm -f /etc/ssh/ssh_host_rsa_key 74 | 75 | # Generate new SSH keys: 76 | ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N "" -t dsa 77 | ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N "" -t rsa 78 | 79 | 80 | # Disable X interface, so we only have cli, this saves memory which is good because it is limited: 81 | systemctl set-default multi-user.target 82 | 83 | # Check if it's configured correctly: 84 | systemctl get-default 85 | 86 | 87 | # Update repositories in oder to download docker: 88 | pacman --noconfirm -Sy 89 | 90 | # Install all required packages 91 | pacman -S --noconfirm wget nano vi net-tools iftop iotop tar zip 92 | 93 | echo "Would you like to install Docker on this system?" 94 | select yn in "Yes" "No"; do 95 | case $yn in 96 | Yes ) pacman -S --noconfirm docker 97 | systemctl enable docker 98 | systemctl start docker; break;; 99 | No ) exit;; 100 | esac 101 | done 102 | 103 | # Update Arch Linux: 104 | pacman --noconfirm -Syu 105 | 106 | # Ask user to reboot the system, if true then reboot system: 107 | echo "The system has been updated and needs to be rebooted, do you want to reboot right now?" 108 | select yn in "Yes" "No"; do 109 | case $yn in 110 | Yes ) reboot; break;; 111 | No ) exit;; 112 | esac 113 | done 114 | -------------------------------------------------------------------------------- /sources/eth0.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=eth0 3 | 4 | [Network] 5 | Address=NETIP/NETSUB 6 | Gateway=NETGW 7 | DNS=NETDNS1 8 | DNS=NETDNS2 9 | -------------------------------------------------------------------------------- /sources/wlan0.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=wlan0 3 | 4 | [Network] 5 | DHCP=ipv4 6 | 7 | [DHCP] 8 | RouteMetric=20 9 | --------------------------------------------------------------------------------