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.
 
 
 
 
 
 

246 lines
8.7 KiB

##
## amanda.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 information
Name: amanda
Summary: The Advanced Maryland Automatic Network Disk Archiver
URL: http://www.amanda.org/
Vendor: University of Maryland at College Park
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: PLUS
Group: System
License: BSD-style
Version: 3.3.7p1
Release: 20150217
# package options
%option with_server no
%option with_port_range yes
%option with_config default
%option with_tape_srv default
%option with_index_srv default
%option with_tape_dev default
# list of sources
Source0: http://download.sourceforge.net/amanda/amanda-%{version}.tar.gz
Source1: amanda.conf
Source2: amanda.disklist
Source3: xinetd.amanda
Source4: xinetd.amandaidx
Source5: xinetd.amidxtape
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101, tar, make, gcc, grep
PreReq: OpenPKG, openpkg >= 20160101, tar, xinetd, grep
%description
AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is
a backup system that allows the administrator of a LAN to set up a
single master backup server to back up multiple hosts to a single
large capacity tape drive. AMANDA uses native dump and/or GNU tar
facilities and can back up a large number of workstations running
multiple versions of Unix.
%track
prog amanda = {
version = %{version}
url = http://www.amanda.org/download.php
regex = amanda-(\d+\.\d+\.\d+(p\d+)?)\.tar\.gz
}
%prep
%setup -q
# patch /etc/amandates problem
%{l_shtool} subst -s \
-e 's;/etc/amandates;%{l_prefix}/etc/amanda/amandates;g' \
client-src/amandates.h
# relocate .amandahosts to %{l_prefix}/etc/amanda
%{l_shtool} subst -s \
-e 's;pwptr->pw_dir, "/.amandahosts";"%{l_prefix}/etc/amanda", "/.amandahosts";g' \
common-src/security.c
# replace grep -E
%{l_shtool} subst -s \
-e 's;\(ac_cv_prog_egrep=.*\)grep \-E\(.*\);\1egrep\2;g' \
configure acinclude.m4 config/libtool.m4i
# replace hard-coded chown=root
%{l_shtool} subst -s \
-e 's;chown=root;;g' \
client-src/Makefile.in \
application-src/Makefile.in
%build
# configure package
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
LIBS="%{l_fsl_libs}" \
./configure \
--prefix=%{l_prefix} \
--sysconfdir=%{l_prefix}/etc/amanda \
--libexecdir=%{l_prefix}/libexec \
--libdir=%{l_prefix}/lib/amanda \
--localstatedir=%{l_prefix}/var/amanda \
--includedir=%{l_prefix}/include/amanda \
--disable-installperms \
--enable-static \
--enable-shared \
--with-user=%{l_musr} \
--with-group=%{l_mgrp} \
--with-configdir=%{l_prefix}/etc/amanda \
--with-gnutar=%{l_prefix}/bin/tar \
--with-gnutar-listdir=%{l_prefix}/var/amanda/gnutar-lists \
%if "%{with_port_range}" == "yes"
--with-portrange=50000,50090 \
--with-udpportrange=920,980 \
%endif
%if "%{with_config}" != "default"
--with-config=%{with_config} \
%endif
%if "%{with_tape_srv}" != "default"
--with-tape-server=%{with_tape_srv} \
%endif
%if "%{with_tape_dev}" != "default"
--with-tape-device=%{with_tape_dev} \
%endif
%if "%{with_index_srv}" != "default"
--with-index-server=%{with_index_srv} \
%endif
%if "%{with_server}" == "yes"
--with-server
%else
--without-server
%endif
# build package
%{l_make} %{l_mflags}
%install
# perform standard installation procedure
%{l_make} %{l_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
BINARY_OWNER="`%{l_shtool} echo -e %u`" \
SETUID_GROUP="`%{l_shtool} echo -e %u`"
# create additional directories
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/amanda \
$RPM_BUILD_ROOT%{l_prefix}/etc/xinetd/xinetd.d \
$RPM_BUILD_ROOT%{l_prefix}/var/amanda/gnutar-lists \
$RPM_BUILD_ROOT%{l_prefix}/var/amanda/DailySet1
# create additional server-specific directories
%if "%{with_server}" == "yes"
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/amanda \
$RPM_BUILD_ROOT%{l_prefix}/etc/amanda/DailySet1 \
$RPM_BUILD_ROOT%{l_prefix}/var/amanda/dumps \
$RPM_BUILD_ROOT%{l_prefix}/var/amanda/DailySet1/curinfo \
$RPM_BUILD_ROOT%{l_prefix}/var/amanda/DailySet1/index
%endif
# create empty files
touch $RPM_BUILD_ROOT%{l_prefix}/etc/amanda/.amandahosts
touch $RPM_BUILD_ROOT%{l_prefix}/etc/amanda/amandates
touch $RPM_BUILD_ROOT%{l_prefix}/lib/amanda/exclude.gtar
# install xinetd configuration files
%{l_shtool} install -c -m 644 \
-e 's;@USER@;%{l_musr};g' \
-e 's;@GROUP@;%{l_mgrp};g' \
-e 's;@LIBDIR@;%{l_prefix}/libexec/amanda;g' \
%{SOURCE xinetd.amanda} \
$RPM_BUILD_ROOT%{l_prefix}/etc/xinetd/xinetd.d/amanda
%if "%{with_server}" == "yes"
%{l_shtool} install -c -m 644 \
-e 's;@USER@;%{l_musr};g' \
-e 's;@GROUP@;%{l_mgrp};g' \
-e 's;@LIBDIR@;%{l_prefix}/libexec/amanda;g' \
%{SOURCE xinetd.amandaidx} \
$RPM_BUILD_ROOT%{l_prefix}/etc/xinetd/xinetd.d/amandaidx
%{l_shtool} install -c -m 644 \
-e 's;@USER@;%{l_musr};g' \
-e 's;@GROUP@;%{l_mgrp};g' \
-e 's;@LIBDIR@;%{l_prefix}/libexec/amanda;g' \
%{SOURCE xinetd.amidxtape} \
$RPM_BUILD_ROOT%{l_prefix}/etc/xinetd/xinetd.d/amidxtape
%endif
%if "%{with_server}" == "yes"
# install example server configuration
%{l_shtool} install -c -m 644 \
-e 's;@PREFIX@;%{l_prefix};g' \
%{SOURCE amanda.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/amanda/DailySet1/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE amanda.disklist} \
$RPM_BUILD_ROOT%{l_prefix}/etc/amanda/DailySet1/disklist
%endif
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/amanda/*' \
'%config(noreplace) %{l_prefix}/etc/xinetd/xinetd.d/*' \
'%attr(660,%{l_musr},%{l_mgrp}) %config(noreplace) %{l_prefix}/etc/amanda/.amandahosts' \
%if "%{with_server}" == "yes"
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/amcheck' \
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/amanda/dumper' \
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/amanda/planner' \
%endif
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/amanda/runtar' \
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/amanda/rundump' \
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/amanda/calcsize' \
'%attr(4711,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/amanda/killpgrp' \
'%attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/amanda/amandates' \
'%attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/var/amanda/gnutar-lists'
%files -f files
%clean
%post
if [ $1 = 1 ]; then
# add entries to /etc/services
( echo "amanda 10080/udp # AMANDA"
echo "amandaidx 10082/tcp # AMANDA"
echo "amidxtape 10083/tcp # AMANDA"
) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:amanda" /etc/services
fi
exit 0
%preun
if [ $1 = 0 ]; then
# remove entries from /etc/services
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:amanda" /etc/services
fi
exit 0