Browse Source

further improve packaging by adding a run-command script and switching the database to restricted user ownerships

master
parent
commit
a18b5e5cbe
  1. 37
      htdig/htdig.spec
  2. 51
      htdig/rc.htdig

37
htdig/htdig.spec

@ -37,6 +37,7 @@ Release: 20060323
# list of sources
Source0: http://www.htdig.org/files/htdig-%{version}.tar.gz
Source1: rc.htdig
Patch0: htdig.patch
# build information
@ -72,8 +73,10 @@ AutoReqProv: no
%patch -p0
%build
# configure program
%{l_shtool} subst \
-e 's;/cgi-bin/htsearch;/openpkg-cgi/htsearch;g' \
-e 's;$(VERSION);;' \
installdir/search.html
CC="%{l_cc}" \
CXX="%{l_cxx} -Wno-deprecated" \
@ -84,7 +87,7 @@ AutoReqProv: no
--prefix=%{l_prefix} \
--with-config-dir=%{l_prefix}/etc/htdig \
--with-common-dir=%{l_prefix}/share/htdig \
--with-database-dir=%{l_prefix}/var/htdig \
--with-database-dir=%{l_prefix}/var/htdig/db \
--with-default-config-file=%{l_prefix}/etc/htdig/htdig.conf \
--with-cgi-bin-dir=%{l_prefix}/cgi \
--with-image-dir=%{l_prefix}/share/htdig/image \
@ -96,17 +99,35 @@ AutoReqProv: no
--with-apache=%{l_prefix}/bin/apache \
--disable-bigfile \
--disable-shared
# build program
%{l_make} %{l_mflags}
%install
# install program
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
# strip down installation
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.htdig} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# create additional directories
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/htdig/run
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/htdig/*'
'%config %{l_prefix}/etc/htdig/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/htdig/*'
%files -f files
@ -125,10 +146,13 @@ AutoReqProv: no
# display final hints on initial installation
( echo "To complete this installation of ht://Dig please edit"
echo "the configuration file, run ht://Dig once to initially"
echo "create the database and then access the search form:"
echo "the configuration file and run ht://Dig once to initially"
echo "create the database:"
echo " \$ vi $RPM_INSTALL_PREFIX/etc/htdig/htdig.conf"
echo " \$ $RPM_INSTALL_PREFIX/bin/rundig"
echo " \$ $RPM_INSTALL_PREFIX/etc/rc htdig daily"
echo " \$ $RPM_INSTALL_PREFIX/etc/rc apache stop start"
echo "Now you should be able to access the search form and"
echo "perform your first search:"
echo " http://localhost/openpkg-htdig/"
) | %{l_rpmtool} msg -b -t notice
fi
@ -144,7 +168,8 @@ AutoReqProv: no
fi
# before erase, remove data
rm -f $RPM_INSTALL_PREFIX/var/htdig/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/htdig/run/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/htdig/db/* >/dev/null 2>&1 || true
fi
exit 0

51
htdig/rc.htdig

@ -0,0 +1,51 @@
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
## rc.htdig -- Run-Commands
##
%config
htdig_enable="$openpkg_rc_def"
htdig_update="daily"
htdig_flags="-v"
htdig_log_prolog="true"
htdig_log_epilog="true"
htdig_log_numfiles="10"
htdig_log_minsize="1M"
htdig_log_complevel="9"
%common
htdig_logfile="@l_prefix@/var/htdig/run/htdig.log"
htdig_update () {
@l_prefix@/bin/rundig $htdig_flags >>$htdig_logfile
}
%quarterly -u @l_rusr@
rcService htdig enable yes || exit 0
if [ ".$htdig_update" = .quarterly ]; then
htdig_update || exit $?
fi
%hourly -u @l_rusr@
rcService htdig enable yes || exit 0
if [ ".$htdig_update" = .hourly ]; then
htdig_update || exit $?
fi
%daily -u @l_rusr@
rcService htdig enable yes || exit 0
if [ ".$htdig_update" = .daily ]; then
htdig_update || exit $?
fi
shtool rotate -f \
-n ${htdig_log_numfiles} -s ${htdig_log_minsize} -d \
-z ${htdig_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
-P "${htdig_log_prolog}" \
-E "${htdig_log_epilog}" \
$htdig_logfile
%weekly -u @l_rusr@
rcService htdig enable yes || exit 0
if [ ".$htdig_update" = .weekly ]; then
htdig_update || exit $?
fi
Loading…
Cancel
Save