diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2018-06-05 18:51:14 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-06-05 18:51:14 +0300 |
commit | a0808df0b627180d7773d5d13a0f64d6e7c45f5d (patch) | |
tree | cd33f1aa2b27747ff09d10d74d2606a274dba565 /lib/backup/files.rb | |
parent | 78d2e91b7c514c1d743294ae014f24eec7cb7d52 (diff) |
Find and mark more Git disk access locations
Diffstat (limited to 'lib/backup/files.rb')
-rw-r--r-- | lib/backup/files.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/backup/files.rb b/lib/backup/files.rb index 9895db9e451..d769a3ee7b0 100644 --- a/lib/backup/files.rb +++ b/lib/backup/files.rb @@ -26,7 +26,7 @@ module Backup unless status.zero? puts output - abort 'Backup failed' + raise Backup::Error, 'Backup failed' end run_pipeline!([%W(tar --exclude=lost+found -C #{@backup_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600]) @@ -39,7 +39,11 @@ module Backup def restore backup_existing_files_dir - run_pipeline!([%w(gzip -cd), %W(tar --unlink-first --recursive-unlink -C #{app_files_dir} -xf -)], in: backup_tarball) + run_pipeline!([%w(gzip -cd), %W(#{tar} --unlink-first --recursive-unlink -C #{app_files_dir} -xf -)], in: backup_tarball) + end + + def tar + system(*%w[gtar --version], out: '/dev/null') ? 'gtar' : 'tar' end def backup_existing_files_dir @@ -61,7 +65,7 @@ module Backup def run_pipeline!(cmd_list, options = {}) status_list = Open3.pipeline(*cmd_list, options) - abort 'Backup failed' unless status_list.compact.all?(&:success?) + raise Backup::Error, 'Backup failed' unless status_list.compact.all?(&:success?) end end end |