snapsync 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/snapsync/auto_sync.rb +9 -5
- data/lib/snapsync/btrfs.rb +5 -1
- data/lib/snapsync/cli.rb +7 -1
- data/lib/snapsync/partitions_monitor.rb +1 -1
- data/lib/snapsync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84ad233f04295d4430ab02819f5e8b86a9d52d05
|
4
|
+
data.tar.gz: 6dfb17bd0f62219c2a877538e36a890d229876d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6fa273bf0a52e2a1655b4f5dcff8f294ba0cace17286e4a94ad04e0713bb8d9c31a7cdb773abeabf84079b29ea048aa4ed7fdc9f3f252a62f122f893d00c5ac
|
7
|
+
data.tar.gz: 5ca8843ef3c4567de8432244c9300b4d4fd04444368f6d71a37cf3e7078bf3b39a8afa3ef534023938e098959d22106b2610dd024e8c8c8ca8de214b6386fb3b
|
data/lib/snapsync/auto_sync.rb
CHANGED
@@ -146,13 +146,17 @@ module Snapsync
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
+
def sync
|
150
|
+
each_available_autosync_target do |path, t|
|
151
|
+
Snapsync.info "sync-all on #{path} (partition #{t.partition_uuid})"
|
152
|
+
op = SyncAll.new(path, config_dir: config_dir)
|
153
|
+
op.run
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
149
157
|
def run(period: 600)
|
150
158
|
while true
|
151
|
-
|
152
|
-
Snapsync.info "sync-all on #{path} (partition #{t.partition_uuid})"
|
153
|
-
op = SyncAll.new(path, config_dir: config_dir)
|
154
|
-
op.run
|
155
|
-
end
|
159
|
+
sync
|
156
160
|
Snapsync.info "done all declared autosync partitions, sleeping #{period}s"
|
157
161
|
sleep period
|
158
162
|
end
|
data/lib/snapsync/btrfs.rb
CHANGED
@@ -20,6 +20,10 @@ module Snapsync
|
|
20
20
|
class UnexpectedBtrfsOutput < Error
|
21
21
|
end
|
22
22
|
|
23
|
+
def self.btrfs_prog
|
24
|
+
ENV['BTRFS_PROG'] || 'btrfs'
|
25
|
+
end
|
26
|
+
|
23
27
|
# @api private
|
24
28
|
#
|
25
29
|
# A IO.popen-like API to btrfs subcommands
|
@@ -27,7 +31,7 @@ module Snapsync
|
|
27
31
|
err_r, err_w = IO.pipe
|
28
32
|
|
29
33
|
block_error, block_result = nil
|
30
|
-
IO.popen([
|
34
|
+
IO.popen([btrfs_prog, *args, err: err_w, **options], mode) do |io|
|
31
35
|
err_w.close
|
32
36
|
|
33
37
|
begin
|
data/lib/snapsync/cli.rb
CHANGED
@@ -286,13 +286,19 @@ While it can easily be done manually, this command makes sure that the snapshots
|
|
286
286
|
end
|
287
287
|
|
288
288
|
desc "auto-sync", "automatic synchronization"
|
289
|
+
option :one_shot, desc: "do one synchronization and quit", type: :boolean,
|
290
|
+
default: false
|
289
291
|
option :config_file, desc: "path to the config file (defaults to /etc/snapsync.conf)",
|
290
292
|
default: '/etc/snapsync.conf'
|
291
293
|
def auto_sync
|
292
294
|
handle_class_options
|
293
295
|
auto = AutoSync.new(SnapperConfig.default_config_dir)
|
294
296
|
auto.load_config(Pathname.new(options[:config_file]))
|
295
|
-
|
297
|
+
if options[:one_shot]
|
298
|
+
auto.sync
|
299
|
+
else
|
300
|
+
auto.run
|
301
|
+
end
|
296
302
|
end
|
297
303
|
|
298
304
|
desc 'list [DIR]', 'list the snapshots present on DIR. If DIR is omitted, tries to access all targets defined as auto-sync targets'
|
@@ -116,7 +116,7 @@ module Snapsync
|
|
116
116
|
return enum_for(__method__) if !block_given?
|
117
117
|
udisk.root['org']['freedesktop']['UDisks2']['block_devices'].each do |device_name, _|
|
118
118
|
dev = udisk.object("/org/freedesktop/UDisks2/block_devices/#{device_name}")
|
119
|
-
if dev['org.freedesktop.UDisks2.
|
119
|
+
if dev['org.freedesktop.UDisks2.Block'] && dev['org.freedesktop.UDisks2.Filesystem']
|
120
120
|
yield(device_name, dev)
|
121
121
|
end
|
122
122
|
end
|
data/lib/snapsync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|