dot

packages and services management
Log | Files | Refs | README

commit 34531a548fe1bfd0f61d1b38e722be31fb34be5b
parent 2009e7fd867ae94ad7b06fa69868b3c090335e9e
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 18 Nov 2018 02:26:43 +0100

bin/pack-*: fix exit if an error occurs at one step

Diffstat:
Mbin/pack-build | 21+++++++++++++--------
Mbin/pack-get | 4++--
Mbin/pack-install | 7+++----
Mbin/pack-tar | 4++--
Mpack/sqmail/build | 15+++++++++------
Ms6/qmail-smtpd/tcp/run | 1+
6 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/bin/pack-build b/bin/pack-build @@ -3,19 +3,24 @@ pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} test -f "/etc/pack/$pack/build" || exit 0 test ! -d "/var/pack/pkg/$pack/$version" || exit 0 -trap "rm -rf '/var/pack/pkg/$pack/$version'" EXIT -pack-get "$pack" "$version" | tr -d '\n' -echo ' build' + +trap "rm -rf '/var/pack/pkg/$pack/$version'" INT TERM EXIT +o=$(pack-get "$pack" "$version") || { echo "$o"; exit 1; } +echo "$o build" mkdir -p "/var/log/pack/$pack/$version" exec >"/var/log/pack/$pack/$version/build" 2>&1 mkdir -p "/var/pack/pkg/$pack" set -- -if [ -d /etc/pack/$pack/dependencies ]; then - cd "/etc/pack/$pack/dependencies" - for d in *; do set -- "$@" "$d=/var/pack/pkg/$d/$(sed q $d)"; done +if cd "/etc/pack/$pack/dependencies"; then + for dep in *; do + var=$(printf %s "$dep" | tr -c _a-zA-Z0-9 _) + set -- "$@" "$var=/var/pack/pkg/$dep/$(sed q "$dep")" + done fi + cd "/var/pack/src/$pack/$version" -env DEF="/etc/pack/$pack" PREFIX="/var/pack/pkg/$pack/$version" "$@" "/etc/pack/$pack/build" +env DEF="/etc/pack/$pack" PREFIX="/var/pack/pkg/$pack/$version" "$@" \ + "/etc/pack/$pack/build" -trap - EXIT +trap - INT TERM EXIT diff --git a/bin/pack-get b/bin/pack-get @@ -3,7 +3,7 @@ PACK=${PACK:-/var/pack} pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} test ! -d "/var/pack/src/$pack/$version" || exit 0 -trap "rm -rf '/var/pack/src/$pack/$version'" EXIT +trap "rm -rf '/var/pack/src/$pack/$version'" INT TERM EXIT echo ' get' mkdir -p "/var/log/pack/$pack/$version" exec >"/var/log/pack/$pack/$version/get" 2>&1 @@ -12,5 +12,5 @@ test ! -f "/etc/pack/$pack/tar" || exec pack-tar "$pack" "$version" test ! -f "/etc/pack/$pack/git" || exec pack-git "$pack" "$version" test ! -f "/etc/pack/$pack/cvs" || exec pack-cvs "$pack" "$version" -trap - EXIT +trap - INT TERM EXIT exit 1 diff --git a/bin/pack-install b/bin/pack-install @@ -2,15 +2,14 @@ PACK=${PACK:-/var/pack} pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} -pack-build "$pack" "$version" | tr -d '\n' -echo ' install' +o=$(pack-build "$pack" "$version") || { echo "$o"; exit 1; } +echo "$o install" mkdir -p "/var/log/pack/$pack/$version" exec >/var/log/pack/$pack/$version/install 2>&1 mkdir -p "/var/pack/bin" "/var/pack/man" cd "/var/pack/pkg/$pack/$version" -pwd -ls + if [ -d bin ]; then cp -RLfp bin "/var/pack"; fi if [ -d man ]; then cp -RLfp man "/var/pack"; fi if [ -d share/man ]; then cp -RLfp share/man "/var/pack"; fi diff --git a/bin/pack-tar b/bin/pack-tar @@ -2,7 +2,7 @@ PACK=${PACK:-/var/pack} pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} -trap "rm -f '/etc/pack/tar/$pack/$version.tar'" EXIT +trap "rm -f '/etc/pack/tar/$pack/$version.tar'" INT TERM EXIT sed "s/%v/$version/g" /etc/pack/$pack/tar | while IFS= read -r url @@ -22,4 +22,4 @@ do mkdir -p "/var/pack/src/$pack/$version" "/var/pack/tar/$pack" break done -trap - EXIT +trap - INT TERM EXIT diff --git a/pack/sqmail/build b/pack/sqmail/build @@ -2,16 +2,18 @@ ! mv sqmail/*/* .; rm -rf sqmail -mkdir -p compile /var/qmail "$PREFIX/bin" +sed 's/env - /env/' package/compile >$$ +mv $$ package/compile +chmod +x package/compile + +mkdir -p compile /var/qmail "$PREFIX" echo "-L$libressl/lib -lssl -lcrypto" >compile/ssl.lib echo "$ucspi_ssl" | sed s/pkg/src/ >conf-ucspissl echo "$PREFIX/man" >conf-man -cp "$ucspi_ssl/lib/ucspissl.a" compile -rm /var/qmail/control /var/qmail/bin -ln -sf /etc/qmail /var/qmail/control -ln -sf "$PREFIX/bin" /var/qmail/bin +cp "$ucspi_ssl/lib/ucspissl.a" compile +rm -rf /var/qmail/bin package/compile package/dir @@ -19,4 +21,5 @@ package/ids package/ucspissl package/compile package/legacy -package/control + +mv /var/qmail/bin "$PREFIX/bin" diff --git a/s6/qmail-smtpd/tcp/run b/s6/qmail-smtpd/tcp/run @@ -1,5 +1,6 @@ #!/usr/bin/env execlineb fdmove -c 2 1 s6-envdir env multisubstitute { + importas USER USER importas HOST HOST importas PORT PORT }