Imported Upstream version 3.1.0
[debian/amanda] / packaging / rpm / amanda.spec
index 51b87b84a6ce784b30ef866caae3f4a3ad82e49e..2c487a535633aa548104c2af6375f74ad8e73130 100644 (file)
@@ -15,8 +15,8 @@
 #  with this program; if not, write to the Free Software Foundation, Inc.,
 #  59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 # 
-#  Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-#  Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+#  Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
+#  Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
 
 # Try to detect the distribution we are building:
 %if %{_vendor} == redhat 
     # Fedora symlinks /etc/fedora-release to /etc/redhat-release for at least
-    # fc3-7.  So RHEL and Fedora look at the same file.  The awk trickery here
-    # forces the field to be numeric so that the spec comparison works
-    %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 3
+    # fc3-8.  So RHEL and Fedora look at the same file.  Different versions have
+    # different numbers of spaces; hence the use if $3 vs. $4..
+    %if %(awk '$1 == "Fedora" && $4 ~ /3.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 3
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print$4+0}' /etc/redhat-release) == 4
+    %if %(awk '$1 == "Fedora" && $4 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 4
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 5
+    %if %(awk '$1 == "Fedora" && $4 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 5
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 6
+    %if %(awk '$1 == "Fedora" && $4 ~ /6.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 6
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 7
+    %if %(awk '$1 == "Fedora" && $3 ~ /7.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 7
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 8
+    # if macro cannot have an empty test and we're just testing the existance
+    %if %{?fedora:yes}%{!?fedora:no} == yes
         %define dist fedora
         %define disttag fc
-        %define distver 8
-        # TODO: generalize this so that any platform can cross compile
+        %define distver %{fedora}
+       %if %{distver} <= 8
+           %define requires_libtermcap Requires: libtermcap.so.2
+       %endif
         %if %{_host_cpu} == x86_64 && %{_target_cpu} == i686
                 # Do nothing if PKG_CONFIG_PATH was set by the user above.
                 %{!?PKG_CONFIG_PATH: %define PKG_CONFIG_PATH /usr/lib/pkgconfig}
         %endif
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 3
+    %if %(awk '$1 == "Red" && $7 ~ /3.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define disttag rhel
         %define distver 3
+        %define tarver 1.14
+       %define requires_libtermcap Requires: libtermcap.so.2
+       %define without_ipv6 --without-ipv6
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 4
+    %if %(awk '$1 == "Red" && $7 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define disttag rhel
         %define distver 4
+        %define tarver 1.14
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
-    %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 5
+    %if %(awk '$1 == "CentOS" && $3 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
+       %define dist redhat
+       %define disttag rhel
+       %define distver 4
+       %define tarver 1.14
+       %define requires_libtermcap Requires: libtermcap.so.2
+    %endif
+    %if %(awk '$1 == "Red" && $7 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
+        %define dist redhat
+        %define disttag rhel
+        %define distver 5
+       %define requires_libtermcap Requires: libtermcap.so.2
+    %endif
+    %if %(awk '$1 == "CentOS" && $3 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define disttag rhel
         %define distver 5
+       %define requires_libtermcap Requires: libtermcap.so.2
     %endif
+    
+    # If dist is undefined, we didn't detect.
+    %{!?dist:%define dist unknown}
 %endif
-# Detect Suse variants.  Suse gives us some nice macros in their rpms
+# Detect Suse variants. 
 %if %{_vendor} == "suse"
-    %if %{suse_version} == 910
-        %define dist SuSE
-        %define disttag sles
-        %define distver 9
-    %endif
-    %if %{suse_version} == 1010
-        %define dist SuSE
-        %define disttag sles
-        %define distver 10
-    %endif
-    %if %{suse_version} == 1000
-        %define dist SuSE
-        %define disttag suse
-        %define distver 10
-    %endif
+    %define dist SuSE
+    %define disttag %(awk '$1=="SUSE" {$3=="Enterprise" ? TAG="sles" : TAG="suse" ; print TAG}' /etc/SuSE-release)
+    %define distver %(awk '$1=="SUSE" {$3=="Enterprise" ? VER=$5 : VER=$3 ; print VER}' /etc/SuSE-release)
 %endif
 
 # Set options per distribution
 %if %{dist} == redhat || %{dist} == fedora
     %define rpm_group Applications/Archiving
     %define xinetd_reload restart
+    %define requires_initscripts Requires: initscripts
 %endif
 %if %{dist} == SuSE
     %define rpm_group Productivity/Archiving/Backup
     %define xinetd_reload restart
 %endif
 
+# Let's die if we haven't detected the distro. This might save some frustration.
+# RPM does not provide a way to  exit gracefully, hence the tag_to_cause_exit. 
+%{!?distver: %{error:"Your distribution and its version were not detected."}; %tag_to_cause_exit }
+# Set minimum tar version if it wasn't set in the per-distro section
+%{!?tarver: %define tarver 1.15}
+
 %define packer %(%{__id_u} -n)
 
 # --- Definitions ---
 
-# Define amanda_version if it is not already defined.
-%{!?amanda_version: %define amanda_version 2.6.0}
+# Define amanda_version from configure.in if it is not already defined.
+
+%{!?amanda_version: %define amanda_version %(eval %{__cat} FULL_VERSION) }
 %{!?amanda_release: %define amanda_release 1}
 %define amanda_version_info "Amanda Community Edition - version %{amanda_version}"
 %define amanda_user amandabackup
@@ -154,7 +180,14 @@ BuildRequires: flex
 BuildRequires: gcc
 BuildRequires: glibc >= 2.2.0
 BuildRequires: readline
+# Note: newer distros have changed most *-devel to lib*-devel, and added a
+# provides tag for backwards compat.
+BuildRequires: readline-devel
 BuildRequires: curl >= 7.10.0
+BuildRequires: curl-devel >= 7.10.0
+BuildRequires: openssl
+BuildRequires: openssl-devel
+BuildRequires: perl(ExtUtils::Embed)
 Requires: /bin/awk
 Requires: /bin/date
 Requires: /usr/bin/id
@@ -169,13 +202,13 @@ Requires: libc.so.6
 Requires: libm.so.6
 Requires: libnsl.so.1
 Requires: curl >= 7.10.0
+Requires: openssl
 Requires: xinetd
 Requires: perl >= 5.6.0
-Requires: tar >= 1.15
-%if  %{dist} == redhat || %{dist}== fedora
-Requires: libtermcap.so.2
-Requires: initscripts
-%endif
+Requires: tar >= %{tarver}
+Requires: readline
+%{?requires_libtermcap}
+%{?requires_initscripts}
 Provides: amanda-backup_client = %{amanda_version}, amanda-backup_server = %{amanda_version}
 
 %package backup_client
@@ -184,20 +217,21 @@ Group: %{rpm_group}
 Requires: /bin/awk
 Requires: fileutils
 Requires: grep
-%if  %{dist} == redhat || %{dist}== fedora
-Requires: libtermcap.so.2
-Requires: initscripts
-%endif
+%{?requires_libtermcap}
+%{?requires_initscripts}
 Requires: xinetd
 Requires: libc.so.6
 Requires: libm.so.6
 Requires: libnsl.so.1
 Requires: perl >= 5.6.0
-Requires: tar >= 1.15
+Requires: tar >= %{tarver}
+Requires: readline
 Provides: amanda-backup_client = %{amanda_version}
 Provides: libamclient-%{version}.so = %{amanda_version}
 Provides: libamanda-%{version}.so = %{amanda_version}
-Conflicts: amanda-backup_server 
+Conflicts: amanda-backup_server
+# Native package names
+Obsoletes: amanda, amanda-client, amanda-server
 
 %package backup_server
 Summary: The Amanda Backup and Archiving Server
@@ -208,21 +242,21 @@ Requires: grep
 Requires: libc.so.6
 Requires: libm.so.6
 Requires: libnsl.so.1
-%if  %{dist} == redhat || %{dist}== fedora
-Requires: libtermcap.so.2
-Requires: initscripts
-%endif
+%{?requires_libtermcap}
+%{?requires_initscripts}
 Requires: xinetd
 Requires: perl >= 5.6.0
-Requires: tar >= 1.15
+Requires: tar >= %{tarver}
 Provides: amanda-backup_server = %{amanda_version}
+Provides: amanda-backup_client = %{amanda_version}
 Provides: libamclient-%{version}.so = %{amanda_version}
 Provides: libamanda-%{version}.so = %{amanda_version}
 Provides: libamserver-%{version}.so = %{amanda_version}
-Provides: librestore-%{version}.so = %{amanda_version}
 Provides: libamtape-%{version}.so = %{amanda_version}
 Provides: libamdevice-%{version}.so = %{amanda_version}
-
+Conflicts: amanda-backup_client
+# Native package names
+Obsoletes: amanda, amanda-client, amanda-server
 # --- Package descriptions ---
 
 %description
@@ -273,6 +307,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define DATADIR         %{PREFIX}/share
 %define SYSCONFDIR      /etc
 %define LOCALSTATEDIR   /var
+%define AMANDATES       %{AMANDAHOMEDIR}/amandates
 %define AMANDAHOMEDIR   %{LOCALSTATEDIR}/lib/amanda
 %ifarch x86_64
 %define LIBDIR          %{EPREFIX}/lib64
@@ -284,6 +319,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define MANDIR          %{DATADIR}/man
 %define LOGDIR          /var/log/amanda
 %define PERLSITELIB     %(eval "`perl -V:installsitelib`"; echo $installsitelib)
+%define AMDATADIR      /var/lib/amanda
 
 # Installation directories:
 %define ROOT_SBINDIR            %{buildroot}/%{SBINDIR}
@@ -295,6 +331,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define ROOT_LIBDIR             %{buildroot}/%{LIBDIR}
 %define ROOT_MANDIR             %{buildroot}/%{MANDIR}
 %define ROOT_LOGDIR             %{buildroot}/%{LOGDIR}
+%define ROOT_AMDATADIR          %{buildroot}/%{AMDATADIR}
 
 # --- Unpack ---
 
@@ -306,42 +343,12 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define config_user %{amanda_user}
 %define config_group %{amanda_group}
 
-%if  %{disttag} == rhel && %{distver} == 3
-./configure \
-        CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \
-        --quiet \
-        --prefix=%{PREFIX} \
-        --sysconfdir=%{SYSCONFDIR} \
-        --sharedstatedir=%{LOCALSTATEDIR} \
-        --localstatedir=%{LOCALSTATEDIR} \
-        --libdir=%{LIBDIR} \
-        --includedir=%{INCLUDEDIR} \
-        --with-gnuplot=/usr/bin/gnuplot \
-        --with-gnutar=/bin/tar \
-        --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \
-        --with-index-server=localhost \
-        --with-tape-server=localhost \
-        --with-user=%{config_user} \
-        --with-group=%{config_group} \
-        --with-owner=%{packer} \
-        --with-fqdn \
-        --with-bsd-security \
-        --with-bsdtcp-security \
-        --with-bsdudp-security \
-        --with-ssh-security \
-        --with-udpportrange=%{udpportrange} \
-        --with-tcpportrange=%{tcpportrange} \
-        --with-low-tcpportrange=%{low_tcpportrange} \
-        --with-debugging=%{LOGDIR} \
-        --with-assertions \
-        --disable-installperms \
-        --without-ipv6 
-%else
-# This confusing macro results in PKG_CONFIG_PATH=some/path if some/path
-# was set on the command line, or by the platform detection bits.
+# Set PKG_CONFIG_PATH=some/path if some/path was set on the command line, or by 
+# the platform detection bits.
+# without_ipv6 should only be defined on rhel3.
 ./configure \
         %{?PKG_CONFIG_PATH: PKG_CONFIG_PATH=%PKG_CONFIG_PATH} \
-        CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \
+        CFLAGS="%{optflags} -g -pipe" CXXFLAGS="%{optflags}" \
         --quiet \
         --prefix=%{PREFIX} \
         --sysconfdir=%{SYSCONFDIR} \
@@ -349,7 +356,8 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
         --localstatedir=%{LOCALSTATEDIR} \
         --libdir=%{LIBDIR} \
         --includedir=%{INCLUDEDIR} \
-        --with-star=/usr/bin/star \
+       --mandir=%{MANDIR} \
+       --with-amdatadir=%{AMDATADIR} \
         --with-gnuplot=/usr/bin/gnuplot \
         --with-gnutar=/bin/tar \
         --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \
@@ -368,10 +376,10 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
         --with-low-tcpportrange=%{low_tcpportrange} \
         --with-debugging=%{LOGDIR} \
         --with-assertions \
-        --disable-installperms
-%endif
+        --disable-installperms \
+        %{?without_ipv6}
 
-make
+make -s LIBTOOLFLAGS=--silent
 
 # --- Install to buildroot ---
 
@@ -385,9 +393,8 @@ else
         exit -1
 fi
 
-make -j1 DESTDIR=%{buildroot} install
+make -s -j1 LIBTOOLFLAGS=--silent DESTDIR=%{buildroot} install
 
-rm -rf %{ROOT_DATADIR}/amanda
 rm -f %{ROOT_AMANDAHOMEDIR}/example/inetd.conf.amandaclient
 mkdir %{buildroot}/{etc,var/log}
 mkdir %{ROOT_LOCALSTATEDIR}/amanda 
@@ -426,7 +433,7 @@ echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TM
 # Check for the 'amanda' user
 echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE}
 if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then
-        useradd -c "Amanda" -M -g ${amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user}
+        useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user}
         if [ %{dist} = "SuSE" ]; then
                 PASSWD_EXIT=$?
         else
@@ -607,29 +614,29 @@ if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
         fi
 fi
 
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
+echo "`date +'%b %e %Y %T'`: Installing '%{AMANDATES}'." >${TMPFILE}
 ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
-        touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+if [ ! -f %{AMANDATES} ] ; then
+        touch %{AMANDATES} >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
-                echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`: The file '%{AMANDATES}' has been created." >>${TMPFILE}
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
-        chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-        chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDATES}'." >>${TMPFILE}
+        chown %{amanda_user}:%{amanda_group} %{AMANDATES} >>${TMPFILE} 2>&1
+        chmod 0640 %{AMANDATES} >>${TMPFILE} 2>&1
         if [ -x /sbin/restorecon ] ; then
-              /sbin/restorecon %{LOCALSTATEDIR}/amanda/amandates  >>${TMPFILE} 2>&1
+              /sbin/restorecon %{AMANDATES}  >>${TMPFILE} 2>&1
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation successful." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_LOG}
 else
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation failed." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_ERR}
 fi
@@ -649,7 +656,7 @@ if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE}
         chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
@@ -791,7 +798,7 @@ echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TM
 # Check for the 'amanda' user
 echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE}
 if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then
-        useradd -c "Amanda" -M -g ${amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user}
+        useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user}
         if [ %{dist} = "SuSE" ]; then
                 PASSWD_EXIT=$?
         else
@@ -972,26 +979,26 @@ if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
         fi
 fi
 
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
+echo "`date +'%b %e %Y %T'`: Installing '%{AMANDATES}'." >${TMPFILE}
 ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
-        touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+if [ ! -f %{AMANDATES} ] ; then
+        touch %{AMANDATES} >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
-                echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`: The file '%{AMANDATES}' has been created." >>${TMPFILE}
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
-        chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-        chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDATES}'." >>${TMPFILE}
+        chown %{amanda_user}:%{amanda_group} %{AMANDATES} >>${TMPFILE} 2>&1
+        chmod 0640 %{AMANDATES} >>${TMPFILE} 2>&1
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation successful." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_LOG}
 else
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation failed." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_ERR}
 fi
@@ -1029,7 +1036,7 @@ echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.am_passphrase' file." >
 if [ ! -f %{AMANDAHOMEDIR}/.am_passphrase ] ; then
         echo "`date +'%b %e %Y %T'`: Create '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE}
         touch %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
-        phrase=`echo "amandabackup" | md5sum | awk '{print $1}'`
+        phrase=`echo $RANDOM | md5sum | awk '{print $1}'`
         echo ${phrase} >>%{AMANDAHOMEDIR}/.am_passphrase
 
         chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
@@ -1052,7 +1059,7 @@ if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE}
         chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
@@ -1177,7 +1184,7 @@ echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TM
 # Check for the 'amanda' user
 echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE}
 if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then
-        useradd -c "Amanda" -M -g ${amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} >>${TMPFILE} 2>&1
+        useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} >>${TMPFILE} 2>&1
         if [ %{dist} = "SuSE" ]; then
                 PASSWD_EXIT=$?
         else
@@ -1356,26 +1363,26 @@ if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
         fi
 fi
 
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
+echo "`date +'%b %e %Y %T'`: Installing '%{AMANDATES}'." >${TMPFILE}
 ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
-        touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+if [ ! -f %{AMANDATES} ] ; then
+        touch %{AMANDATES} >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
-                echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`: The file '%{AMANDATES}' has been created." >>${TMPFILE}
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
-        chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-        chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDATES}'." >>${TMPFILE}
+        chown %{amanda_user}:%{amanda_group} %{AMANDATES} >>${TMPFILE} 2>&1
+        chmod 0640 %{AMANDATES} >>${TMPFILE} 2>&1
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation successful." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_LOG}
 else
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation failed." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_ERR}
 fi
@@ -1419,7 +1426,7 @@ if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE}
         chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
@@ -1500,75 +1507,66 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 /sbin/ldconfig
 
 # --- Files to install ---
-
+# Notes:  Do not use wildcards on directories not wholly owned by amanda.  An
+# uninstall of the software will attempt to delete whatever matches here.
 %files backup_client
-%defattr(0755,%{amanda_user},%{amanda_group})
-%{SYSCONFDIR}/amanda
-%{AMANDAHOMEDIR}
+%defattr(0755,%{amanda_user},%{amanda_group},0755)
 %{AMLIBEXECDIR}
 %{AMLIBDIR}
-%{AMLIBEXECDIR}/amanda-sh-lib.sh
-%{LOCALSTATEDIR}/amanda
+%{PERLSITELIB}/auto/Amanda
 %defattr(4750,root,disk)
+%{AMLIBEXECDIR}/application/amgtar
+%{AMLIBEXECDIR}/application/amstar
 %{AMLIBEXECDIR}/calcsize
 %{AMLIBEXECDIR}/killpgrp
 %{AMLIBEXECDIR}/rundump
 %{AMLIBEXECDIR}/runtar
-%defattr(0750,%{amanda_user},%{amanda_group})
+%defattr(0750,%{amanda_user},%{amanda_group},0750)
 %{LOGDIR}
 %{SBINDIR}/amaespipe
 %{SBINDIR}/amcryp*
 %{SBINDIR}/amgpgcrypt
 %{SBINDIR}/amoldrecover
 %{SBINDIR}/amrecover
-%defattr(0644,%{amanda_user},%{amanda_group})
+%{SYSCONFDIR}/amanda
+%defattr(0644,%{amanda_user},%{amanda_group},0755)
+%{LOCALSTATEDIR}/amanda
+%{PERLSITELIB}/Amanda
+%{AMLIBEXECDIR}/amcat.awk
+%{AMANDAHOMEDIR}/gnutar-lists
+%doc %{AMANDAHOMEDIR}/amanda-release
+%doc %{AMANDAHOMEDIR}/example/xinetd.amandaclient
+%doc %{AMANDAHOMEDIR}/example/xinetd.amandaserver
+%doc %{AMANDAHOMEDIR}/example/amanda-client.conf
+%doc %{AMANDAHOMEDIR}/template.d/README
+%doc %{AMANDAHOMEDIR}/template.d/dumptypes
+%defattr(0644,root,root,0755)
 %docdir %{MANDIR}
 %{MANDIR}/man5/amanda.conf.5.gz
 %{MANDIR}/man5/amanda-client.conf.5.gz
+%{MANDIR}/man7/amanda-devices.7.gz
+%{MANDIR}/man7/amanda-applications.7.gz
+%{MANDIR}/man7/amanda-scripts.7.gz
+%{MANDIR}/man8/amaespipe.8.gz
 %{MANDIR}/man8/amanda.8.gz
 %{MANDIR}/man8/amcheckdump.8.gz
+%{MANDIR}/man8/amcrypt*
+%{MANDIR}/man8/amgpgcrypt.8.gz
 %{MANDIR}/man8/amrecover.8.gz
-%{AMLIBEXECDIR}/amcat.awk
-%{AMANDAHOMEDIR}/amanda-release
-%{AMANDAHOMEDIR}/example/xinetd.amandaclient
-%{AMANDAHOMEDIR}/example/amanda-client.conf
+%doc %{DATADIR}/amanda
 
 %files backup_server
 %defattr(0755,%{amanda_user},%{amanda_group})
-%{SYSCONFDIR}/amanda
 %{AMLIBEXECDIR}
 %{AMLIBDIR}
 %{PERLSITELIB}/Amanda
 %{PERLSITELIB}/auto/Amanda
 %{AMANDAHOMEDIR}
 %{LOCALSTATEDIR}/amanda
-%{SBINDIR}/amaddclient
-%{SBINDIR}/amadmin
-%{SBINDIR}/amcheckdb
-%{SBINDIR}/amcheckdump
-%{SBINDIR}/amcleanup
-%{SBINDIR}/amdd
-%{SBINDIR}/amdevcheck
-%{SBINDIR}/amdump
-%{SBINDIR}/amfetchdump
-%{SBINDIR}/amflush
-%{SBINDIR}/amgetconf
-%{SBINDIR}/amlabel
-%{SBINDIR}/ammt
-%{SBINDIR}/amoverview
-%{SBINDIR}/amplot
-%{SBINDIR}/amreport
-%{SBINDIR}/amrestore
-%{SBINDIR}/amrmtape
-%{SBINDIR}/amserverconfig
-%{SBINDIR}/amstatus
-%{SBINDIR}/amtape
-%{SBINDIR}/amtapetype
-%{SBINDIR}/amtoc
-%{SBINDIR}/amverify
-%{SBINDIR}/amverifyrun
-%{AMLIBEXECDIR}/amanda-sh-lib.sh
+%{SBINDIR}/am*
 %defattr(4750,root,disk)
+%{AMLIBEXECDIR}/application/amgtar
+%{AMLIBEXECDIR}/application/amstar
 %{AMLIBEXECDIR}/calcsize
 %{AMLIBEXECDIR}/killpgrp
 %{AMLIBEXECDIR}/rundump
@@ -1576,8 +1574,11 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{AMLIBEXECDIR}/dumper
 %{AMLIBEXECDIR}/planner
 %{SBINDIR}/amcheck
-%defattr(0750,%{amanda_user},%{amanda_group})
+%defattr(0750,%{amanda_user},%{amanda_group},0750)
 %{LOGDIR}
+%{SYSCONFDIR}/amanda
+# Files in standard dirs must be listed explicitly
+%{SBINDIR}/activate-devpay
 %{SBINDIR}/amaespipe
 %{SBINDIR}/amcrypt
 %{SBINDIR}/amcrypt-ossl
@@ -1591,54 +1592,35 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{AMLIBEXECDIR}/amplot.awk
 %{AMLIBEXECDIR}/amplot.g
 %{AMLIBEXECDIR}/amplot.gp
+%doc %{AMANDAHOMEDIR}/amanda-release
+%docdir %{AMANDAHOMEDIR}/example
+%docdir %{AMANDAHOMEDIR}/template.d
+%defattr(0644,root,root,0755)
 %docdir %{MANDIR}
-%{MANDIR}/man5/amanda.conf.5.gz
-%{MANDIR}/man5/amanda-client.conf.5.gz
-%{MANDIR}/man8/amaddclient.8.gz
-%{MANDIR}/man8/amadmin.8.gz
-%{MANDIR}/man8/amanda.8.gz
-%{MANDIR}/man8/amcheck.8.gz
-%{MANDIR}/man8/amcheckdb.8.gz
-%{MANDIR}/man8/amcheckdump.8.gz
-%{MANDIR}/man8/amcleanup.8.gz
-%{MANDIR}/man8/amdd.8.gz
-%{MANDIR}/man8/amdump.8.gz
-%{MANDIR}/man8/amfetchdump.8.gz
-%{MANDIR}/man8/amflush.8.gz
-%{MANDIR}/man8/amgetconf.8.gz
-%{MANDIR}/man8/amlabel.8.gz
-%{MANDIR}/man8/ammt.8.gz
-%{MANDIR}/man8/amoverview.8.gz
-%{MANDIR}/man8/amplot.8.gz
-%{MANDIR}/man8/amrecover.8.gz
-%{MANDIR}/man8/amreport.8.gz
-%{MANDIR}/man8/amrestore.8.gz
-%{MANDIR}/man8/amrmtape.8.gz
-%{MANDIR}/man8/amserverconfig.8.gz
-%{MANDIR}/man8/amstatus.8.gz
-%{MANDIR}/man8/amtape.8.gz
-%{MANDIR}/man8/amtapetype.8.gz
-%{MANDIR}/man8/amtoc.8.gz
-%{MANDIR}/man8/amverify.8.gz
-%{MANDIR}/man8/amverifyrun.8.gz
-%{MANDIR}/man8/amcrypt.8.gz
-%{MANDIR}/man8/amcrypt-ossl.8.gz
-%{MANDIR}/man8/amcrypt-ossl-asym.8.gz
-%{MANDIR}/man8/amcryptsimple.8.gz
-%{MANDIR}/man8/amgpgcrypt.8.gz
-%{MANDIR}/man8/amaespipe.8.gz
-%{MANDIR}/man8/amdevcheck.8.gz
-%{AMANDAHOMEDIR}/amanda-release
-%{AMANDAHOMEDIR}/example/amanda-client.conf
-%{AMANDAHOMEDIR}/example/xinetd.amandaserver
+%{MANDIR}/man5/am*
+%{MANDIR}/man5/disklist.5.gz
+%{MANDIR}/man5/tapelist.5.gz
+%{MANDIR}/man7/am*
+%{MANDIR}/man8/am*
+%{MANDIR}/man8/script-email.8.gz
+%doc %{DATADIR}/amanda
 
 # --- ChangeLog
 
 %changelog
+* Mon Sep 15 2008 Dan Locks <dwlocks at zmanda dot com> 2.6.1alpha
+- Added detection of CentOS 4 and 5 as suggested by dswartz
+- graceful failure when Distro/version is not detected correctly
+* Thu Jun 12 2008 Dan Locks <dwlocks at zmanda dot com> 2.6.1alpha
+- install amgtar and amstar suid root
+* Mon Jun 09 2008 Dan Locks <dwlocks at zmanda dot com> 2.6.1alpha
+- Replaced individual SBINDIR/am... entries with SBINDIR/am* in %%files
+* Fri May 02 2008 Dan Locks <dwlocks at zmanda dot com>
+- Changed instances of ${ to %%{ where applicable
 * Tue Mar 11 2008 Dan Locks <dwlocks at zmanda dot com>
 - fixed many rpmlint complaints
 - added --quiet to configure statements
-- moved PERLSITELIB to definitions section
+- added PERLSITELIB to definitions section and perl files to %%files section
 * Wed Feb 13 2008 Dan Locks <dwlocks at zmanda dot com>
 - added an environment check for PKG_CONFIG_PATH
 - added PKG_CONFIG_PATH conditional to handle cross comp on FC8 (environment