Skip to content

Commit a108705

Browse files
committed
Added /sbin/btrfs to the list of checked binary locations (used on Gentoo)
1 parent 176c6d2 commit a108705

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.9 (17 March, 2017)
2+
* Added `/sbin/btrfs` to the list of checked binary locations (used on Gentoo)
3+
14
# 0.8 (24 March, 2016)
25
* `minimum_delete_count` and `minimum_delete_count_other` options introduced
36

just-backup-btrfs

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
<?php
33
namespace nazarpc;
44
use
5+
RuntimeException,
56
SQLite3;
67

78
/**
89
* @package Just backup btrfs
910
* @author Nazar Mokrynskyi <[email protected]>
1011
* @copyright Copyright (c) 2014-2017, Nazar Mokrynskyi
1112
* @license http://opensource.org/licenses/MIT
12-
* @version 0.7
13+
* @version 0.9
1314
*/
1415
class Just_backup_btrfs {
1516
/**
@@ -22,13 +23,23 @@ class Just_backup_btrfs {
2223
protected $binary;
2324
/**
2425
* @param array $config
26+
*
27+
* @throws RuntimeException
2528
*/
2629
function __construct ($config) {
2730
if (!$config) {
2831
exit("Incorrect configuration, aborted\n");
2932
}
3033
$this->config = $config;
31-
$this->binary = file_exists('/usr/sbin/btrfs') ? '/usr/sbin/btrfs' : '/bin/btrfs';
34+
if (file_exists('/usr/sbin/btrfs')) {
35+
$this->binary = '/usr/sbin/btrfs';
36+
} elseif (file_exists('/sbin/btrfs')) {
37+
$this->binary = '/sbin/btrfs';
38+
} elseif (file_exists('/bin/btrfs')) {
39+
$this->binary = '/bin/btrfs';
40+
} else {
41+
throw new RuntimeException("Can't find btrfs binary");
42+
}
3243
}
3344
function backup () {
3445
$default_config = [

0 commit comments

Comments
 (0)