dot

packages and services management
Log | Files | Refs | README

commit 741b177683f221ec929f20a4ad88b641e38dd5cb
parent 2f7810ea638320c5f0f33838781a33f77eae3bc7
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon,  8 Jan 2018 09:04:32 +0100

backup script (no restore nor sync yet)

Diffstat:
Mbin/back | 27++++++++++++++++++++++-----
Apack/b2sum/build | 5+++++
Apack/b2sum/git | 1+
Mpack/busybox/build | 15++-------------
4 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/bin/back b/bin/back @@ -1,9 +1,26 @@ -#!/bin/back +#!/bin/sh -e # organize data for backup and sychronisation BACK="${BACK:-$HOME/back}" -find . -type f | sort | while IFS='' read -r file -do - -done +mkdir -p "$BACK/ref" "$BACK/obj" +sum='b2sum -l 256' +[ -r "$BACK/log" ] && log=$BACK/ref/$(sed -n '$ s/[^ ]* // p' "$BACK/log") + +case $1 in +(new) + find . -type f | sort | while read -r path + do [ "$log" -nt "$path" ] && grep -F "$path" "$log" || $sum "$path" + done | tee "$BACK/new" | while read -r hash path + do [ -f "$BACK/obj/$hash" ] || cp "$path" "$BACK/obj/$hash" + done + + ref=$($sum "$BACK/new" | sed 's/ .*//') + mv "$BACK/new" "$BACK/ref/$ref" + date +"%Y-%m-%d-%H-%M-%S $ref" >> $BACK/log + ;; +(*) + ;; +esac + +find "$BACK/obj" -type f -exec chmod -w {} + diff --git a/pack/b2sum/build b/pack/b2sum/build @@ -0,0 +1,5 @@ +#!/bin/sh -e + +cd b2sum +make NO_OPENMP=1 +make PREFIX="$OPT" install diff --git a/pack/b2sum/git b/pack/b2sum/git @@ -0,0 +1 @@ +git://github.com/BLAKE2/BLAKE2 diff --git a/pack/busybox/build b/pack/busybox/build @@ -1,14 +1,3 @@ -#!/bin/sh -set -e +#!/bin/sh -e -export CFLAGS="$CFLAGS -static -isystem $SYSROOT/include" -export CFLAGS_busybox="-Wl,-z,muldefs -Werror-implicit-function-declaration" -export LDFLAGS="$LDFLAGS -static -isystem $SYSROOT/include" - -make $MAKEFLAGS CC="$CC" CROSS_COMPILE="$CROSS_COMPILE" CFLAGS="$CFLAGS" CFLAGS_busybox="$CFLAGS_busybox" LDFLAGS="$LDFLAGS" -make $MAKEFLAGS busybox.links -sed -i 's,/sbin,/bin,g' busybox.links - -install -D busybox "$DESTDIR/bin/busybox" -install -D docs/busybox.1 "$DESTDIR/share/man/man1/busybox.1" -cat busybox.links|while read p; do ln -sf busybox "$DESTDIR$OPT$p"; done +case ${uname} in (Linux) make=make ;; (*BSD) make=gmake ;; esac