]> arthur.barton.de Git - ax-unix.git/blob - bup/save-user/bup-save-user
bup-save-user: Use --one-file-system
[ax-unix.git] / bup / save-user / bup-save-user
1 #!/bin/sh
2 #
3 # bup-save-user -- Save user data using bup(1)
4 # Copyright (c)2013-2020 Alexander Barton (alex@barton.de)
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11
12 NAME=$(basename "$0")
13
14 Usage()
15 {
16         echo "Usage: $NAME" 2>&1; echo
17         exit 1
18 }
19
20 [ $# -eq 0 ] || Usage
21
22 if [ ! -d "$HOME/.bup" ]; then
23         echo "$NAME: \"$HOME/.bup\" does not exist. Initialite it first!" >&2
24         exit 1
25 fi
26
27 paths="$HOME"
28 [ -n "$LOCAL_HOME" ] && [ "$LOCAL_HOME" != "$HOME" ] && [ -d "$LOCAL_HOME" ] \
29         && paths="$paths $LOCAL_HOME"
30 [ -d "/var/spool/mail/$LOGNAME" ] \
31         && paths="$paths /var/spool/mail/$LOGNAME"
32
33 set -x
34
35 bup index --one-file-system --no-check-device --exclude-rx="/.cache/." $paths || exit 1
36
37 bup save --name "$LOGNAME" $paths
38 exit_code=$?
39
40 bup ls "$LOGNAME" || exit 1 | column
41
42 exit $exit_code