You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

149 lines
5.6 KiB

##
## usemod.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_real 1.0
%define V_comp 10
# package information
Name: usemod
Summary: UseMod Wiki Engine
URL: http://www.usemod.com/
Vendor: Clifford A. Adams
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: CMS
License: GPL
Version: %{V_real}
Release: 20080101
# list of sources
Source0: http://www.usemod.com/wikicode/usemod%{V_comp}.tar.gz
Source1: usemod-apache.conf
Patch0: usemod.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101, perl, perl-www, MTA
%description
UseMod is a small implementation of the original Wiki concept
created by Ward Cunningham. It uses no backend databases and is
fully self-contained.
%track
prog usemod = {
version = %{V_comp}
url = http://www.usemod.com/cgi-bin/wiki.pl?UseModWiki/Download
regex = usemod(__VER__)\.tar\.gz
}
%prep
%setup -q -n usemod%{V_comp}
%patch -p0
%build
%install
# create installation area
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/cgi \
$RPM_BUILD_ROOT%{l_prefix}/etc/usemod \
$RPM_BUILD_ROOT%{l_prefix}/var/usemod
# install UseMod CGI
%{l_shtool} install -c -m 755 \
-e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
-e 's;^\($DataDir[^=]*=[^"]*"\)[^"]*\("\);\1%{l_prefix}/var/usemod\2;' \
-e 's;^\($ConfigFile[^=]*=[^"]*"\)[^"]*\("\);\1%{l_prefix}/etc/usemod/usemod.cfg\2;' \
wiki.pl $RPM_BUILD_ROOT%{l_prefix}/cgi/usemod
# install UseMod configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
-e 's;/usr/bin/;%{l_prefix}/bin;' \
-e 's;^\($CookieName[^=]*=[^"]*"\)[^"]*\("\);\1UseModWiki\2;' \
-e 's;^\($SiteName[^=]*=[^"]*"\)[^"]*\("\);\1UseMod Wiki\2;' \
-e 's;^\($LogoUrl[^=]*=[^"]*"\)[^"]*\("\);\1/usemod.gif\2;' \
-e 's;^\($StyleSheet[^=]*=[^"]*"\)[^"]*\("\);\1/usemod.css\2;' \
-e 's;^\($EmailFromt[^=]*=[^"]*"\)[^"]*\("\);\1UseMod\2;' \
-e 's;^\($SendMail[^=]*=[^"]*"\)[^"]*\("\);\1%{l_prefix}/sbin/sendmail\2;' \
-e 's;^\($UploadDir[^=]*=[^"]*"\)[^"]*\("\);\1%{l_prefix}/var/usemod/upload\2;' \
-e 's;^\($UploadUrl[^=]*=[^"]*"\)[^"]*\("\);\1/usemod/upload\2;' \
-e 's;^\($UseUpload[^=]*=[^"]*"\)[^"]*\("\);\11\2;' \
-e 's;^\($EmailNotify[^=]*=[^"]*"\)[^"]*\("\);\11\2;' \
-e 's;^\($ShowEdits[^=]*=[^"]*"\)[^"]*\("\);\11\2;' \
-e 's;^\($ThinLine[^=]*=[^"]*"\)[^"]*\("\);\11\2;' \
-e 's;^\($NetworkFile[^=]*=[^"]*"\)[^"]*\("\);\10\2;' \
-e 's;^\($NumberDates[^=]*=[^"]*"\)[^"]*\("\);\11\2;' \
-e 's;^\($EditNameLink[^=]*=[^"]*"\)[^"]*\("\);\11\2;' \
config $RPM_BUILD_ROOT%{l_prefix}/etc/usemod/usemod.cfg
# install Apache configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE usemod-apache.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/usemod/
# install additional files
%{l_shtool} install -c -m 644 \
wiki.css $RPM_BUILD_ROOT%{l_prefix}/etc/usemod/usemod.css
%{l_shtool} install -c -m 644 \
wiki.gif $RPM_BUILD_ROOT%{l_prefix}/etc/usemod/usemod.gif
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/usemod/*' \
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/usemod'
%files -f files
%clean
%post
if [ ".$1" = .1 ]; then
# add hook to Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
( echo "Include $RPM_INSTALL_PREFIX/etc/usemod/usemod-apache.conf"
) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:usemod" $apacheconf
fi
# display information about steps the admin should perform next
( echo "UseMod was successfully installed. You should now start Apache with"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc apache start"
) | %{l_rpmtool} msg -b -t notice
fi
%postun
if [ ".$1" = .0 ]; then
# remove hook from Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:usemod" $apacheconf
fi
fi