Manually merge upstream.

This commit is contained in:
Holger Pandel 2020-02-04 22:29:43 +01:00
parent def500faaa
commit ad3c0f115c
7 changed files with 19 additions and 10 deletions

View File

@ -6,7 +6,8 @@ RUN apt-get -y update && \
apt-get -y install \ apt-get -y install \
git vim parted \ git vim parted \
quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \ quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \
bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod qemu-utils kpartx\ bsdtar libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc \
qemu-utils kpartx \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY . /pi-gen/ COPY . /pi-gen/

View File

@ -14,7 +14,8 @@ To install the required dependencies for pi-gen you should run:
```bash ```bash
apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \ apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip \
dosfstools bsdtar libcap2-bin grep rsync xz-utils file git curl qemu-utils kpartx dosfstools bsdtar libcap2-bin grep rsync xz-utils file git curl bc \
qemu-utils kpartx
``` ```
The file `depends` contains a list of tools needed. The format of this The file `depends` contains a list of tools needed. The format of this
@ -105,7 +106,7 @@ The following environment variables are supported:
Default system locale. Default system locale.
* `HOSTNAME` (Default: "raspberrypi" ) * `TARGET_HOSTNAME` (Default: "raspberrypi" )
Setting the hostname to the specified value. Setting the hostname to the specified value.
@ -142,7 +143,7 @@ The following environment variables are supported:
* `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset) * `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset)
If these are set, they are use to configure `wpa_supplicant.conf`, so that the raspberry pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured. If these are set, they are use to configure `wpa_supplicant.conf`, so that the Raspberry Pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured.
* `ENABLE_SSH` (Default: `0`) * `ENABLE_SSH` (Default: `0`)

View File

@ -204,7 +204,7 @@ export DEPLOY_DIR=${DEPLOY_DIR:-"${BASE_DIR}/deploy"}
export DEPLOY_ZIP="${DEPLOY_ZIP:-1}" export DEPLOY_ZIP="${DEPLOY_ZIP:-1}"
export LOG_FILE="${WORK_DIR}/build.log" export LOG_FILE="${WORK_DIR}/build.log"
export HOSTNAME=${HOSTNAME:-raspberrypi} export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi} export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry} export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry}
@ -274,6 +274,11 @@ if [[ -n "${APT_PROXY}" ]] && ! curl --silent "${APT_PROXY}" >/dev/null ; then
exit 1 exit 1
fi fi
if [[ -n "${WPA_PASSWORD}" && ${#WPA_PASSWORD} -lt 8 || ${#WPA_PASSWORD} -gt 63 ]] ; then
echo "WPA_PASSWORD" must be between 8 and 63 characters
exit 1
fi
mkdir -p "${WORK_DIR}" mkdir -p "${WORK_DIR}"
log "Begin ${BASE_DIR}" log "Begin ${BASE_DIR}"

View File

@ -16,5 +16,6 @@ xxd
file file
git git
lsmod:kmod lsmod:kmod
bc
qemu-nbd:qemu-utils qemu-nbd:qemu-utils
kpartx kpartx

View File

@ -19,7 +19,7 @@ if [ "${NO_PRERUN_QCOW2}" = "0" ]; then
# some overhead (since actual space usage is usually rounded up to the # some overhead (since actual space usage is usually rounded up to the
# filesystem block size) and gives some free space on the resulting # filesystem block size) and gives some free space on the resulting
# image. # image.
ROOT_MARGIN=$((800*1024*1024)) ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)"
BOOT_PART_START=$((ALIGN)) BOOT_PART_START=$((ALIGN))
BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN)) BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN))

View File

@ -1,6 +1,6 @@
#!/bin/bash -e #!/bin/bash -e
echo "${HOSTNAME}" > "${ROOTFS_DIR}/etc/hostname" echo "${TARGET_HOSTNAME}" > "${ROOTFS_DIR}/etc/hostname"
echo "127.0.1.1 ${HOSTNAME}" >> "${ROOTFS_DIR}/etc/hosts" echo "127.0.1.1 ${TARGET_HOSTNAME}" >> "${ROOTFS_DIR}/etc/hosts"
ln -sf /dev/null "${ROOTFS_DIR}/etc/systemd/network/99-default.link" ln -sf /dev/null "${ROOTFS_DIR}/etc/systemd/network/99-default.link"

View File

@ -12,7 +12,8 @@ fi
if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then
on_chroot <<EOF on_chroot <<EOF
wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" >> "/etc/wpa_supplicant/wpa_supplicant.conf" set -o pipefail
wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" | tee -a "/etc/wpa_supplicant/wpa_supplicant.conf"
EOF EOF
elif [ -v WPA_ESSID ]; then elif [ -v WPA_ESSID ]; then
cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL