Imported Upstream version 3.3.1
[debian/amanda] / packaging / rpm / amanda.spec.src
index 5155879073f8a36c70bd5bd4dec23e1994fa486a..ec55de84d383481920f7f43830f4ac4577eb44eb 100644 (file)
 
 %{?PKG_CONFIG_PATH:%{echo:PKG_CONFIG_PATH = %{PKG_CONFIG_PATH}}}
 
+# LDFLAGS: newer gnu linkers can use "-Wl,--as-needed", while older ones,
+# like rhel3 and sles9 can't.
+%define enable_as_needed --enable-as-needed
+
 # Define which Distribution we are building:
 # Try to detect the distribution we are building:
 %if %{_vendor} == redhat 
         %define disttag fc
         %define distver 3
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %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
+       %define curl curl
     %endif
     %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
+       %define curl curl
     %endif
     %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
+       %define curl curl
     %endif
     %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
+       %define curl curl
     %endif
     # if macro cannot have an empty test and we're just testing the existance
     %if %{?fedora:yes}%{!?fedora:no} == yes
         %define distver %{fedora}
        %if %{distver} <= 8
            %define requires_libtermcap Requires: libtermcap.so.2
+           %define curl curl
+       %endif
+       %if %{distver} >= 9
+           %define curl libcurl
        %endif
         %if %{_host_cpu} == x86_64 && %{_target_cpu} == i686
                 # Do nothing if PKG_CONFIG_PATH was set by the user above.
@@ -86,6 +99,7 @@
         %define distver 3
         %define tarver 1.14
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
        %define without_ipv6 --without-ipv6
     %endif
     %if %(awk '$1 == "Red" && $7 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define distver 4
         %define tarver 1.14
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "CentOS" && $3 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
        %define dist redhat
        %define distver 4
        %define tarver 1.14
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %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
+       %define curl curl
     %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
+       %define curl curl
+    %endif
+    %if %(awk '$1 == "Red" && $7 ~ /6.*/ { exit 1; }' /etc/redhat-release; echo $?)
+        %define dist redhat
+        %define disttag rhel
+        %define distver 6
+       %define curl libcurl
     %endif
     
     # If dist is undefined, we didn't detect.
     %if %(awk '$1 == "SUSE" { exit 1; }' /etc/SuSE-release; echo $?)
         %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)
+       # Always use quotes in rpm comparisons if values could be interpreted
+       # as integers.
+       %define curl curl
+       %if "%{distver}" == "9"
+           %undefine enable_as_needed
+       %endif
     %endif
 %endif
 
@@ -187,8 +215,8 @@ 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: %{curl} >= 7.10.0
+BuildRequires: %{curl}-devel >= 7.10.0
 BuildRequires: openssl
 BuildRequires: openssl-devel
 BuildRequires: perl(ExtUtils::Embed)
@@ -202,10 +230,7 @@ Requires: /usr/sbin/usermod
 Requires: fileutils
 Requires: grep
 Requires: gnuplot
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
-Requires: curl >= 7.10.0
+Requires: %{curl} >= 7.10.0
 Requires: openssl
 Requires: xinetd
 Requires: perl >= 5.6.0
@@ -223,9 +248,6 @@ Requires: grep
 %{?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 >= %{tarver}
 Requires: readline
@@ -242,9 +264,6 @@ Group: %{rpm_group}
 Requires: /bin/awk
 Requires: fileutils
 Requires: grep
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
 %{?requires_libtermcap}
 %{?requires_initscripts}
 Requires: xinetd
@@ -348,9 +367,14 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 # 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.
+# LDFLAGS macro is defined except on rhel3.
+# --enable-as-needed must be conditional until configure tests whether
+# ld can accept --as-needed.
 ./configure \
         %{?PKG_CONFIG_PATH: PKG_CONFIG_PATH=%PKG_CONFIG_PATH} \
         CFLAGS="%{optflags} -g -pipe" CXXFLAGS="%{optflags}" \
+        %{?LDFLAGS:LDFLAGS="${LDFLAGS} %{?LDFLAGS:%LDFLAGS}"} \
+       %{?enable_as_needed:%{enable_as_needed}} \
         --quiet \
         --prefix=%{PREFIX} \
         --sysconfdir=%{SYSCONFDIR} \
@@ -432,7 +456,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/bash %{amanda_user}
         if [ %{dist} = "SuSE" ]; then
                 PASSWD_EXIT=$?
         else
@@ -485,7 +509,7 @@ else
         echo "`date +'%b %e %Y %T'`:  please see that the following parameters are set for that" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  user.:" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
-        echo "`date +'%b %e %Y %T'`:  SHELL:          /bin/sh" >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`:  SHELL:          /bin/bash" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  HOME:           %{AMANDAHOMEDIR}" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  Default group:  %{amanda_group}" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  Verifying %{amanda_user} parameters :" >>${TMPFILE}
@@ -499,10 +523,10 @@ else
                 echo "`date +'%b %e %Y %T'`:  Verified group name of user 'amandabackup'" >>${TMPFILE}
         fi
 
-        if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then
+        if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/bash" ] ; then
                 echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
                 echo "`date +'%b %e %Y %T'`:  !!! user 'amandabackup' default shell should be set to    !!!" >>${TMPFILE}
-                echo "`date +'%b %e %Y %T'`:  !!! /bin/sh, pl correct before start using Amanda         !!!" >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`:  !!! /bin/bash, pl correct before start using Amanda         !!!" >>${TMPFILE}
                 echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
         else
                 echo "`date +'%b %e %Y %T'`:  Verified Default shell for user 'amandabackup'" >>${TMPFILE}
@@ -797,7 +821,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/bash %{amanda_user}
         if [ %{dist} = "SuSE" ]; then
                 PASSWD_EXIT=$?
         else
@@ -850,7 +874,7 @@ else
         echo "`date +'%b %e %Y %T'`:  please see that the following parameters are set for that" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  user.:" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
-        echo "`date +'%b %e %Y %T'`:  SHELL:          /bin/sh" >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`:  SHELL:          /bin/bash" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  HOME:           %{AMANDAHOMEDIR}" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  Default group:  %{amanda_group}" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  Verifying %{amanda_user} parameters :" >>${TMPFILE}
@@ -864,10 +888,10 @@ else
                 echo "`date +'%b %e %Y %T'`:  Verified group name of user 'amandabackup'" >>${TMPFILE}
         fi
 
-        if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then
+        if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/bash" ] ; then
                 echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
                 echo "`date +'%b %e %Y %T'`:  !!! user 'amandabackup' default shell should be set to    !!!" >>${TMPFILE}
-                echo "`date +'%b %e %Y %T'`:  !!! /bin/sh, pl correct before start using Amanda         !!!" >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`:  !!! /bin/bash, pl correct before start using Amanda         !!!" >>${TMPFILE}
                 echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
         else
                 echo "`date +'%b %e %Y %T'`:  Verified Default shell for user 'amandabackup'" >>${TMPFILE}
@@ -1183,7 +1207,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/bash %{amanda_user} >>${TMPFILE} 2>&1
         if [ %{dist} = "SuSE" ]; then
                 PASSWD_EXIT=$?
         else
@@ -1236,7 +1260,7 @@ else
         echo "`date +'%b %e %Y %T'`:  please see that the following parameters are set for that" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  user.:" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
-        echo "`date +'%b %e %Y %T'`:  SHELL:          /bin/sh" >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`:  SHELL:          /bin/bash" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  HOME:           %{AMANDAHOMEDIR}" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  Default group:  %{amanda_group}" >>${TMPFILE}
         echo "`date +'%b %e %Y %T'`:  Verifying %{amanda_user} parameters :" >>${TMPFILE}
@@ -1250,10 +1274,10 @@ else
                 echo "`date +'%b %e %Y %T'`:  Verified group name of user 'amandabackup'" >>${TMPFILE}
         fi
 
-        if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then
+        if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/bash" ] ; then
                 echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
                 echo "`date +'%b %e %Y %T'`:  !!! user 'amandabackup' default shell should be set to    !!!" >>${TMPFILE}
-                echo "`date +'%b %e %Y %T'`:  !!! /bin/sh, pl correct before start using Amanda         !!!" >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`:  !!! /bin/bash, pl correct before start using Amanda         !!!" >>${TMPFILE}
                 echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
         else
                 echo "`date +'%b %e %Y %T'`:  Verified Default shell for user 'amandabackup'" >>${TMPFILE}
@@ -1573,6 +1597,7 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{AMLIBEXECDIR}/dumper
 %{AMLIBEXECDIR}/planner
 %{SBINDIR}/amcheck
+%{SBINDIR}/amservice
 %defattr(0750,%{amanda_user},%{amanda_group},0750)
 %{LOGDIR}
 %{SYSCONFDIR}/amanda