]> arthur.barton.de Git - ax-unix.git/commitdiff
Initial commit
authorAlexander Barton <alex@barton.de>
Wed, 28 May 2014 10:41:44 +0000 (12:41 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 28 May 2014 10:41:44 +0000 (12:41 +0200)
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
Makefile [new file with mode: 0644]
Makefile.ax [new file with mode: 0644]
README [new file with mode: 0644]
bup/Makefile [new file with mode: 0644]
bup/save-user/Makefile [new file with mode: 0644]
bup/save-user/bup-save-user [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..9ebacba
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Alexander Barton <alex@barton.de>
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..7327ace
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,13 @@
+#
+# ax-unix: Alex' UNIX Tools & Scripts
+# Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+SUBDIRS = bup
+
+include Makefile.ax
diff --git a/Makefile.ax b/Makefile.ax
new file mode 100644 (file)
index 0000000..180ce3c
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# ax-make: Alex' Simple Makefile System
+# Copyright (c)2014 Alexander Barton (alex@barton.de)
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+
+AX_SILENT ?= @
+
+PREFIX ?= /usr/local
+
+USER ?= $(shell id -un)
+GROUP ?= $(shell stat --format=%G $(DESTDIR)$(PREFIX) 2>/dev/null || id -gn)
+
+all: all-ax all-local
+
+all-ax: $(ALL) $(SUBDIRS)
+
+clean: clean-ax clean-local
+
+distclean: clean-local distclean-ax distclean-local
+
+maintainer-clean: clean-local distclean-local maintainer-clean-ax maintainer-clean-local
+
+check: check-pre check-ax check-local check-post
+
+install: install-ax install-local
+
+all-ax clean-ax distclean-ax maintainer-clean-ax check-ax install-ax:
+       $(AX_SILENT)for subdir in $(SUBDIRS); do \
+         target=`echo "$@" | sed -e 's/-ax$$//'`; \
+         echo "Making \"$$target\" in \"$$subdir\" ..."; \
+         $(MAKE) -C $$subdir $$target || exit 1; \
+        done
+
+.PHONY: all clean distclean maintainer-clean check install
+.PHONY: all-ax clean-ax distclean-ax maintainer-clean-ax check-ax install-ax
+.PHONY: all-local clean-local distclean-local maintainer-clean-local check-local install-local
+.PHONY: check-pre check-post
+.PHONY: $(SUBDIRS)
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..8761648
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+ax-unix: Alex' UNIX Tools & Scripts
diff --git a/bup/Makefile b/bup/Makefile
new file mode 100644 (file)
index 0000000..4471916
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# ax-unix: Alex' UNIX Tools & Scripts
+# Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+SUBDIRS = save-user
+
+include ../Makefile.ax
diff --git a/bup/save-user/Makefile b/bup/save-user/Makefile
new file mode 100644 (file)
index 0000000..ecc8796
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# ax-unix: Alex' UNIX Tools & Scripts
+# Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+ALL = bup-save-user
+
+include ../../Makefile.ax
+
+install-local: bup-save-user
+       install -d -o $(USER) -g $(GROUP) -m 755 \
+        $(DESTDIR)$(PREFIX)/bin
+       install -p -o $(USER) -g $(GROUP) -m 755 bup-save-user \
+        $(DESTDIR)$(PREFIX)/bin/bup-save-user
diff --git a/bup/save-user/bup-save-user b/bup/save-user/bup-save-user
new file mode 100755 (executable)
index 0000000..e341ca8
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# bup-save-user -- Save user data using bup(1)
+# Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+NAME=`basename "$0"`
+
+Usage()
+{
+       echo "Usage: $NAME"; echo
+       exit 1
+}
+
+[ $# -eq 0 ] || Usage
+
+if [ ! -d "$HOME/.bup" ]; then
+       echo "$NAME: \"$HOME/.bup\" does not exist. Initialite it first!"
+       exit 1
+fi
+
+paths="$HOME"
+[ -n "$LOCAL_HOME" -a "$LOCAL_HOME" != "$HOME" -a -d "$LOCAL_HOME" ] \
+       && paths="$paths $LOCAL_HOME"
+[ -d "/var/spool/mail/$LOGNAME" ] \
+       && paths="$paths /var/spool/mail/$LOGNAME"
+
+set -x
+
+bup index --update --xdev --exclude-rx="/.cache/." $paths || exit 1
+
+bup save --name "$LOGNAME" $paths
+exit_code=$?
+
+bup ls "$LOGNAME" || exit 1
+
+exit $exit_code