]> arthur.barton.de Git - ax-linux.git/commitdiff
Add bup-save-user script
authorAlexander Barton <alex@barton.de>
Sat, 12 Apr 2014 14:33:55 +0000 (16:33 +0200)
committerAlexander Barton <alex@barton.de>
Sat, 12 Apr 2014 14:33:55 +0000 (16:33 +0200)
Makefile
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]

index c367987ea5adf8b3fa361a5862ba6314b7ea4d03..68c37965b8072ed9c2ed3b583db7a064d244300d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
 # (at your option) any later version.
 #
 
-SUBDIRS = btrfs lvm
+SUBDIRS = btrfs bup lvm
 
 all: $(SUBDIRS)
 
diff --git a/bup/Makefile b/bup/Makefile
new file mode 100644 (file)
index 0000000..8e19c4a
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# ax-linux: Alex' Linux Tools & Scripts
+# Copyright (c)2013 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
+
+all: $(SUBDIRS)
+
+include ../Makefile.ax
diff --git a/bup/save-user/Makefile b/bup/save-user/Makefile
new file mode 100644 (file)
index 0000000..ba42d5c
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# ax-linux: Alex' Linux 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
+
+install-local: bup-save-user
+       install -d -o $(USER) -g $(GROUP) -m 755 \
+        $(DESTDIR)/usr/local/bin
+       install -p -o $(USER) -g $(GROUP) -m 755 bup-save-user \
+        $(DESTDIR)/usr/local/bin/bup-save-user
+
+include ../../Makefile.ax
diff --git a/bup/save-user/bup-save-user b/bup/save-user/bup-save-user
new file mode 100755 (executable)
index 0000000..626cf56
--- /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
+
+set -x
+
+bup index --update --xdev \
+       --exclude ".cache" \
+       "$HOME" \
+       "/var/spool/mail/$USER" \
+       || exit 1
+
+bup save --name "$USER" \
+       "$HOME" \
+       "/var/spool/mail/$USER"
+exit_code=$?
+
+bup ls "$USER" || exit 1
+
+exit $exit_code