dot

packages and services management
Log | Files | Refs | README

commit 8fa48f6bf75ed669c09cd5ebd1b2cb95c071a562
parent be5f22b01c43654d5a154e464d0d83d0c214d3e4
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Sat,  3 Jun 2017 17:00:04 +0200

init-style service script

Diffstat:
Dbnc/build | 3---
Dbnc/url | 1-
Mbuild | 11++++++++++-
Aservice | 33+++++++++++++++++++++++++++++++++
4 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/bnc/build b/bnc/build @@ -1,3 +0,0 @@ -./configure -make PREFIX="$PREFIX" -cp bnc "$OPT/bnc/bin/bnc" diff --git a/bnc/url b/bnc/url @@ -1 +0,0 @@ -http://www.gotbnc.com/downloads/bnc2.9.4.tar.gz diff --git a/build b/build @@ -5,7 +5,14 @@ build() { export PREFIX="$OPT/$1" - cd "$SRC/$1" && if [ -f "$ETC/$1/build" ] + cd "$PREFIX" || exit 1 + mkdir -p bin etc include lib share/man + ln -s . usr + ln -s bin sbin + + cd "$SRC/$1" || exit 1 + + if [ -f "$ETC/$1/build" ] then sh "$ETC/$1/build" else @@ -14,6 +21,8 @@ build() [ -f ./configure ] && ./configure --prefix="$PREFIX" make && make PREFIX="$PREFIX" install clean fi + + rm "$PREFIX/sbin" "$PREFIX/usr" } diff --git a/service b/service @@ -0,0 +1,33 @@ +# simplistic service(1)-like script + +start() +{ + exec sh "$ETC/$2/start" +} + + +stop() +{ + sh "$ETC/$2/stop" +} + +usage() +{ + die 'service start|stop name\n' + exit 1 +} + + +# --- main --------------------------------------------------------------------- + +[ $# -lt 2 ] || usage + +cd "$2" || exit 1 +command=$1 + +case "$1" in +( start ) start "$@" ;; +( stop ) stop "$@" ;; +( restart ) stop "$@" && start "$@" ;; +( * ) usage ;; +esac