bup 0.5.0 → 0.8.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 +18 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/bup.gemspec +1 -1
- data/exe/bup +8 -5
- data/lib/bup/tar.rb +29 -11
- data/lib/bup/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7a2fb5ead32bfe3ae066fee80d07a7b66f2b030c83f98056c68eec57d6a4e4
|
4
|
+
data.tar.gz: 7767ad2f05f665088b94a39e32c49fa8179e3938048cc2769eeea5d75a0b090d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f0eaae23f91590737f005ffc818b3be6059c95361c9a044f556fe11eedf42f3ecb586ae1e932d43a937e2756e9436742d7c3c1d3903108726ffb321d9d823a3
|
7
|
+
data.tar.gz: 66286daf7c562e84889a9d31c3c776a50433fa1eabadab5e176bf42a29ce56140ca367bbb2951c4eff84ef4c834cdf389f6545a7b9aaea8aa5676de9c0c3095c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.8.0] - 2022-04-27
|
4
|
+
|
5
|
+
- Drop required Ruby version to 2.7.
|
6
|
+
|
7
|
+
## [0.7.0] - 2021-11-29
|
8
|
+
|
9
|
+
- BUG FIX: Create destination was not being expanded.
|
10
|
+
|
11
|
+
## [0.6.0] - 2021-11-29
|
12
|
+
|
13
|
+
- Add pre_cmds list to allow executing command before backup, such as dumping a database.
|
14
|
+
- Add BUP_DESTINATION that holds the backup destination directory.
|
15
|
+
This may be used to put dumped database files in before a backup and clean
|
16
|
+
them up with a post_cmd.
|
17
|
+
- Refactor the tar.rb file for more simple individual function calls
|
18
|
+
and to do a little less redundant processing.
|
19
|
+
- Replaced --type=[full|incremental] with --incremental and --full options.
|
20
|
+
|
3
21
|
## [0.5.0] - 2021-11-13
|
4
22
|
|
5
23
|
- Allow for a history size of 0.
|
data/Gemfile.lock
CHANGED
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/bup.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Backup tool driver that connects tar, gnupg, and other tools to accomplish backups."
|
13
13
|
spec.homepage = "https://rubygems.org/gems/bup"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">=
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
18
18
|
|
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
|
@@ -36,11 +40,10 @@ elsif config.config["default_profile"]
|
|
36
40
|
config.runtime["profile"] = config.config["default_profile"]
|
37
41
|
end
|
38
42
|
|
39
|
-
|
40
43
|
case config.runtime["action"]
|
41
44
|
when "list"
|
42
|
-
config.config["profiles"].each do |key,
|
43
|
-
puts "#{key} - #{
|
45
|
+
config.config["profiles"].each do |key, prof|
|
46
|
+
puts "#{key} - #{prof["description"] || ""}"
|
44
47
|
end
|
45
48
|
else
|
46
49
|
tar = Bup::Tar.new(config)
|
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 = expand_string(
|
35
|
+
def prepare_destination(profile_name, profile)
|
36
|
+
destination = expand_string(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.8.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:
|
11
|
+
date: 2022-04-27 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.
|
@@ -51,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.7.0
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.7
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Backup tool driver.
|