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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95ec11fc2543f694b0067aec51d92e8a377db86c
4
- data.tar.gz: 68c883971fa9a51ada600b7bf5d581ac7989374a
3
+ metadata.gz: 84ad233f04295d4430ab02819f5e8b86a9d52d05
4
+ data.tar.gz: 6dfb17bd0f62219c2a877538e36a890d229876d9
5
5
  SHA512:
6
- metadata.gz: 42b5c23eea493a255c85571dbb6427ddc2e4f6cfb24c6c3c1549bb7d2bd2dcf5a8b9a6a65d01f73aae48e5a6fdb62ffb300d5e3e9f6a0848ebe82596b83a9983
7
- data.tar.gz: 233573b3be382d2d9ab5cc5e6e467bbe45cf54e6930c3fffcef438fdbe24808b4bb87a9a46a631a35b8c169d24e99c3d50132ee8578c5750bea4eafb6046ca0e
6
+ metadata.gz: e6fa273bf0a52e2a1655b4f5dcff8f294ba0cace17286e4a94ad04e0713bb8d9c31a7cdb773abeabf84079b29ea048aa4ed7fdc9f3f252a62f122f893d00c5ac
7
+ data.tar.gz: 5ca8843ef3c4567de8432244c9300b4d4fd04444368f6d71a37cf3e7078bf3b39a8afa3ef534023938e098959d22106b2610dd024e8c8c8ca8de214b6386fb3b
@@ -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
- each_available_autosync_target do |path, t|
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
@@ -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(['btrfs', *args, err: err_w, **options], mode) do |io|
34
+ IO.popen([btrfs_prog, *args, err: err_w, **options], mode) do |io|
31
35
  err_w.close
32
36
 
33
37
  begin
@@ -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
- auto.run
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.Partition'] && dev['org.freedesktop.UDisks2.Filesystem']
119
+ if dev['org.freedesktop.UDisks2.Block'] && dev['org.freedesktop.UDisks2.Filesystem']
120
120
  yield(device_name, dev)
121
121
  end
122
122
  end
@@ -1,3 +1,3 @@
1
1
  module Snapsync
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
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.6
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-04-14 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging