dot

packages and services management
Log | Files | Refs | README

commit edf69db54605a52239ca8699a289c7bcad57f44a
parent 802129fb3cd1a813ecb283a518ad0ea976f8da7e
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat,  5 Jan 2019 19:41:26 +0100

adapting pack to new storage format

Diffstat:
Mbin/pack-add | 2+-
Mbin/pack-build | 24++++++++++++++----------
Mbin/pack-dep | 17+++++++++--------
Mbin/pack-get | 4++--
4 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/bin/pack-add b/bin/pack-add @@ -1,7 +1,7 @@ #!/bin/sh -e test $# -gt 0 -pack-dep "$@" | while read -r pack version; do +pack-dep "$@" | while IFS=/ read -r pack version; do printf ' %-30s %-15s' "$pack" "$version" pack-install "$pack" "$version" done diff --git a/bin/pack-build b/bin/pack-build @@ -1,9 +1,8 @@ #!/bin/sh -e PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} +pack=$1 version=$(sed q "/etc/pack/$1/default/version") -if [ ! -f "/etc/pack/$pack/build" ]; then exit 1; fi -if [ -d "$PACK/pkg/$pack/$version" ]; then exit 0; fi +if test -d "$PACK/pkg/$pack/$version"; then exit 0; fi trap "rm -rf '$PACK/pkg/$pack/$version'" INT TERM EXIT pack-get "$pack" "$version" || { echo; exit 1; } @@ -12,15 +11,20 @@ mkdir -p "$PACK/log/$pack/$version" exec >"$PACK/log/$pack/$version/build" 2>&1 set -- -if cd "/etc/pack/$pack/dependencies"; then - for dep in *; do - var=$(printf %s "$dep" | tr -c _a-zA-Z0-9 _) - set -- "$@" "$var=$PACK/pkg/$dep/$(sed q "$dep")" - done -fi +for x in "/etc/pack/$pack/$version" /etc/pack/$pack/default; do + while IFS='/' read p v; do + v=${v:-$(sed q "$p/default/version")"} + p=$(echo "$p" | tr -c _a-zA-Z0-9 _) + set -- "$@" "$p=$v" + done <$x + break +done mkdir -p "$PACK/pkg/$pack" cd "$PACK/src/$pack/$version" -env PREFIX="$PACK/pkg/$pack/$version" "$@" "/etc/pack/$pack/build" +if test -f "/etc/pack/$pack/$version/build" +then env PREFIX="$PACK/pkg/$pack/$version" "$@" "/etc/pack/$pack/$version/build" +else env PREFIX="$PACK/pkg/$pack/$version" "$@" "/etc/pack/$pack/default/build" +fi trap - INT TERM EXIT diff --git a/bin/pack-dep b/bin/pack-dep @@ -1,14 +1,15 @@ #!/bin/sh -e dep() { - while read pack version; do - version=${version:-$(sed q "/etc/pack/$pack/version")} - grep -qFx "$version" "/etc/pack/$pack/version" - if test -d "/etc/pack/$pack/dependencies"; then ( - cd "/etc/pack/$pack/dependencies" - for f in *; do read v <$f; echo "$f $v"; done - ); fi | dep - printf '%-25s %-15s\n' "$pack" "$version" + while IFS=/ read pack version; do + version=${version:-$(sed q "/etc/pack/$pack/default/version")} + + if [ -f "/etc/pack/$pack/$version/dependencies" ]; then + (dep <"/etc/pack/$pack/$version/dependencies") + elif [ -f "/etc/pack/$pack/default/dependencies" ]; then + (dep <"/etc/pack/$pack/default/dependencies") + fi + echo "$pack/$version" done } diff --git a/bin/pack-get b/bin/pack-get @@ -1,6 +1,6 @@ #!/bin/sh -e PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} +pack=$1 version=${2:-$(sed q "/etc/pack/$1/default/version")} if [ -d "$PACK/src/$pack/$version" ]; then exit 0; fi printf ' get' @@ -15,6 +15,6 @@ while IFS= read -r url; do (ftp://*|ftps://*) pack-ftp "$pack" "$version" "$url" ;; (cvs://*) pack-cvs "$pack" "$version" "$url" ;; esac -done </etc/pack/$pack/uri/$version +done </etc/pack/$pack/$version/uri pack-tar "$pack" "$version"