dot

packages and services management
Log | Files | Refs | README

commit d950ae231b027e382de15f4e7c0d28cd49735ca7
parent 5f1c7a852753e5f0fb96d66376e08024b8ebf58b
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon, 29 Jan 2018 15:53:19 +0100

back: put log at the root, not replicated

Diffstat:
Mbin/back | 51++++++++++++++++++++++++++-------------------------
Mpack/dwm/build | 1-
Mpack/dwm/config.h | 7++++---
3 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/bin/back b/bin/back @@ -1,51 +1,52 @@ #!/bin/sh -e # store data in hash-indexed backups -BACK="${BACK:-$HOME/back/0}" +BACK="${BACK:-${HOME}/back}" -mkdir -p "$BACK/rev" "$BACK/obj" +mkdir -p "${BACK}/0/rev" "${BACK}/0/obj" sum='b2sum -l 256' -[ -r "$BACK/log" ] && log=$BACK/rev/$(sed -n '$ s/[^ ]* // p' "$BACK/log") +[ -r "${BACK}/log" ] && +log="${BACK}/0/rev/$(sed -n '$ s/[^ ]* // p' "${BACK}/log")" -case $1 in +case "${1}" in (up) - [ -e "$BACK/new" ] && exit 1 + [ -e "${BACK}/0/new" ] && exit 1 find . -type f '(' \ - -exec test "$log" -nt {} ';' \ - -exec grep -F {} "$log" ';' -o \ - -exec $sum {} + \ - ')' | tee "$BACK/new" | + -exec test "${log}" -nt {} ';' \ + -exec grep -F {} "${log}" ';' -o \ + -exec ${sum} {} + \ + ')' | tee "${BACK}/0/new" | while read -r hash path do - [ -f "$BACK/obj/$hash.lz4" ] || - lz4 -q "$path" "$BACK/obj/$hash.lz4" + [ -f "${BACK}/0/obj/${hash}.lz4" ] || + lz4 -q "${path}" "${BACK}/0/obj/${hash}.lz4" done - sort "$BACK/new" -o "$BACK/new" - rev=$($sum "$BACK/new" | sed 's/ .*//') - mv "$BACK/new" "$BACK/rev/$rev" - date +"%Y-%m-%d-%H-%M-%S $rev" >> $BACK/log + sort "${BACK}/0/new" -o "${BACK}/0/new" + rev="$(${sum} "${BACK}/0/new" | sed 's/ .*//')" + mv "${BACK}/0/new" "${BACK}/0/rev/${rev}" + date +"%Y-%m-%d-%H-%M-%S ${rev}" >> ${BACK}/log ;; (to) - more "$BACK/rev/$2" - printf 'apply %s? [Y/n] ' "$2" 1>&2 - case $(sed q) in (y|Y|'') ;; (*) exit 0 ;; esac + more "${BACK}/0/rev/${2}" + printf 'apply %s? [Y/n] ' "${2}" 1>&2 + case "$(sed q)" in (y|Y|'') ;; (*) exit 0 ;; esac find . -mindepth 1 -maxdepth 1 -exec rm -r {} + while read -r hash path do - mkdir -p "$(dirname "$path")" - lz4 -q "$BACK/obj/$hash.lz4" "$path" - done < "$BACK/rev/$2" + mkdir -p "$(dirname "${path}")" + lz4 -q "${BACK}/0/obj/${hash}.lz4" "${path}" + done < "${BACK}/0/rev/${2}" ;; (log) - less "$BACK/log" + less "${BACK}/log" ;; (rsync) - rsync "$2" "$BACK" - rsync "$BACK" "$2" + rsync "${2}" "${BACK}/0" + rsync "${BACK}/0" "${2}" ;; (*) echo 'usage: back up' @@ -54,4 +55,4 @@ case $1 in ;; esac -find "$BACK/obj" -type f -exec chmod -w {} + +find "${BACK}/0/obj" -type f -exec chmod -w {} + diff --git a/pack/dwm/build b/pack/dwm/build @@ -1,7 +1,6 @@ #!/bin/sh -e cp -f "$ETC"/*.h "$SRC" -cp -f "$ETC"/*.c "$SRC" cp -f "$ETC/config.mk" "$SRC/config.mk" make PREFIX="$OPT" install diff --git a/pack/dwm/config.h b/pack/dwm/config.h @@ -5,8 +5,9 @@ static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "terminus:bold:pixelsize=16" }; -static const char dmenufont[] = "terminus:pixelsize=16"; +static const char *fonts[] = { "miniwi:bold:pixelsize=16" }; +static const char dmenufont[] = "miniwi:pixelsize=16"; +static const char termfont[] = "terminus:pixelsize=16"; static const char col_gray1[] = "#222222"; static const char col_gray2[] = "#444444"; static const char col_gray3[] = "#bbbbbb"; @@ -68,7 +69,7 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char *termcmd[] = { "st", "-f", dmenufont, NULL }; +static const char *termcmd[] = { "st", "-f", termfont, NULL }; static Key keys[] = { /* modifier key function argument */