-
Notifications
You must be signed in to change notification settings - Fork 1
/
launcher.sh
executable file
·55 lines (45 loc) · 914 Bytes
/
launcher.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
set -e
launcherHelp() {
echo "Launch backup or restore process from provider"
echo "Usage:"
echo " launcher.sh provider.sh backup|restore|help [provider options & arguments]"
echo ""
echo "Commands:"
echo " backup Create new backup"
echo " restore Restore existing backup"
echo " help Print provider-specific help message"
}
printHelp() {
echo "No help for this provider"
}
preBackup() {
return 0
}
preRestore() {
return 0
}
postBackup() {
return 0
}
postRestore() {
return 0
}
# shellcheck disable=SC1090
if [ -f "$1" ] && [ -r "$1" ]; then
. "$1"
shift
fi
case "$1" in
backup) shift
preBackup "$@" && backup "$@" && postBackup "$@";;
restore) shift
preRestore "$@" && restore "$@" && postRestore "$@";;
help) shift
launcherHelp
echo ""
printHelp "$@";;
*) echo "Wrong command '$1'. " >&2
launcherHelp
exit 1
esac