commit c683a3b15261b49cd96fa98f2cecd84a4f57aa7d Author: Daniel Berteaud Date: Thu Jul 5 09:52:42 2012 +0200 premier commit diff --git a/BackupPC-server-scripts.spec b/BackupPC-server-scripts.spec new file mode 100644 index 0000000..11d6fda --- /dev/null +++ b/BackupPC-server-scripts.spec @@ -0,0 +1,52 @@ +%define name BackupPC-server-scripts +%define version 0.0.1 +%define release 1.beta1 + +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +Summary: Some scripts for a BackupPC server + +Group: Applications/System +License: GNU GPL +URL: http://gitweb.firewall-services.com/?p=BackupPC-server-scripts;a=summary +Source0: %{name}-%{version}.tar.gz +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildArch: noarch +Requires: BackupPC +Requires: winexe + + +%description +Provides some scripts to run a a BackupPC server. +Like pre-backup scripts for Windows boxes + +%changelog +* Thu Jul 5 2012 Daniel Berteaud - 0.0.1 +- initial release + +%prep +%setup -q + +%build + +%install +%{__rm} -rf $RPM_BUILD_ROOT + +# Install backup script +%{__mkdir_p} $RPM_BUILD_ROOT%{_bindir}/ +%{__install} -m 0755 scripts/* $RPM_BUILD_ROOT%{_bindir}/ + +# Install conf +%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/BackupPC +%{__install} -m 0640 conf/* $RPM_BUILD_ROOT%{_sysconfdir}/BackupPC/ + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc CHANGELOG.git +%{_bindir}/* +%config(noreplace) %attr(0640, root, backuppc) %{_sysconfdir}/BackupPC/* + diff --git a/conf/win.conf b/conf/win.conf new file mode 100644 index 0000000..4c5c157 --- /dev/null +++ b/conf/win.conf @@ -0,0 +1,3 @@ +username=backup +domain=NTDOMAIN.LOCAL +password=p@ssw0rd! diff --git a/scripts/win-post-backup b/scripts/win-post-backup new file mode 100644 index 0000000..037075a --- /dev/null +++ b/scripts/win-post-backup @@ -0,0 +1,19 @@ +#!/bin/bash + +WINEXE=/usr/bin/winexe + +if [ ! -z $2 ]; then + UNAME=$2 +fi +if [ ! -z $3 ]; then + PASS=$3 +fi + +BOX=$1 + +if [[ ! -z $UNAME && ! -z $PASS ]]; then + $WINEXE -s /dev/null -U $UNAME --password=$PASS //$BOX 'cmd /c echo '1' > c:\backuppc\wake.up' <&- +else + $WINEXE -s /dev/null --authentication-file=/etc/BackupPC/win.conf //$BOX 'cmd /c echo '1' > c:\backuppc\wake.up' <&- +fi +echo "Rsync and shadow copy unloaded" diff --git a/scripts/win-pre-backup b/scripts/win-pre-backup new file mode 100644 index 0000000..5075bbd --- /dev/null +++ b/scripts/win-pre-backup @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ ! -z $2 ]; then + UNAME=$2 +fi +if [ ! -z $3 ]; then + PASS=$3 +fi + +BOX=$1 + +if [[ ! -z $UNAME && ! -z $PASS ]]; then + /usr/bin/winexe -s /dev/null --interactive=0 -U $UNAME --password=$PASS //$BOX 'cmd /c c:\backuppc\pre-exec.cmd' <&- || exit 255 +else + /usr/bin/winexe -s /dev/null --interactive=0 --authentication-file=/etc/BackupPC/win.conf //$BOX 'cmd /c c:\backuppc\pre-exec.cmd' <&- || exit 255 +fi +sleep 5 +echo "Rsync and shadow copy loaded"