attempt to make sure $Conf{TopDir} is listed in updatedb PRUNEPATHS,

otherwise at least generate a warning on statup (bz #554491)
This commit is contained in:
Bernard Johnson 2011-07-07 22:16:49 -06:00
commit bbae64c8dc
2 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,37 @@
diff -Naur BackupPC-3.2.1-pristine/init.d/src/linux-backuppc BackupPC-3.2.1/init.d/src/linux-backuppc
--- BackupPC-3.2.1-pristine/init.d/src/linux-backuppc 2011-04-24 21:31:55.000000000 -0600
+++ BackupPC-3.2.1/init.d/src/linux-backuppc 2011-07-07 21:36:41.363281386 -0600
@@ -20,6 +20,25 @@
RETVAL=0
+topDirCheck()
+{
+ updatedb=/etc/updatedb.conf
+ topdir=$(perl <<_EOF_
+ require '__CONFDIR__/config.pl';
+ print \$Conf{TopDir};
+_EOF_
+)
+ if [ -r $updatedb ]; then
+ grep ^PRUNEPATHS $updatedb | grep ${topdir%%/} > /dev/null
+ if [ $? -eq 1]; then
+ logger -t BackupPC -s "WARNING: Your BackupPC \$Conf{TopDir} is not listed in the locate"
+ logger -t BackupPC -s "database configuration's PRUNEPATHS. This may cause all of your"
+ logger -t BackupPC -s "backed up files to be indexed!"
+ fi
+ fi
+}
+
+
start() {
#
# You can set the SMB share password here is you wish. Otherwise
@@ -38,6 +57,7 @@
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/backuppc || \
RETVAL=1
+ topDirCheck
return $RETVAL
}

View file

@ -11,6 +11,7 @@ Group: Applications/System
License: GPLv2+
URL: http://backuppc.sourceforge.net/
Source0: http://downloads.sourceforge.net/backuppc/%{name}-%{version}.tar.gz
Patch0: BackupPC-3.2.1-locatedb.patch
Source1: BackupPC.htaccess
Source2: BackupPC.logrotate
Source3: BackupPC-README.fedora
@ -63,6 +64,8 @@ configurable and easy to install and maintain.
%setup -q
%patch0 -p1 -b .locatedb
sed -i "s|\"backuppc\"|\"$LOGNAME\"|g" configure.pl
for f in ChangeLog doc/BackupPC.pod doc/BackupPC.html; do
iconv -f ISO-8859-1 -t UTF-8 $f > $f.utf && mv $f.utf $f
@ -206,6 +209,14 @@ chkconfig --add backuppc || :
service httpd condrestart > /dev/null 2>&1 || :
%{_sbindir}/usermod -a -G backuppc apache || :
# add BackupPC backup directories to PRUNEPATHS in locate database
UPDATEDB=/etc/updatedb.conf
if [ -w $UPDATEDB ]; then
grep ^PRUNEPATHS $UPDATEDB | grep %{_sharedstatedir}/%{name} > /dev/null
if [ $? -eq 1 ]; then
sed -i '\@PRUNEPATHS@s@"$@ '%{_sharedstatedir}/%{name}'"@' $UPDATEDB
fi
fi
%postun
service httpd condrestart > /dev/null 2>&1 || :
@ -215,6 +226,11 @@ if [ "$1" -eq "0" ]; then
# Remove the SElinux policy.
semodule -r %{name} || :
)&>/dev/null
# remove BackupPC backup directories from PRUNEPATHS in locate database
if [ -w $UPDATEDB ]; then
sed -i '\@PRUNEPATHS@s@[ ]*'%{_sharedstatedir}/%{name}'@@' $UPDATEDB
fi
fi
%endif
@ -244,7 +260,7 @@ fi
%endif
%changelog
* Wed Jul 06 2011 Bernard Johnson <bjohnson@symetrix.com> - 3.2.1-1
* Thu Jul 07 2011 Bernard Johnson <bjohnson@symetrix.com> - 3.2.1-1
- v 3.2.1
- add lower case script alias for typing impaired
- cleanup selinux macros
@ -253,6 +269,8 @@ fi
or samba3x-client (bz #667479)
- unbundle perl(Net::FTP::AutoReconnect) and perl(Net::FTP::RetrHandle)
- remove old patch that is no longer needed
- attempt to make sure $Conf{TopDir} is listed in updatedb PRUNEPATHS,
otherwise at least generate a warning on statup (bz #554491)
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild