Merge pull request #26 from tmlapp/master

Added -sshkey arg for automated cron runs and spec file for rpm packaging
This commit is contained in:
Jim Salter 2016-03-21 10:39:25 -04:00
commit 50b258cad1
2 changed files with 55 additions and 2 deletions

48
sanoid.spec Normal file
View File

@ -0,0 +1,48 @@
Name: sanoid
Version: 1.4.4
Release: 1%{?dist}
BuildArch: noarch
Summary: A policy-driven snapshot management tool for ZFS filesystems
Group: Applications/System
License: GPLv3
URL: https://github.com/jimsalterjrs/sanoid
Source0: https://github.com/jimsalterjrs/sanoid/archive/sanoid-master.zip
Patch0: sanoid-syncoid-sshkey.patch
#BuildRequires:
Requires: perl
%description
Sanoid is a policy-driven snapshot management
tool for ZFS filesystems. You can use Sanoid
to create, automatically thin, and monitor snapshots
and pool health from a single eminently
human-readable TOML config file.
%prep
%setup -q -n sanoid-master
%patch0 -p1
%build
%install
%{__install} -D -m 0644 sanoid.defaults.conf %{buildroot}/etc/sanoid/sanoid.defaults.conf
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -m 0755 sanoid syncoid findoid sleepymutex %{buildroot}%{_sbindir}
%{__install} -D -m 0644 sanoid.conf %{buildroot}%{_docdir}/%{name}-%{version}/examples/sanoid.conf
echo "* * * * * root %{_sbindir}/sanoid --cron" > %{buildroot}%{_docdir}/%{name}-%{version}/examples/sanoid.cron
%files
%doc CHANGELIST LICENSE VERSION README.md
%{_sbindir}/sanoid
%{_sbindir}/syncoid
%{_sbindir}/findoid
%{_sbindir}/sleepymutex
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/sanoid.defaults.conf
%changelog
* Sat Feb 13 2016 Thomas M. Lapp <tmlapp@gmail.com> - 1.4.4-1
- Initial RPM Package

View File

@ -35,7 +35,12 @@ my $mbufferoptions = '-q -s 128k -m 16M 2>/dev/null';
my $lscmd = '/bin/ls';
# figure out if source and/or target are remote.
$sshcmd = "$sshcmd $sshcipher";
if ( $args{'sshkey'} ) {
$sshcmd = "$sshcmd $sshcipher -i $args{'sshkey'}";
}
else {
$sshcmd = "$sshcmd $sshcipher";
}
my ($sourcehost,$sourcefs,$sourceisroot) = getssh($rawsourcefs);
my ($targethost,$targetfs,$targetisroot) = getssh($rawtargetfs);
@ -243,7 +248,7 @@ sub getargs {
my %novaluearg;
my %validarg;
push my @validargs, ('debug','nocommandchecks','version','monitor-version','compress','source-bwlimit','target-bwlimit','dumpsnaps','recursive','r');
push my @validargs, ('debug','nocommandchecks','version','monitor-version','compress','source-bwlimit','target-bwlimit','dumpsnaps','recursive','r','sshkey');
foreach my $item (@validargs) { $validarg{$item} = 1; }
push my @novalueargs, ('debug','nocommandchecks','version','monitor-version','dumpsnaps','recursive','r');
foreach my $item (@novalueargs) { $novaluearg{$item} = 1; }