packages and services management
Log | Files | Refs | README

commit dbefee0947902f55a2a2334ad6b9b1589ef8e343
parent a594652e2855da4e50143734faa1bcc4f784d482
Author: Josuah Demangeonā  ā µ <>
Date:   Tue,  4 Apr 2017 19:15:06 +0200

added man page for version

M.profile | 7++++---
Mbin/build | 21+++++++--------------
Aman/man1/build.1 | 143+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aman/man1/version.1 | 157+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rman/www-git.1 -> man/man1/www-git.1 | 0
Rman/www-tree.1 -> man/man1/www-tree.1 | 0
6 files changed, 311 insertions(+), 17 deletions(-)

diff --git a/.profile b/.profile @@ -9,9 +9,10 @@ export CONFIG="$(dirname "$(readlink ~/.profile)")" export PLAN9="$HOME/9" # paths -export PATH="$CONFIG/bin:$PATH:$PLAN9/bin" -export ENV="$HOME/.profile" -export MAIL="$HOME/mail/INBOX" +export PATH="$CONFIG/bin:$PATH:$PLAN9/bin" +export MANPATH="$CONFIG/man" +export ENV="$HOME/.profile" +export MAIL="$HOME/mail/INBOX" # info export NAME='Josuah Demangeon' EMAIL='' TZ='Europe/Paris' diff --git a/bin/build b/bin/build @@ -17,14 +17,7 @@ export MANPATH="$LOCAL/share/man:$LOCAL/man:$MANPATH" usage() { - printf %s "\ -${0##*/} d[ownload] PKG Download PKG's sources -${0##*/} i[nstall] PKG Download then install PKG -${0##*/} r[emove] PKG Remove build PKG and its sources -${0##*/} u[pdate] PKG Delete, then download and install PKG again -${0##*/} l[inks] Update links from ~${PROGRAMS#$HOME} to ~${LOCAL#$HOME} -${0##*/} v[iew] View the list of available packages -" + printf 'build [-d pkg] [-i pkg] [-u pkg] [-l] [-v]\n' exit 0 } @@ -142,32 +135,32 @@ main() mkdir -p "$PROGRAMS" case "$1" in - d | download ) + -d ) download "$2" "$tar" index "$2" ;; - i | install ) + -i ) [ ! -d "$PROGRAMS/$2/src" ] && download "$2" "$tar" compile "$2" index "$2" ;; - r | remove ) + -r ) remove "$2" ;; - u | update ) + -u ) remove "$2" download "$2" "$tar" compile "$2" index "$2" ;; - l | link ) + -l ) find "$PROGRAMS" -maxdepth 1 -mindepth 1 | while IFS='' read -r name do index "${name#$PROGRAMS/}" done ;; - v | view ) + -v ) view ;; * | '' ) diff --git a/man/man1/build.1 b/man/man1/build.1 @@ -0,0 +1,143 @@ +.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 +.Op Fl l +.Op Fl v +. +. +.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. +. +.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. +. +.It Fl l +Update links from +.Ev PROGRAMS +to +.Ev LOCAL . +. +.It Fl v +View the list of available packages. +. +.El +. +. +.Sh ENVIRONMENT +. +. +Every program is installed in its own directory, then every file is +linked to a global index. +. +The +.Ev PATH +and +.Ev MANPATH +have to be updated to the location of the +.Pa bin +and +.Pa man +subdirectories of this index in order to access the binaries and manual +pages interactively. +.Pp +This can be done by sourcing +.Nm +as a regular shell script, with the command: +. +.Bd -literal -offset indent +\&. path/to/build +.Ed +. +.Pp +. +This will export the following environment variables: +. +.Bl -column xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +. +.It Sy Name Ta Sy Default value +. +.It Ev LOCAL Ta Pa $HOME/.local +.It Ev CONFIG Ta Pa $HOME/.config +.It Ev PROGRAMS Ta Pa $HOME/programs +.It Ev PATH Ta Pa $LOCAL/sbin:$LOCAL/bin:$PATH +.It Ev MANPATH Ta Pa $LOCAL/share/man:$LOCAL/man:$MANPATH +.It Ev CPATH Ta Pa $LOCAL/include:$CPATH +.It Ev LIBPATH Ta Pa $LOCAL/lib:$LIBPATH +.It Ev LD_RUN_PATH Ta Pa $LOCAL/lib:$LD_RUN_PATH +.It Ev LD_LIBRARY_PATH Ta Pa $LOCAL/lib:$LD_LIBRARY_PATH +. +.El +. +. +.Sh FILES +. +. +The packages descriptions, URLs, and build rules are stored into files, stored into the +.Pa $CONFIG/build +directory, with one file per package. +.Pp +These are shell scripts sourced by +.Nm +, and their format is as following: +. +.Bd -literal -offset indent +# single line description (no shebang) + +tar= + +build() { + # Optionnal build recipe +} +.Ed +. +.Pp +. +The build recipe is optionnal, and if it is not provided, a default +build recipe will be used instead. +. +. +.Sh AUTHOR +. +. +.Nm +is written by +.An Josuah Demangeon Aq Mt diff --git a/man/man1/version.1 b/man/man1/version.1 @@ -0,0 +1,157 @@ +.Dd Apr 4, 2017 +.Dt VERSION 1 +.Os +. +. +.Sh NAME +. +. +.Nm version +.Nd simple version control and backup system +. +. +.Sh SYNOPSIS +. +. +.Nm +.Op Fl i +.Op Fl n +.Op Fl d Ar rev1 rev2 +.Op Fl r Ar rev +.Op Fl p Ar Pa tree +. +. +.Sh DESCRIPTION +. +. +Version stores the whole content of a directory tree as version +controlled, hashed objects. +. +.Pp +. +This permits backup and restoring the content at any point in the +history, and every file is only backed up once in all and across all +versions. +. +.Pp +. +The files are all copied into the first level of a directory, renamed +to their own SHA-256 hash. +These files are +.Sy objects . +. +.Pp +. +The matching between these files and their original location is also stored +to save the original name of the files. +The files storing this information are +.Sy revisions . +. +.Bl -tag -width indent +. +.It Fl d Ar rev1 rev2 +Diff the changes from +.Ar rev1 +to +.Ar rev2 . +. +.It Fl i +Initialize a new +.Nm +directory at the root of current directory. +. +.It Fl n +New revision is created, saving all modifications form the last saved +revision. +. +.It Fl p Ar Pa tree +Pull the objects from another +.Nm +directory into the current one. +. +.It Fl r Ar rev +Revert the changes to and switch the state to +.Ar rev . +. +.El +. +. +.Sh FILES +. +. +.Bl -tag -width indent +. +.It Pa .v +Main version directory. +The directory in which +.Pa .v +is located is the root version directory. +. +.It Pa .v/obj/ +Directory containing the +.Sy objects +every named after the hash of its content. +. +.It Pa .v/rev/ +Directory containing the +.Sy revisions +which contains the list of files, along with their associated hashes, +in the following format: +. +.Bd -literal +6a2e5ffc2916c10ce723c6866f2680086cef2a1ef0d052b471787adab568bddd ./path/to/file.txt +.Ed +. +.Pp +. +The revisions are also named after their content. +. +.It Pa .v/log +A file containing an history of every revision as a list of name of +revision files, with one revision per line. +. +.El +. +. +.Sh EXAMPLE +. +. +Initialize a new version directory in existing directory +. +.Bd -literal -offset indent +$ cd data/ +$ version -i +.Ed +. +.Pp +. +Create a new revision: +. +.Bd -literal -offset indent +$ version -n +making a new revision +ba49aa8aabb111af9d3837e4fc1a2c4edf91fb092f9093d09a6d7c5fc15e3888 +$ touch test +$ version -n +making a new revision +ba49aa8aabb111af9d3837e4fc1a2c4edf91fb092f9093d09a6d7c5fc15e3888 +9e59e557dad5b2c8b66313a2836afd1970990b885d08e728e6cd5a2a7b7df584 +.Ed +. +.Pp +. +Diffing last two revisions: +. +.Bd -literal -offset indent +$ version -d $(tail -n 2 .v/log) +\&... +.Ed +. +.Pp +. +Find the revision corresponding to a file: +. +.Bd -literal -offset indent +$ grep -rlF path/to/file.txt .v/rev/ +\&.v/rev/9e59e557dad5b2c8b66313a2836afd1970990b885d08e728e6cd5a2a7b7df584 +.Ed diff --git a/man/www-git.1 b/man/man1/www-git.1 diff --git a/man/www-tree.1 b/man/man1/www-tree.1