Use \0 as delimiter for while read loops. Bump version.

This commit is contained in:
Darren 'Tadgy' Austin 2022-10-15 23:01:30 +01:00
commit df493c0a26
19 changed files with 483 additions and 127 deletions

View file

@ -1,5 +1,5 @@
#!/bin/bash
# Version: 0.6.12
# Version: 0.6.14
# Copyright (c) 2005-2022:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
@ -77,12 +77,12 @@ done
# Pre-build checks.
(( ${BUILD_FORCE:-0} != 1 )) && {
while read -r PKG; do
while read -r -d $'\0' PKG; do
check_installed "$PKG" && die "Conflicting package installed: $PKG"
done < <(printf "%s " "${BUILD_CONFLICTS[@]}")
while read -r PKG; do
done < <(printf "%s\\0" "$PKG_NAME" "${BUILD_CONFLICTS[@]}")
while read -r -d $'\0' PKG; do
check_installed "$PKG" || die "Required package not installed: $PKG"
done < <(printf "%s " "${BUILD_REQUIRES[@]}")
done < <(printf "%s\\0" "glibc" "${BUILD_REQUIRES[@]}")
}
# Gather some system information.
@ -164,7 +164,7 @@ rm -rf "$BUILD_WORKDIR/$PKG_NAME-$PKG_VERSION" || die "Failed to clear cpam home
[[ -n "${SRC_DOWNLOADS[*]}" ]] && {
WGET="$(command -v wget)"
I=0
while read -r SRC; do
while read -r -d $'\0' SRC; do
[[ ! -e "${SRC_FILENAMES[I]}" ]] && {
[[ -z "$WGET" ]] && die "wget is required to download sources"
"$WGET" -t 3 -c -T 30 -w 5 --retry-connrefused --retry-on-host-error --no-check-certificate --passive-ftp -O "${SRC_FILENAMES[I]}" "$SRC" || \
@ -172,12 +172,12 @@ rm -rf "$BUILD_WORKDIR/$PKG_NAME-$PKG_VERSION" || die "Failed to clear cpam home
}
[[ "$(md5sum "${SRC_FILENAMES[I]}" | cut -d' ' -f1)" != "${SRC_MD5SUMS[I]}" ]] && die "md5sum verification failed: ${SRC_FILENAMES[I]}"
(( I++ ))
done < <(printf "%s\\n" "${SRC_DOWNLOADS[@]}")
done < <(printf "%s\\0" "${SRC_DOWNLOADS[@]}")
}
# Unpack sources.
[[ -n "${SRC_FILENAMES[*]}" ]] && {
while read -r SRC; do
while read -r -d $'\0' SRC; do
case "$SRC" in
*.tar.*|*.t?z)
tar -xv -C "$BUILD_WORKDIR" -f "$SRC" || die "Failed to extract source: $SRC"
@ -189,7 +189,7 @@ rm -rf "$BUILD_WORKDIR/$PKG_NAME-$PKG_VERSION" || die "Failed to clear cpam home
die "Un-handled source archive format: ${SRC##*.}"
;;
esac
done < <(printf "%s\\n" "${SRC_FILENAMES[@]}")
done < <(printf "%s\\0" "${SRC_FILENAMES[@]}")
}
# Fix any weird permissions on sources.