diff options
Diffstat (limited to 'x200-my.initd')
-rw-r--r-- | x200-my.initd | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/x200-my.initd b/x200-my.initd index b026b5b..de88ff0 100644 --- a/x200-my.initd +++ b/x200-my.initd | |||
@@ -14,31 +14,46 @@ extra_started_commands="initbackup" | |||
14 | autobackup="${conf_autobackup}" | 14 | autobackup="${conf_autobackup}" |
15 | backup_path="${conf_backup_path}" | 15 | backup_path="${conf_backup_path}" |
16 | control_file="${conf_control_file}" | 16 | control_file="${conf_control_file}" |
17 | backup_cmd="/usr/bin/rsync" | 17 | if [ $use_rsnapshot = "true" ] |
18 | backup_args="-aAX --relative --delete --quiet" | 18 | then |
19 | backup_cmd="/usr/bin/rsnapshot" | ||
20 | backup_args="${rsnapshot_args}" | ||
21 | else | ||
22 | backup_cmd="/usr/bin/rsync" | ||
23 | backup_args="-aAX --relative --delete --quiet" | ||
24 | fi | ||
19 | 25 | ||
20 | do_listofpackages() { | 26 | do_listofpackages() { |
21 | /usr/bin/pacman -Qqetn > "$backup_path"/pkglist.txt | 27 | /usr/bin/pacman -Qqetn > "$backup_path"/pkglist.txt |
22 | /usr/bin/pacman -Qqem > "$backup_path"/foreignpkglist.txt | 28 | /usr/bin/pacman -Qqem > "$backup_path"/foreignpkglist.txt |
23 | } | 29 | } |
24 | 30 | ||
25 | initbackup() { | 31 | do_backup () { |
26 | if [ $autobackup = "true" ] | 32 | if [ $autobackup = "true" ] |
27 | then | 33 | then |
28 | if [ -e "$backup_path"/"$control_file" ] | 34 | if [ -e "$backup_path"/"$control_file" ] |
29 | then | 35 | then |
30 | do_listofpackages | 36 | do_listofpackages |
31 | for dir in "${conf_backup_dirs[@]}" | 37 | if [ $use_rsnapshot = "true" ] |
32 | do | 38 | then |
33 | if [ -d "$dir" ] | 39 | $backup_cmd $backup_args |
34 | then | 40 | else |
35 | $backup_cmd $backup_args "$dir" "$backup_path" | 41 | for dir in "${conf_backup_dirs[@]}" |
36 | fi | 42 | do |
37 | done | 43 | if [ -d "$dir" ] |
44 | then | ||
45 | $backup_cmd $backup_args "$dir" "$backup_path" | ||
46 | fi | ||
47 | done | ||
48 | fi | ||
38 | fi | 49 | fi |
39 | fi | 50 | fi |
40 | } | 51 | } |
41 | 52 | ||
53 | initbackup() { | ||
54 | do_backup | ||
55 | } | ||
56 | |||
42 | start() { | 57 | start() { |
43 | if [ "${RC_CMD}" = "restart" ]; | 58 | if [ "${RC_CMD}" = "restart" ]; |
44 | then | 59 | then |
@@ -50,18 +65,5 @@ start() { | |||
50 | 65 | ||
51 | stop() { | 66 | stop() { |
52 | /usr/bin/nmcli radio all off | 67 | /usr/bin/nmcli radio all off |
53 | if [ $autobackup = "true" ] | 68 | do_backup |
54 | then | ||
55 | if [ -e "$backup_path"/"$control_file" ] | ||
56 | then | ||
57 | do_listofpackages | ||
58 | for dir in "${conf_backup_dirs[@]}" | ||
59 | do | ||
60 | if [ -d "$dir" ] | ||
61 | then | ||
62 | $backup_cmd $backup_args "$dir" "$backup_path" | ||
63 | fi | ||
64 | done | ||
65 | fi | ||
66 | fi | ||
67 | } | 69 | } |