dot

packages and services management
Log | Files | Refs | README

commit 5b7db5a3a6ca854fde5ec4f057060087482b4574
parent 33685adbe2f92ada1910cc1c4d4e4c9e034871e8
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Sun, 23 Jul 2017 17:10:52 +0200

added a README and changed rc path

Diffstat:
MBUILD | 2+-
MCONFIG | 2+-
MDOWNLOAD | 2+-
MINSTALL | 2+-
AREADME | 24++++++++++++++++++++++++
MREMOVE | 2+-
MSERVICE | 5+----
Mbin/monitor | 2++
Dbin/status | 50--------------------------------------------------
Rprofile -> rc | 0
10 files changed, 32 insertions(+), 59 deletions(-)

diff --git a/BUILD b/BUILD @@ -1,4 +1,4 @@ -. "${0%/*}/profile" +. "${0%/*}/rc" mkdir -p "$OPT/$1" && cd "$OPT/$1" || exit 1 export PREFIX="$PWD" diff --git a/CONFIG b/CONFIG @@ -1,4 +1,4 @@ -. "$(dirname "$0")/profile" +. "${0%/*}/rc" find "$ETC" -path "$ETC/*/.*" | while IFS='' read -r path do diff --git a/DOWNLOAD b/DOWNLOAD @@ -1,4 +1,4 @@ -. "${0%/*}/profile" +. "${0%/*}/rc" read url < "$ETC/$1/url" diff --git a/INSTALL b/INSTALL @@ -1,4 +1,4 @@ -. "${0%/*}/profile" +. "${0%/*}/rc" exit=0 diff --git a/README b/README @@ -0,0 +1,24 @@ +combined package and service manager, but... + +- no package declaration +- no config file +- no start-stop-daemon(8) + +To download, build, instal and start some 'pkg': + +0. $ package-manager-install git gcc make + $ git clone http://github.com/josuah/etc && cd etc + +1. $ ./DOWNLOAD pkg http -> $SRC (with $ETC/pkg/url) + +2. $ ./BUILD pkg $SRC -> $OPT (with $ETC/pkg/build) + +3. $ ./INSTALL pkg $OPT -> $ROOT + +4. $ ./SERVICE start pkg [args] (with $ETC/pkg/start) + +And then 'pkg' is (hopefully) installed and running. To be sure: + +5. $ ./SERVICE status pkg [words to grep] + +$SRC, $OPT, $ROOT, $ETC and $VAR are set in ./rc diff --git a/REMOVE b/REMOVE @@ -1,4 +1,4 @@ -. "${0%/*}/profile" +. "${0%/*}/rc" rm -rf "${OPT:?}/$1" "${SRC:?}/$1" find -L "$ROOT" -type l -exec rm {} + diff --git a/SERVICE b/SERVICE @@ -1,7 +1,4 @@ -# service manager - - -. "${0%/*}/profile" +. "${0%/*}/rc" usage() diff --git a/bin/monitor b/bin/monitor @@ -13,6 +13,8 @@ case "$(uname)" in (Solaris) mem=free cpu=id bi='' bo='' b="$disks" ;; esac +disks=$(df | sed -r '1d; s|^/dev/([^ ]*)[^ ] .*|\1|' | sort -u | tr '\n' ' ') + vmstat 2 2 | awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" -v disks="$disks" ' diff --git a/bin/status b/bin/status @@ -1,50 +0,0 @@ -# ressources monitoring script - -# It will produce one line with the following values, separated with a space: -# -# 1. hostname 5. load average (1 minute) -# 2. date-time 6. disk I/O -# 3. free memory 7. total free storage -# 4. cpu usage - -case "$(uname)" in -(Linux ) mem=free cpu=id bi=bi bo=bo b='' ;; -(*BSD ) mem=fre cpu=id bi='' bo='' b="$disks" ;; -(Solaris) mem=free cpu=id bi='' bo='' b="$disks" ;; -esac - -disks=$(df | sed -r '1d; s|^/dev/([^ ]*)[^ ] .*|\1|' | sort -u | tr '\n' ' ') - -vmstat 2 2 | -awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" -v disks="$disks" ' - -BEGIN { - "date +%Y-%m-%d-%H-%M" | getline date - "hostname" | getline host - "uptime" | getline load - - sub(/.*[Ll]oad[^0-9]*/, "", load) - sub(/[^0-9.].*/, "", load) - - split(disks, diskv, " ") - - while ("df" | getline) - if ($1 ~ "^/dev/") - stor += $4 -} - -NR == 2 { split($0, keys, " ") } - -NR >= 4 { - for (i = split($0, values, " "); i > 0; i--) - table[keys[i]] = values[i] - - diskio = table[bi] + table[bo] - mem = table[mem] - cpu = 100 - table[cpu] - - for (disk in diskv) - diskio += table[disk] - - print host " " date " " mem " " cpu " " load " " diskio " " stor -}' diff --git a/profile b/rc