mirror of
https://github.com/rsnapshot/rsnapshot.git
synced 2025-11-19 17:59:30 +01:00
42 lines
679 B
Perl
42 lines
679 B
Perl
package SysWrap;
|
|
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
use Exporter 'import';
|
|
|
|
our $VERSION = '1.0';
|
|
|
|
our @EXPORT = qw(execute rsnapshot remove_snapshot_root rsnapshot_output);
|
|
|
|
sub remove_snapshot_root {
|
|
my $args = shift(@_);
|
|
my $snapshot_root;
|
|
|
|
if(defined $args && $args ne ""){
|
|
$snapshot_root = $args;
|
|
}
|
|
else {
|
|
$snapshot_root = "@SNAP@";
|
|
}
|
|
|
|
if(-d "$snapshot_root"){
|
|
return execute("rm -rf \"$snapshot_root\"");
|
|
}
|
|
}
|
|
|
|
sub execute {
|
|
return system(@_) >> 8;
|
|
}
|
|
|
|
sub rsnapshot {
|
|
my $args = shift(@_);
|
|
|
|
return execute("@PERL@ @CWD@/rsnapshot $args >/dev/null 2>&1");
|
|
}
|
|
|
|
sub rsnapshot_output {
|
|
my $args = shift(@_);
|
|
return `@PERL@ @CWD@/rsnapshot $args`;
|
|
}
|
|
|
|
1;
|