[packages] /etc/functions.sh => /lib/functions.sh
[packages.git] / utils / boxbackup / files / bbstoreaccounts
1 #!/bin/sh
2
3 . /lib/functions.sh
4 . /lib/functions/bbstored.sh
5
6 bxbk_config_file=
7 NORUN=
8
9 if [ "$1" = "-c" ]; then
10         shift
11         bxbk_config_file="$1"
12         shift
13 else
14         if [ -z "$1" ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
15                 /usr/lib/boxbackup/bbstoreaccounts -h
16                 exit 1
17         fi
18         if [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ]; then
19                 /usr/lib/boxbackup/bbstoreaccounts -h
20                 exit 1
21         fi
22         config_load bbstored
23         create_config
24         if [ "$EXTERNAL_CONFIG" = "1" ]; then
25                 bxbk_config_file="$EXTERNAL_CONF_FILE"
26         else
27                 bxbk_config_file="$BXBK_CONFIG_PATH/bbstored.conf"
28         fi
29 fi
30
31 [ "$NORUN" != "1" ] && [ -n "$bxbk_config_file" ] && /usr/lib/boxbackup/bbstoreaccounts -c "$bxbk_config_file" "$@" || {
32         echo "Error managing account using '$bxbk_config_file'"
33         exit 1
34 }