From 4df6af10b4713b38b1e60b8f4e5fa13674656c9d 2021-05-16 16:48:12 From: GĂ©rard Vidal Date: 2021-05-16 16:48:12 Subject: [PATCH] Merge branch 'master' of http://depot.tremplin.ens-lyon.fr/Raspi2-3_GenImage --- diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index 3ae980d..d6650c3 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -13,6 +13,9 @@ sed -i "s/^RaspberryPI/${HOSTNAME}/" "${ETC_DIR}/hostname" install_readonly files/network/hosts "${ETC_DIR}/hosts" sed -i "s/RaspberryPI/${HOSTNAME}/" "${ETC_DIR}/hosts" +# Ensure /etc/systemd/network directory is available +mkdir -p "${ETC_DIR}/systemd/network" + # Setup hostname entry with static IP if [ "$NET_ETH_ADDRESS" != "" ] ; then NET_IP=$(echo "${NET_ETH_ADDRESS}" | cut -f 1 -d'/') @@ -68,6 +71,7 @@ fi if [ "$ENABLE_WIRELESS" = true ] ; then + mkdir -p "${ETC_DIR}/wpa_supplicant" if [ "$ENABLE_WIFI_DHCP" = true ] ; then # Enable DHCP configuration for interface eth0 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/wlan0.network" @@ -94,19 +98,18 @@ if [ "$ENABLE_WIRELESS" = true ] ; then fi fi - if [ -z "$NET_WIFI_SSID" ] && [ -z "$NET_WIFI_PSK" ] ; then - printf " + if [ ! -z "$NET_WIFI_SSID" ] && [ ! -z "$NET_WIFI_PSK" ] ; then + chroot_exec printf " ctrl_interface=/run/wpa_supplicant - ctrl_interface_group=wheel update_config=1 eapol_version=1 ap_scan=1 fast_reauth=1 - " > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf + " > "${ETC_DIR}/wpa_supplicant/wpa_supplicant-wlan0.conf" #Configure WPA_supplicant - chroot_exec wpa_passphrase "$NET_SSID" "$NET_WPAPSK" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf + chroot_exec wpa_passphrase "$NET_WIFI_SSID" "$NET_WIFI_PSK" >> "${ETC_DIR}/wpa_supplicant/wpa_supplicant-wlan0.conf" chroot_exec systemctl enable wpa_supplicant.service chroot_exec systemctl enable wpa_supplicant@wlan0.service diff --git a/bootstrap.d/99-reduce.sh b/bootstrap.d/99-reduce.sh index 3b7fc57..6feaf0f 100644 --- a/bootstrap.d/99-reduce.sh +++ b/bootstrap.d/99-reduce.sh @@ -75,7 +75,11 @@ if [ "$ENABLE_REDUCE" = true ] ; then # Remove sound utils and libraries if [ "$ENABLE_SOUND" = false ] ; then - chroot_exec apt-get -qq -y purge alsa-utils libsamplerate0 libasound2 libasound2-data + if [ "$ENABLE_BLUETOOTH" = false ] ; then + chroot_exec apt-get -qq -y purge alsa-utils libsamplerate0 libasound2 libasound2-data + else + chroot_exec apt-get -qq -y purge alsa-utils libsamplerate0 + fi fi # Remove GPU kernels @@ -91,6 +95,9 @@ if [ "$ENABLE_REDUCE" = true ] ; then rm -f "${R}/boot/vmlinuz-*" rm -f "${R}/boot/initrd.img-*" fi + + #Reduce BOOT + #Only necessary files for my gen pi # Clean APT list of repositories rm -fr "${R}/var/lib/apt/lists/*" diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 1c64656..b0ed632 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ######################################################################## # rpi23-gen-image.sh 2015-2017 # @@ -806,7 +806,7 @@ CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')") # Calculate the amount of needed 512 Byte sectors TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512) -FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512) +FRMW_SECTORS=$(expr 128 \* 1024 \* 1024 \/ 512) ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}") # The root partition is EXT4 @@ -834,8 +834,8 @@ EOM ${TABLE_SECTORS},${ROOT_SECTORS},83 EOM - ## Setup temporary loop devices - FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)" + # Setup temporary loop devices + FRMW_LOOP="$(losetup -o 1M --sizelimit 128M -f --show "$IMAGE_NAME"-frmw.img)" ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)" # ENABLE_SPLITFS=false else @@ -849,8 +849,8 @@ ${ROOT_OFFSET},${ROOT_SECTORS},83 EOM # Setup temporary loop devices - FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)" - ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)" + FRMW_LOOP="$(losetup -o 1M --sizelimit 128M -f --show "$IMAGE_NAME".img)" + ROOT_LOOP="$(losetup -o 129M -f --show "$IMAGE_NAME".img)" fi if [ "$ENABLE_CRYPTFS" = true ] ; then