dot

packages and services management
Log | Files | Refs | README

commit 4926c2e77de430885c7d4a81d9849d0630e6ae43
parent 6d7cfb2bfe78192eb0a4ace46864ebaa1b073bed
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Thu, 24 Aug 2017 01:19:14 +0200

package.mk: converting pkg to a port tree

Diffstat:
Dmini_httpd/build | 4----
Dmini_httpd/crash | 1-
Dmini_httpd/run | 1-
Dmini_httpd/tar | 1-
Apackage.mk | 43+++++++++++++++++++++++++++++++++++++++++++
Mpkg/bin/pkg-configure | 3---
Mpkg/bin/pkg-tar | 7++-----
7 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/mini_httpd/build b/mini_httpd/build @@ -1,4 +0,0 @@ -make -mkdir -p "$PREFIX/bin" "$PREFIX/share/man/man8" -cp mini_httpd "$PREFIX/bin" -cp mini_httpd.8 "$PREFIX/share/man/man8" diff --git a/mini_httpd/crash b/mini_httpd/crash @@ -1 +0,0 @@ -pkg-service start mini_httpd diff --git a/mini_httpd/run b/mini_httpd/run @@ -1 +0,0 @@ -mini_httpd -D -v -d "$ROOT/var/www" -dd "$ROOT/var/www" & PID=$! diff --git a/mini_httpd/tar b/mini_httpd/tar @@ -1 +0,0 @@ -http://www.acme.com/software/mini_httpd/mini_httpd-1.27.tar.gz diff --git a/package.mk b/package.mk @@ -0,0 +1,43 @@ +SRC = $(ROOT)/src/${NAME} +OPT = $(ROOT)/opt/${NAME} +PKG = $(ROOT)/pkg/${NAME} + +src: + mkdir -p '${SRC}' + +opt: + mkdir -p ${OPT}/bin ${OPT}/etc ${OPT}/lib ${OPT}/include + mkdir -p ${OPT}/share/man + +git: src + git clone ${GIT} $(ROOT)/src/${NAME} + +tar: src + wget -O - '${TAR}' | case '${TAR}' in \ + (*bz2) bunzip2 -d ;; (*gz) gzip -d ;; (*xz) xz -d ;; (*tar) tee ;; \ + esac | tar -xf -C '$(ROOT)/src/${NAME}' + + find '${SRC}' -maxdepth 2 -mindepth 2 | xargs -I % mv % . + +autoconf: opt + ${SRC}/configure --prefix=${OPT} + make makefile + +makefile: opt + cd ${SRC} && make + +remove: + rm -rf ${SRC} ${OPT} + +dotfiles: + cd ${PGK} && find . -type d -exec mkdir -p $(HOME)/{} + + cd ${PGK} && find . -type f -exec ln -s {} $(HOME)/{} + + + find -L $(HOME) -type l -exec rm {} + + +crontab: + mkdir -p $(ROOT)/etc + [ -f "${PKG}/cron" ] && tee -a "$ROOT/etc/crontab" < "${PKG}/cron" + sort -u "$ROOT/etc/crontab" -o "$ROOT/etc/crontab" + +.PHONY: src opt git tar autoconf makefile remove dotfiles crontab diff --git a/pkg/bin/pkg-configure b/pkg/bin/pkg-configure @@ -1,6 +1,5 @@ ROOT=${ROOT:-$HOME} - # --- dotfiles ----------------------------------------------------------------- find "$ROOT/pkg/${1:-}" -path "$ROOT/pkg/*/.*" | while IFS='' read -r path @@ -11,14 +10,12 @@ done find -L "$ROOT" -type l -exec rm {} + 2> /dev/null - # --- crontab ------------------------------------------------------------------ mkdir -p "$ROOT/etc" [ -f "$ROOT/pkg/$1/cron" ] && tee -a "$ROOT/etc/crontab" < "$ROOT/pkg/$1/cron" sort -u "$ROOT/etc/crontab" -o "$ROOT/etc/crontab" - # --- configure ---------------------------------------------------------------- if [ ! -f "$ROOT/pkg/$1/configure" ] diff --git a/pkg/bin/pkg-tar b/pkg/bin/pkg-tar @@ -2,13 +2,10 @@ IFS='' read -r tar < "$ROOT/pkg/$1/tar" || exit 1 [ -e "$ROOT/src/$1" ] && exit 1 -mkdir -p "$ROOT/src/$1" && cd "$ROOT/src/$1" +mkdir -p "$(ROOT)/src/${NAME}" && cd "$ROOT/src/${NAME}" wget -O - "$tar" | case "$tar" in -(*.tar.bz2 | *.tbz2) bunzip2 -d ;; -(*.tar.gz | *.tgz ) gzip -d ;; -(*.tar.xz | *.txz ) xz -d ;; -(*.tar ) tee ;; +(*bz2) bunzip2 -d ;; (*gz) gzip -d ;; (*xz) xz -d ;; (*tar) tee ;; esac | tar -xf - find . -maxdepth 2 -mindepth 2 | xargs -I % mv % .