dot

packages and services management
Log | Files | Refs | README

commit 604f887a60264a99f518c9e865bb5e2598229b72
parent 3907fa732fe42c37d199fdcb09bd6b42fe2fffdc
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Tue,  1 Aug 2017 15:07:32 +0200

new structure: ETC -> PKG - HOME -> ROOT - $HOME/.local -> $HOME

Diffstat:
MREADME | 8++++----
Mdma/build | 2+-
Aex-vi/build | 4++++
Miomenu/bin/io-setfont | 2+-
Mngircd/start | 2+-
Mrc | 19++++++++++---------
Mscripts/bin/fig | 2+-
Mscripts/bin/io | 2+-
Mscripts/bin/pkg-build | 8++++----
Mscripts/bin/pkg-configure | 6+++---
Mscripts/bin/pkg-download | 2+-
Mscripts/bin/pkg-git | 2+-
Mscripts/bin/pkg-remove | 2+-
Mscripts/bin/pkg-service | 4++--
Dscripts/build.1 | 127-------------------------------------------------------------------------------
Mshell/.profile | 7+++----
Mst/build | 4++--
17 files changed, 40 insertions(+), 163 deletions(-)

diff --git a/README b/README @@ -9,16 +9,16 @@ 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) +1. $ ./DOWNLOAD pkg http -> $SRC (with $PKG/pkg/url) -2. $ ./BUILD pkg $SRC -> $OPT (with $ETC/pkg/build) +2. $ ./BUILD pkg $SRC -> $OPT (with $PKG/pkg/build) 3. $ ./INSTALL pkg $OPT -> $ROOT -4. $ ./SERVICE start pkg [args] (with $ETC/pkg/start) +4. $ ./SERVICE start pkg [args] (with $PKG/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 ./profile +$SRC, $OPT, $ROOT, $PKG and $VAR are set in ./profile diff --git a/dma/build b/dma/build @@ -3,7 +3,7 @@ mkdir -p "$PREFIX/bin" "$PREFIX/share/man/man8" "$VAR/spool/dma" case "$(uname)" in (*BSD ) cd bsd ;; esac make PREFIX="$PREFIX" \ - CONFDIR="$ETC/dma" \ + CONFDIR="$PKG/dma" \ VAR="$VAR" \ CFLAGS+="-I$OPT/libopenssl/include" \ LDFLAGS+="-L$OPT/libopenssl/lib" diff --git a/ex-vi/build b/ex-vi/build @@ -0,0 +1,4 @@ +make +mkdir -p "$PREFIX/bin" "$PREFIX/share/man/man1" +cp ex "$PREFIX/bin" +ln -s ex "$PREFIX/bin/vi" diff --git a/iomenu/bin/io-setfont b/iomenu/bin/io-setfont @@ -1,3 +1,3 @@ # set tty font using iomenu -l 255 -p setfont -find "$ETC/consolefonts" -type f | sort | iomenu -l 255 -p setfont | xargs setfont +find "$PKG/consolefonts" -type f | sort | iomenu -l 255 -p setfont | xargs setfont diff --git a/ngircd/start b/ngircd/start @@ -1 +1 @@ -ngircd -f "$ETC/ngircd/ngircd.conf" -n & PID=$! +ngircd -f "$PKG/ngircd/ngircd.conf" -n & PID=$! diff --git a/rc b/rc @@ -1,20 +1,21 @@ -export ETC="$HOME/etc" -export OPT="$HOME/opt" -export SRC="$HOME/src" -export GIT="$HOME/git" -export VAR="$HOME/var" +export ROOT="$HOME" -export ROOT="$HOME/.local" +export PKG="$ROOT/pkg" +export OPT="$ROOT/opt" +export SRC="$ROOT/src" +export GIT="$ROOT/git" +export VAR="$ROOT/var" +export PATH="$ROOT/bin:$PATH" export MANPATH="$ROOT/man:$MANPATH" export C_INCLUDE_PATH="$ROOT/include" export LIBRARY_PATH="$ROOT/.local/lib" export LD_LIBRARY_PATH="$ROOT/lib:$LD_LIBRARY_PATH" -for bin in "$ETC/bin" "$ETC"/*/bin "$OPT"/*/bin +for bin in "$PKG"/*/bin do [ -d "$bin" ] && export PATH="$bin:$PATH" done -for profile in "$ETC"/*/profile -do [ -f "$ETC"/*/profile ] && . "$profile" +for profile in "$PKG"/*/profile +do [ -f "$PKG"/*/profile ] && . "$profile" done diff --git a/scripts/bin/fig b/scripts/bin/fig @@ -13,7 +13,7 @@ do [ "$print" = 1 ] && [ "$line" = '' ] && break [ "$print" = 1 ] && printf '%s\n' "$line" [ "$line" = "$character" ] && print=1 - done < "$ETC/fig/${FONT:-1}" | sed 's/;$//' + done < "$PKG/fig/${FONT:-1}" | sed 's/;$//' ) l1="$l1$1 " diff --git a/scripts/bin/io b/scripts/bin/io @@ -81,7 +81,7 @@ selection=$({ cat "$HOME/.cache/io" printf '# %s\n' url - cat "$HOME"/var/url/* "$ETC/var/url" + cat "$HOME"/var/url/* "$PKG/var/url" cut -d ' ' -f 1 "$HOME/.ssh/known_hosts" | sed -r 's|^|ssh://root@|' } | iomenu -p io -s -h | cut -c 3-) diff --git a/scripts/bin/pkg-build b/scripts/bin/pkg-build @@ -5,12 +5,12 @@ ln -s bin sbin cd "$SRC/$1" || exit 1 -if [ -f "$ETC/$1/build" ] +if [ -f "$PKG/$1/build" ] then - sh "$ETC/$1/build" + sh "$PKG/$1/build" else - find "$ETC/${PWD##*/}" -name '*.diff' -exec patch -N -p 1 -i {} ';' - find "$ETC/${PWD##*/}" -name 'config.*' -exec cp -f {} . ';' + find "$PKG/${PWD##*/}" -name '*.diff' -exec patch -N -p 1 -i {} ';' + find "$PKG/${PWD##*/}" -name 'config.*' -exec cp -f {} . ';' [ -f ./configure ] && ./configure --prefix="$PREFIX" make && make PREFIX="$PREFIX" install clean fi diff --git a/scripts/bin/pkg-configure b/scripts/bin/pkg-configure @@ -1,7 +1,7 @@ -find "$ETC" -path "$ETC/*/.*" | while IFS='' read -r path +find "$PKG" -path "$PKG/*/.*" | while IFS='' read -r path do - [ -d "$path" ] && mkdir -p "$HOME/${path#$ETC/*/}" - [ -f "$path" ] && ln -sf "$path" "$HOME/${path#$ETC/*/}" + [ -d "$path" ] && mkdir -p "$HOME/${path#$PKG/*/}" + [ -f "$path" ] && ln -sf "$path" "$HOME/${path#$PKG/*/}" done find -L "$HOME" -type l -exec rm {} + diff --git a/scripts/bin/pkg-download b/scripts/bin/pkg-download @@ -1,4 +1,4 @@ -read tar < "$ETC/$1/tar" +read tar < "$PKG/$1/tar" [ -e "$SRC/$1" ] && exit 1 diff --git a/scripts/bin/pkg-git b/scripts/bin/pkg-git @@ -1,3 +1,3 @@ -IFS='' read -r git < "$ETC/$1/git" +IFS='' read -r git < "$PKG/$1/git" mkdir -p "$SRC" git clone "$git" "$SRC/$1" diff --git a/scripts/bin/pkg-remove b/scripts/bin/pkg-remove @@ -1,2 +1,2 @@ -rm -rf "${OPT:?}/$1" "${SRC:?}/$1" +rm -rf "${OPT:?}/${1:?}" "${SRC:?}/${1:?}" find -L "$ROOT" -type l -exec rm {} + diff --git a/scripts/bin/pkg-service b/scripts/bin/pkg-service @@ -14,7 +14,7 @@ shift 2 case "$cmd" in ( start | stop | restart | status ) : ;; ( * ) usage ;; esac -[ ! -f "$ETC/$srv/start" ] && echo "no start script in $ETC/$1" && exit 1 +[ ! -f "$PKG/$srv/start" ] && echo "no start script in $PKG/$1" && exit 1 # --- main --------------------------------------------------------------------- @@ -49,7 +49,7 @@ done if [ "$run" = 0 ] && [ "$cmd" = start ] || [ "$cmd" = restart ] then mkdir -p "$VAR/pid/$srv" - . "$ETC/$srv/start" "$@" >> "$VAR/log/$srv" 2>&1 && + . "$PKG/$srv/start" "$@" >> "$VAR/log/$srv" 2>&1 && cp "/proc/$PID/cmdline" "$VAR/pid/$srv/$PID" printf '%-15s [started] ' "$srv" diff --git a/scripts/build.1 b/scripts/build.1 @@ -1,127 +0,0 @@ -.Dd Mar 04, 2017 -.Dt BUILD 1 -.Os -. -. -.Sh NAME -. -. -.Nm build -.Nd Install sources from build receipes -. -. -.Sh SYNOPSIS -. -. -.Nm -.Op Fl d Ar pkg -.Op Fl i Ar pkg -.Op Fl r Ar pkg -.Op Fl u Ar pkg -. -. -.Sh DESCRIPTION -. -. -.Nm -helps with the compilation of software in the home directory of an user. -It downloads an archive from a specified URL and extracts it. -. -.Pp -. -Every program is installed in its own subdirectory in -.Ev SRC , -then every file is linked to a global index in -.Ev OPT . -. -.Pp -. -The -.Ev PATH , -.Ev MANPATH , -.Ev LIBPATH , -.Ev LD_RUN_PATH , -.Ev LD_LIBRARY_PATH , -may be updated to the location of the -.Pa bin , -.Pa man , -.Pa lib -subdirectories of this index. -.Pp -. -.Bl -tag -width indent -. -.It Fl d Ar pkg -Download and extract the source of -.Ar pkg . -. -.It Fl i Ar pkg -Download -.Ar pkg -if not present, build it, and install it. -. -.It Fl r Ar pkg -Remove -.Ar pkg -and its sources. -. -.It Fl u Ar pkg -Delete, then download and install -.Ar pkg -again. -. -.El -. -. -.Sh ENVIRONMENT -. -. -.Bl -tag -width indent -. -.It Ev ROOT -Directory the files get linked into. -. -.It Ev ETC -Directory containing the -.Pa ./build -directory. -. -.It Ev SRC -Directory containing the sources of programs. -. -.It Ev OPT -Directory programs get build into. -. -.El -. -. -.Sh FILES -. -. -.Bl -tag -width indent -. -.It Pa $ETC/build/ -Contains one subdirectory per package. -. -.It Pa $ETC/build/*/build.sh -Build recipes executed at build time. If none exist for a given package, -a default recipe is used. -. -.It Pa $ETC/build/*/url -File containing the url to download the archive, in the -.Pa .tar , -.Pa .tar.gz , -.Pa .tar.bz2 -or -.Pa .tar.xz -format. -. -.El -. -. -.Sh AUTHOR -. -. -.Nm -is written by -.An Josuah Demangeon Aq Mt mail@josuah.net diff --git a/shell/.profile b/shell/.profile @@ -1,4 +1,4 @@ -. "$HOME/etc/rc" +. "$HOME/pkg/rc" export NAME='Josuah Demangeon' export TZ='Europe/Paris' @@ -7,6 +7,5 @@ export NICK='josuah' export MAIL="$VAR/mail/INBOX" export EMAIL='mail@josuah.net' -export EDITOR=less VISUAL=less -command -v rlwrap && LESSEDIT='rlwrap ed' || LESSEDIT='ed' -export LESSEDIT="$LESSEDIT -p '$(printf '\033[36;1m>\033[m ')' %f" +command -v rlwrap && LESSEDIT='rlwrap ex +%lm %f' || LESSEDIT='ed' +export EDITOR=less VISUAL=less LESSEDIT diff --git a/st/build b/st/build @@ -1,6 +1,6 @@ -cp -f "$ETC/build/st/config.mk" config.mk +cp -f "$PKG/build/st/config.mk" config.mk -find "$ETC/build/st/" -name '*.diff' | xargs patch -N -p 1 -i +find "$PKG/build/st/" -name '*.diff' | xargs patch -N -p 1 -i sed 's/gray90/#eeeeee/; s/black/#000000/; s/white/#ffffff/' config.def.h > config.h