-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
/sbin/btrfs
to the list of checked binary locations (used on …
…Gentoo)
- Loading branch information
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ | |
<?php | ||
namespace nazarpc; | ||
use | ||
RuntimeException, | ||
SQLite3; | ||
|
||
/** | ||
* @package Just backup btrfs | ||
* @author Nazar Mokrynskyi <[email protected]> | ||
* @copyright Copyright (c) 2014-2017, Nazar Mokrynskyi | ||
* @license http://opensource.org/licenses/MIT | ||
* @version 0.7 | ||
* @version 0.9 | ||
*/ | ||
class Just_backup_btrfs { | ||
/** | ||
|
@@ -22,13 +23,23 @@ class Just_backup_btrfs { | |
protected $binary; | ||
/** | ||
* @param array $config | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
function __construct ($config) { | ||
if (!$config) { | ||
exit("Incorrect configuration, aborted\n"); | ||
} | ||
$this->config = $config; | ||
$this->binary = file_exists('/usr/sbin/btrfs') ? '/usr/sbin/btrfs' : '/bin/btrfs'; | ||
if (file_exists('/usr/sbin/btrfs')) { | ||
$this->binary = '/usr/sbin/btrfs'; | ||
} elseif (file_exists('/sbin/btrfs')) { | ||
$this->binary = '/sbin/btrfs'; | ||
} elseif (file_exists('/bin/btrfs')) { | ||
$this->binary = '/bin/btrfs'; | ||
} else { | ||
throw new RuntimeException("Can't find btrfs binary"); | ||
} | ||
} | ||
function backup () { | ||
$default_config = [ | ||
|