dot

packages and services management
Log | Files | Refs | README

commit 64762c7aca4660ec39e28818bd7b933132b273b8
parent 701e248db393798264ff65e65c2cc606ed50bc8d
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon,  7 Jan 2019 01:45:10 +0100

manage package manager as external dependency

Diffstat:
Dbin/pack-add | 7-------
Dbin/pack-build | 30------------------------------
Dbin/pack-cvs | 14--------------
Dbin/pack-dep | 18------------------
Dbin/pack-extract | 8--------
Dbin/pack-ftp | 10----------
Dbin/pack-get | 20--------------------
Dbin/pack-git | 16----------------
Dbin/pack-http | 12------------
Dbin/pack-install | 15---------------
Dbin/pack-tar | 15---------------
Dbin/pack-tree | 16----------------
Mconf/etc | 2++
Aconf/pack | 7+++++++
14 files changed, 9 insertions(+), 181 deletions(-)

diff --git a/bin/pack-add b/bin/pack-add @@ -1,7 +0,0 @@ -#!/bin/sh -e -test $# -gt 0 - -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,30 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=$(sed q "/etc/pack/$1/default/version") - -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; } -printf ' build' -mkdir -p "$PACK/log/$pack/$version" -exec >"$PACK/log/$pack/$version/build" 2>&1 - -set -- -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" -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-cvs b/bin/pack-cvs @@ -1,14 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} url=$3 - -trap "rm -rf \ - '$PACK/cvs/$pack/$version' \ - '$PACK/tar/$pack/$version.tar'" INT TERM EXIT - -mkdir -p "$PACK/src/$pack/$version" -cd "$PACK/cvs/$pack/$version" -cvs -qd "$url" checkout -P "$path" -tar -cf "$PACK/tar/$pack/$version.tar" . - -trap - INT TERM EXIT diff --git a/bin/pack-dep b/bin/pack-dep @@ -1,18 +0,0 @@ -#!/bin/sh -e - -dep() { - 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 -} - -test $# -gt 0 - -printf '%s\n' "$@" | dep | awk '! exist[$0]++' diff --git a/bin/pack-extract b/bin/pack-extract @@ -1,8 +0,0 @@ -#!/bin/sh -e - -case $1 in -(*.tgz|*.tar.gz) gzip -d - ;; -(*.tbz|*.tar.bz2) bzip2 -d - ;; -(*.txz|*.tar.xz) xz -d - ;; -(*.tlz|*.tar.lz) lzip -d - ;; -esac diff --git a/bin/pack-ftp b/bin/pack-ftp @@ -1,10 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} url=$3 - -trap "rm -f '$PACK/tar/$pack/$version.tar'" INT TERM EXIT - -mkdir -p "$PACK/src/$pack/$version" "$PACK/tar/$pack" -wget -O- "$url" | pack-extract "$url" >$PACK/tar/$pack/$version.tar - -trap - INT TERM EXIT diff --git a/bin/pack-get b/bin/pack-get @@ -1,20 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/default/version")} - -if [ -d "$PACK/src/$pack/$version" ]; then exit 0; fi -printf ' get' -mkdir -p "$PACK/log/$pack/$version" -exec >$PACK/log/$pack/$version/get 2>&1 - -test -f "$PACK/tar/$version/$pack.tar" || -while IFS= read -r url; do - case $url in - (http://*|https://*) pack-http "$pack" "$version" "$url" ;; - (git://*) pack-git "$pack" "$version" "$url" ;; - (ftp://*|ftps://*) pack-ftp "$pack" "$version" "$url" ;; - (cvs://*) pack-cvs "$pack" "$version" "$url" ;; - esac -done </etc/pack/$pack/$version/uri - -pack-tar "$pack" "$version" diff --git a/bin/pack-git b/bin/pack-git @@ -1,16 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} url=$3 - -if [ -d "$PACK/git/$pack/$version" ]; then exit 0; fi -trap "rm -rf \ - '$PACK/git/$pack/$version' \ - '$PACK/tar/$pack/$version.tar'" INT TERM EXIT - -mkdir -p "$PACK/git/$pack" "$PACK/tar/$pack" -git clone --bare "$url" "$PACK/git/$pack/$version" -git -C \ - "$PACK/git/$pack/$version" archive master \ - >$PACK/tar/$pack/$version.tar - -trap - INT TERM EXIT diff --git a/bin/pack-http b/bin/pack-http @@ -1,12 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} url=$3 - -trap "rm -f '/etc/pack/tar/$pack/$version.tar'" INT TERM EXIT - -mkdir -p "$PACK/src/$pack/$version" "$PACK/tar/$pack" -if [ ! -f "$PACK/tar/$pack/$version.tar" ]; then - wget --no-check-certificate -O- "$url" | pack-extract "$url" >/var/pack/tar/$pack/$version.tar -fi - -trap - INT TERM EXIT diff --git a/bin/pack-install b/bin/pack-install @@ -1,15 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} - -pack-build "$pack" "$version" || { echo; exit 1; } -echo ' install' -mkdir -p "$PACK/log/$pack/$version" -exec >$PACK/log/$pack/$version/install 2>&1 - -mkdir -p "$PACK/bin" "$PACK/man" -cd "$PACK/pkg/$pack/$version" - -if [ -d bin ]; then cp -RLfp bin "$PACK"; fi -if [ -d man ]; then cp -RLfp man "$PACK"; fi -if [ -d share/man ]; then cp -RLfp share/man "$PACK"; fi diff --git a/bin/pack-tar b/bin/pack-tar @@ -1,15 +0,0 @@ -#!/bin/sh -e -PACK=${PACK:-/var/pack} -pack=$1 version=${2:-$(sed q "/etc/pack/$1/version")} - -trap "rm -rf '$PACK/src/$pack/$version'" EXIT TERM INT - -mkdir -p "$PACK/src/$pack/$version" -tar -xv -f "$PACK/tar/$pack/$version.tar" -C "$PACK/src/$pack/$version" -if [ "$(ls "$PACK/src/$pack/$version" | wc -l | tr -cd 0-9)" = 1 ]; then - ! mv "$PACK/src/$pack/$version/"*/* "$PACK/src/$pack/$version" - ! rmdir "$PACK/src/$pack/$version"/* 2>/dev/null -fi - -trap - EXIT TERM INT -echo archive extracted correctly diff --git a/bin/pack-tree b/bin/pack-tree @@ -1,16 +0,0 @@ -#!/bin/sh -e - -dep() { - while read pack; do - p=${pack##*/} - if test -d "/etc/pack/$p/dependencies"; then ( - cd "/etc/pack/$p/dependencies" - for f in *; do echo "$pack/$f"; done - ); fi | dep - printf '%s\n' "$pack" - done -} - -test $# -gt 0 - -printf '%s\n' "$@" | dep | sort | sed 's/^/ /' | ltree diff --git a/conf/etc b/conf/etc @@ -4,4 +4,6 @@ cd "$(dirname "$0")/.." for path in etc/*; do ln -sf "${PWD}/${path}" /etc + [ -d /etc/pack ] || git clone git://git.josuah.net/packages /etc/pack + [ -d /etc/s6-mk ] || git clone git://git.josuah.net/s6-mk /etc/s6-mk done diff --git a/conf/pack b/conf/pack @@ -0,0 +1,7 @@ +#!/bin/sh -ex + +mkdir -p /var/pack/src/pack +[ -d /var/pack/src/pack/git ] || git clone git://git.josuah.net/pack /var/pack/src/pack/git +cd /var/pack/src/pack/git + +make PREFIX=/var/pack install