bup 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +7 -1
- data/exe/bup +6 -2
- data/lib/bup/tar.rb +29 -11
- data/lib/bup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3228f83fe11f72b1e77210809dec6e3d8a4ccbdc849fa756c97f525803e04357
|
4
|
+
data.tar.gz: ea48181ef6b1adb871c2b558a6bfb9bdb50ef364459ec0fc453837d33dc57589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106db1b2e171e056b9bf19763f269898a2b5eeea115ce30918353fab95147850d124ffb53bcb64dfd35c46f220c71019ac0de8a3276263f93fc79c39a42a53b6
|
7
|
+
data.tar.gz: 64217767bfc2cbcfe73b7c1963175481cdfa4d8318ee2e2f4f92317bccddb1690244e48666891a78b5aa1d61da8876f90a80c8495850c62a3800619b2a4983d4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.6.0] - 2021-11-29
|
4
|
+
|
5
|
+
- Add pre_cmds list to allow executing command before backup, such as dumping a database.
|
6
|
+
- Add BUP_DESTINATION that holds the backup destination directory.
|
7
|
+
This may be used to put dumped database files in before a backup and clean
|
8
|
+
them up with a post_cmd.
|
9
|
+
- Refactor the tar.rb file for more simple individual function calls
|
10
|
+
and to do a little less redundant processing.
|
11
|
+
- Replaced --type=[full|incremental] with --incremental and --full options.
|
12
|
+
|
3
13
|
## [0.5.0] - 2021-11-13
|
4
14
|
|
5
15
|
- Allow for a history size of 0.
|
data/README.md
CHANGED
@@ -20,6 +20,7 @@ profiles:
|
|
20
20
|
description: Simple backup of critical files.
|
21
21
|
include:
|
22
22
|
- "$HOME"
|
23
|
+
- /$BUP_DESTINATION/db.dump
|
23
24
|
exclude:
|
24
25
|
- "$HOME"
|
25
26
|
- "$HOME/backups"
|
@@ -30,9 +31,14 @@ profiles:
|
|
30
31
|
- tar
|
31
32
|
- cJvf
|
32
33
|
- "${BUP_FILENAME}.tar.xz"
|
34
|
+
pre_cmds:
|
35
|
+
- - dumpdatabase
|
36
|
+
- /$BUP_DESTINATION/db.dump
|
33
37
|
post_cmds:
|
34
38
|
- - ls
|
35
39
|
- $BUP_FILENAME.tar.xz
|
40
|
+
- - rm
|
41
|
+
- /$BUP_DESTINATION/db.dump
|
36
42
|
```
|
37
43
|
|
38
44
|
This defines a single profile, "default". You can list
|
@@ -57,4 +63,4 @@ Before a new backup is run, previous backups are removed. If you run many
|
|
57
63
|
uncompleted backups, you will eventually remove all good backups from your
|
58
64
|
backup history. This behavior is desired because backups should nearly always
|
59
65
|
succeed and we want to ensure that disk pressure is kep lower than higher.
|
60
|
-
Higher disk pressure might cause a backup to fail.
|
66
|
+
Higher disk pressure might cause a backup to fail.
|
data/exe/bup
CHANGED
@@ -19,8 +19,12 @@ OptParse.new do |opt|
|
|
19
19
|
profile = p
|
20
20
|
end
|
21
21
|
|
22
|
-
opt.on("-
|
23
|
-
config.runtime["type"] =
|
22
|
+
opt.on("-i", "--incremental", String, "Set the type of backup to incremental.") do
|
23
|
+
config.runtime["type"] = "incremental"
|
24
|
+
end
|
25
|
+
|
26
|
+
opt.on("-f", "--full", String, "Set the type of backup to full.") do
|
27
|
+
config.runtime["type"] = "full"
|
24
28
|
end
|
25
29
|
|
26
30
|
opt.on("-l", "--list", "List profiles and exit.") do
|
data/lib/bup/tar.rb
CHANGED
@@ -32,8 +32,9 @@ module Bup
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# Prepare the destination directory.
|
35
|
-
def prepare_destination(profile_name)
|
36
|
-
destination =
|
35
|
+
def prepare_destination(profile_name, profile)
|
36
|
+
destination = profile["destination"] || "."
|
37
|
+
|
37
38
|
type = @config.runtime["type"] || "full"
|
38
39
|
|
39
40
|
FileUtils.mkdir_p(destination) unless File.exist?(destination)
|
@@ -52,6 +53,8 @@ module Bup
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
ENV["BUP_DESTINATION"] = destination
|
57
|
+
ENV["BUP_FILENAME"] = filename
|
55
58
|
filename
|
56
59
|
end
|
57
60
|
|
@@ -90,32 +93,47 @@ module Bup
|
|
90
93
|
|
91
94
|
raise "Missing profile #{profile_name}." unless profile
|
92
95
|
|
93
|
-
args =
|
96
|
+
args = profile["tarcmd"].dup || ["tar", "cJvf", "${BUP_FILENAME}.tar.xz"]
|
94
97
|
|
95
|
-
|
98
|
+
prepare_destination(profile_name, profile)
|
96
99
|
|
97
100
|
if @config.runtime["type"] == "incremental"
|
98
101
|
lastrun = @config.lastrun(profile_name)
|
99
102
|
args += ["--newer", lastrun.strftime("%Y-%m-%d %H:%M:%S %z")] if lastrun
|
100
103
|
end
|
101
104
|
|
105
|
+
run_pre_cmds profile
|
106
|
+
|
102
107
|
@config.update_lastrun(profile_name)
|
103
108
|
|
104
109
|
tf = build_exclude_file(profile["exclude"] || [])
|
105
110
|
|
106
|
-
|
107
|
-
args += (@config.profile(profile_name)["include"] || ["."])
|
108
|
-
args = args.map do |str|
|
109
|
-
expand_string(str)
|
110
|
-
end
|
111
|
-
|
111
|
+
# Build and run tar command.
|
112
112
|
begin
|
113
|
+
args += ["--exclude-from", tf.path]
|
114
|
+
args += (profile["include"] || ["."])
|
115
|
+
args = args.map do |str|
|
116
|
+
expand_string(str)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Run tar.
|
113
120
|
run_cmd(*args)
|
114
121
|
ensure
|
115
122
|
tf.unlink
|
116
123
|
end
|
117
124
|
|
118
|
-
|
125
|
+
run_post_cmds profile
|
126
|
+
end
|
127
|
+
|
128
|
+
def run_pre_cmds(profile)
|
129
|
+
# Before we update the last_run, execute any pre_cmds.
|
130
|
+
(profile["pre_cmds"] || []).each do |args|
|
131
|
+
run_cmd(*args.map { |c| expand_string(c) })
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def run_post_cmds(profile)
|
136
|
+
(profile["post_cmds"] || []).each do |args|
|
119
137
|
run_cmd(*args.map { |c| expand_string(c) })
|
120
138
|
end
|
121
139
|
end
|
data/lib/bup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Baskinger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Backup tool driver that connects tar, gnupg, and other tools to accomplish
|
14
14
|
backups.
|