dot

packages and services management
Log | Files | Refs | README

commit abcfca86203ca71d5dbe18737c84d8c21e7f89a9
parent aff552006cefcc038f0c2efa7745855f86be7ece
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 15 Aug 2018 17:16:08 +0200

pack/bin: adapt pack-* tools to new scheme

Diffstat:
Abin/doc | 3+++
Abin/hgreap | 3+++
Mbin/pack-add | 12++++--------
Mbin/pack-get | 14+++-----------
Mdata/uri | 1+
Mdot/profile | 1+
Mpack/bin/pack-build | 7+++----
Mpack/bin/pack-chroot | 10+++++-----
Mpack/bin/pack-cvs | 6+++---
Mpack/bin/pack-del | 1+
Mpack/bin/pack-git | 4++--
Mpack/bin/pack-tar | 23++++++++++-------------
12 files changed, 39 insertions(+), 46 deletions(-)

diff --git a/bin/doc b/bin/doc @@ -0,0 +1,3 @@ +#!/bin/sh -e + +ls "$DOCPATH" diff --git a/bin/hgreap b/bin/hgreap @@ -0,0 +1,3 @@ +#!/bin/sh -e + +find /usr/include -name '*.[hc]' -exec grep "$@" {} + diff --git a/bin/pack-add b/bin/pack-add @@ -1,16 +1,12 @@ #!/bin/sh -e # build a program into /opt/<package>/<version> and symlink it into /local -export VERSION=$(tail -n 1 "/etc/pack/$1/version") - test -f "/etc/pack/$1/dep" && xargs -n 1 pack-add </etc/pack/$1/dep -test -d "/opt/$1/$VERSION" || pack-build "$1" || { - rm -rf "/opt/$1/$VERSION" +test -e "/opt/$1" || pack-build "$1" || { + rm -rf "/opt/$1" exit 1 } printf '\033[1m[ installing %s version %s ]\033[m\n' "$1" "$VERSION" -ln -sf "$VERSION" "/opt/$1/$VERSION/cur" -mv -f "/opt/$1/$VERSION/cur" "/opt/$1" -cd "/opt/$1/cur" +cd "/opt/$1" find -L * -type d -exec sh -c 'mkdir -p "/local/$0"' {} \; -find -L * -type f -exec sh -c 'ln -sf "/opt/$1/cur/$0" "/local/$0"' {} "$1" \; +find -L * -type f -exec sh -c 'ln -sf "/opt/$1/$0" "/local/$0"' {} "$1" \; diff --git a/bin/pack-get b/bin/pack-get @@ -5,14 +5,6 @@ export VERSION=$(tail -n 1 /etc/pack/$1/version) printf '\033[1m[ downloading version %s ]\033[m\n' "$1" "$VERSION" -case $VERSION in -(git) - test -f "/etc/pack/$1/git" && exec pack-git "$1" - ;; -(cvs) - test -f "/etc/pack/$1/cvs" && exec pack-cvs "$1" - ;; -(*) - test -f "/etc/pack/$1/tar" && exec pack-tar "$1" - ;; -esac +test -f "/etc/pack/$1/git" && exec pack-git "$1" +test -f "/etc/pack/$1/cvs" && exec pack-cvs "$1" +test -f "/etc/pack/$1/tar" && exec pack-tar "$1" diff --git a/data/uri b/data/uri @@ -196,6 +196,7 @@ radio://bitreich.org:3232/live radio://glitched.xyz:8000 radio://lainon.life:8000/cyberia.ogg radio://radio.phallic.io:8000/listen +radios://plaza.one/ogg radios://radio.2f30.org:8443/live.mp3 sftp://lainon@archive.sh ssh://bitreich.org diff --git a/dot/profile b/dot/profile @@ -19,6 +19,7 @@ export LC_TIME=en_US.UTF-8 export PATH=$HOME/conf/bin:/local/bin:$PATH export MANPATH=/usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man export MANPATH=/local/share/man:$MANPATH +export DOCPATH=/local/share/doc # programs export CVSROOT=anoncvs@anoncvs.fr.openbsd.org:/cvs diff --git a/pack/bin/pack-build b/pack/bin/pack-build @@ -1,12 +1,11 @@ #!/bin/sh -e # build a source from /src/<package>/<version> into /opt/<package>/<version> -export VERSION=$(tail -n 1 "/etc/pack/$1/version") export PACK=/etc/pack/$1 -export PREFIX=/opt/$1/$VERSION +export PREFIX=/opt/$1 -test -d "/src/$1/$VERSION" || pack-get "$1" +test -d "/src/$1" || pack-get "$1" printf '\033[1m[ building %s ]\033[m\n' "$1" -cd "/src/$1/$VERSION" +cd "/src/$1" mkdir -p "$PREFIX" exec "/etc/pack/$1/build" diff --git a/pack/bin/pack-chroot b/pack/bin/pack-chroot @@ -12,11 +12,11 @@ mkdir -p etc/pack bin dev # # Resources used for bootstraping # -pack-add busybox -pack-add dash -CC="$(readlink -f "$(command -v cc)")" -cp "$CC" bin/"$(basename "$CC")" -ln -s "$(basename "$CC")" bin/cc +pack-add busybox/cur +pack-add dash/cur +cp "$(readlink -f "$(command -v cc)")" bin/cc +cp "$(readlink -f "$(command -v as)")" bin/as +cp "$(readlink -f "$(command -v ld)")" bin/ld # # Tools used diff --git a/pack/bin/pack-cvs b/pack/bin/pack-cvs @@ -1,8 +1,8 @@ #!/bin/sh -e # download a cvs repository into /src/<package>/cvs -test -d "/src/$1/cvs" && exit 0 -mkdir -p "/src/$1/cvs" -cd "/src/$1/cvs" +test -d "/src/$1" && exit 0 +mkdir -p "/src/$1" +cd "/src/$1" read -r url path </etc/pack/$1/cvs cvs -qd "$url" checkout -P "$path" diff --git a/pack/bin/pack-del b/pack/bin/pack-del @@ -1,4 +1,5 @@ #!/bin/sh -e +# remove all files installed by a package from /local printf '\033[1m[ deleting %s ]\033[m\n' "$1" cd /opt/$1/cur diff --git a/pack/bin/pack-git b/pack/bin/pack-git @@ -1,6 +1,6 @@ #!/bin/sh -e # download a git repository into /src/<package>/git -test -d "/src/$1/git" && exit 0 +test -d "/src/$1" && exit 0 IFS="" read -r url </etc/pack/$1/git -git clone "$url" "/src/$1/git" +git clone "$url" "/src/$1" diff --git a/pack/bin/pack-tar b/pack/bin/pack-tar @@ -1,17 +1,14 @@ #!/bin/sh -e # download a tar source package into a /opt/<pakage>/<version> -export VERSION=$(tail -n 1 "/etc/pack/$1/version") - -test -d "/src/$1/$VERSION" && exit 0 -mkdir -p "/src/$1/$VERSION" -url=$(awk -v v="$VERSION" 'gsub("%s", v) || 1' "/etc/pack/$1/tar") +test -d "/src/$1" && exit 0 +mkdir -p "/src/$1" +IFS='' read -r url </etc/pack/$1/tar wget -O - "$url" | case $url in -(*.tgz|*.tar.gz) gzip -d - ;; -(*.tbz|*.tar.bz2) bzip2 -d - ;; -(*.txz|*.tar.xz) xz -d - ;; -(*.tlz|*.tar.lz) lzip -d - ;; -esac | tar -xf - -C "/src/$1/$VERSION" || - exec rm -rf "/src/$1/$VERSION" -mv "/src/$1/$VERSION"/*/* "/src/$1/$VERSION" -rmdir "/src/$1/$VERSION"/* 2>/dev/null || true +(*.tgz|*.tar.gz) gzip -d - ;; +(*.tbz|*.tar.bz2) bzip2 -d - ;; +(*.txz|*.tar.xz) xz -d - ;; +(*.tlz|*.tar.lz) lzip -d - ;; +esac | tar -xf - -C "/src/$1" || exec rm -rf "/src/$1" +mv "/src/$1"/*/* "/src/$1" +rmdir "/src/$1"/* 2>/dev/null || true