Search
j0ke.net Open Build Service
>
Projects
>
home:jg
:
backup
>
amanda-enterprise
> amanda_enterprise.spec
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File amanda_enterprise.spec of Package amanda-enterprise (Revision 6)
Currently displaying revision
6
,
show latest
#!BuildIgnore: post-build-checks brp-check-suse AutoReqProv: on Name: amanda_enterprise Version: 2.6.3 Release: 3 Summary: Network Disk Archiver Group: Applications/Archiving License: GPL Source0: %{name}-%{version}.tar.bz2 Source1: %{name}-%{version}-rpmlintrc Group: Applications/Archiving BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot BuildRequires: mailx autoconf flex dump readline-devel curl glib2-devel star Requires: star Requires: dump Requires: mailx Requires: fileutils Requires: gnuplot Requires: curl >= 7.10.0 Requires: xinetd Requires: perl Requires: tar %if 0%{?centos_version} Requires: initscripts %endif Provides: amanda_enterprise-backup_client, amanda_enterprise-backup_server Obsoletes: amanda, amanda-server, amanda-client %description Amanda Enterprise Backup %define build_srpm 0 %{?srpm_only: %define build_srpm 1} %define packer %(%{__id_u} -n) %{!?amanda_version: %define amanda_version 2.6.3} %{!?amanda_release: %define amanda_release 1} %define amanda_version_info "Amanda Enterprise Edition - version %{amanda_version}" %define amanda_user amandabackup %define amanda_group disk %define udpportrange "700,790" %define tcpportrange "11000,11100" %define low_tcpportrange "700,740" %if 0%{?suse_version} %define dist SuSE %define disttag suse %endif %package backup_client Summary: The Amanda Backup and Archiving Client - Amanda Enterprise Edition Group: Applications/Archiving Requires: fileutils %if 0%{?centos_version} Requires: initscripts %endif Requires: xinetd Requires: perl Requires: tar Obsoletes: amanda-backup_client Provides: amanda-backup_client = %{version} Conflicts: amanda_enterprise-backup_server %description backup_client This package contains the Amanda enterprise client. The amanda_enterprise-backup_client package needs to be installed on every system that is being backed up. %package backup_server Summary: The Amanda Backup and Archiving Server - Amanda Enterprise Edition Group: Applications/Archiving %if 0%{?centos_version} Requires: initscripts %endif Requires: xinetd Requires: perl Requires: tar Obsoletes: amanda-backup_server Provides: amanda-backup_server = %{version} %description backup_server This package contains the Amanda enterprise server. The amanda_enterprise-backup_server package should be installed on the Amanda server, i.e. the machine attached to backup media (such as a tape drive or disk drives) where backups will be written. The amanda_enterprise-backup_server package includes Amanda enterprise client. # --- Directory setup --- # Configure directories: %define PREFIX /usr %define EPREFIX %{PREFIX} %define BINDIR %{EPREFIX}/bin %define SBINDIR %{EPREFIX}/sbin %define LIBEXECDIR %{EPREFIX}/libexec %define DATADIR %{PREFIX}/share %define SYSCONFDIR /etc %define LOCALSTATEDIR /var %define AMANDAHOMEDIR /var/lib/amanda # %ifarch x86_64 %define LIBDIR %{EPREFIX}/lib64 %else %define LIBDIR %{EPREFIX}/lib %endif %define INCLUDEDIR %{PREFIX}/include %define INFODIR %{PREFIX}/info %define MANDIR %{DATADIR}/man %define LOGDIR /var/log/amanda # Installation directories: %define ROOT_SBINDIR %{buildroot}/%{SBINDIR} %define ROOT_LIBEXECDIR %{buildroot}/%{LIBEXECDIR} %define ROOT_LIBDIR %{buildroot}/%{LIBDIR} %define ROOT_DATADIR %{buildroot}/%{DATADIR} %define ROOT_SYSCONFDIR %{buildroot}/%{SYSCONFDIR} %define ROOT_AMANDAHOMEDIR %{buildroot}/%{AMANDAHOMEDIR} %define ROOT_INFODIR %{buildroot}/%{INFODIR} %define ROOT_MANDIR %{buildroot}/%{MANDIR} %define ROOT_LOGDIR %{buildroot}/%{LOGDIR} # --- Unpack and apply patches (if any) --- %prep %setup # --- Configure and compile --- %build %define config_user %{amanda_user} %define config_group %{amanda_group} %if 0%{?suse_version} >= 1030 %ifarch x86_64 %define build_host x86_64-unknown-linux CFLAGS="" CXXFLAGS="" \ %else %define build_host i386-unknown-linux CFLAGS="" CXXFLAGS="" \ %endif %else %ifarch x86_64 %define build_host x86_64-unknown-linux CFLAGS="%{optflags} -m64 -g" CXXFLAGS="%{optflags} -m64" \ %else %define build_host i386-unknown-linux CFLAGS="%{optflags} -m32 -g" CXXFLAGS="%{optflags} -m32" \ %endif %endif ./configure \ --build=%{build_host} \ --prefix=%{PREFIX} \ --bindir=%{BINDIR} \ --sbindir=%{SBINDIR} \ --datadir=%{DATADIR} \ --libdir=%{LIBDIR} \ --sysconfdir=%{SYSCONFDIR} \ --sharedstatedir=%{LOCALSTATEDIR} \ --localstatedir=%{LOCALSTATEDIR} \ --includedir=%{INCLUDEDIR} \ --infodir=%{INFODIR} \ --mandir=%{MANDIR} \ --with-star=/usr/bin/star \ --with-dump=/sbin/dump \ --with-gnuplot=/usr/bin/gnuplot \ --with-gnutar=/bin/tar \ --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \ --with-dumperdir=%{LIBEXECDIR} \ --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 \ --with-buffered-dump \ --without-ipv6 \ --disable-devpay \ --disable-installperms %{__make} # --- Install to buildroot --- %install mkdir -p %{buildroot}/{etc,var/log} mkdir -p %{ROOT_SYSCONFDIR}/amanda mkdir -p %{ROOT_AMANDAHOMEDIR}/gnutar-lists mkdir -p %{ROOT_LOGDIR} make DESTDIR=%{buildroot} install rm -rf %{ROOT_DATADIR}/amanda_enterprise # rm -f %{ROOT_AMANDAHOMEDIR}/example/inetd.conf.amandaclient echo "%{amanda_version_info}" >%{ROOT_AMANDAHOMEDIR}/amanda-release # --- Clean up buildroot --- %clean if [ "%{buildroot}" != "/" ]; then if [ -d "%{buildroot}" ] ; then rm -rf %{buildroot} fi else echo "BuildRoot was somehow set to / !" exit -1 fi # --- Pre/post (un)installation scripts --- %pre TMPFILE=`mktemp /tmp/rpm-amanda_enterprise.XXXXXXXXXXX` if [ $? -ne 0 ]; then echo "Unable to mktemp!" 1>&2 exit 1 fi LOGDIR="%{LOGDIR}" INSTALL_LOG="${LOGDIR}/install.log" INSTALL_ERR="${LOGDIR}/install.err" echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE} # 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" -g disk -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} if [ %{dist} = "SuSE" ]; then PASSWD_EXIT=$? else # Lock the amanda account until admin sets password passwd -l %{amanda_user} >>/dev/null PASSWD_EXIT=$? fi if [ ${PASSWD_EXIT} -eq 0 ] ; then echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE} echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} PASSWD_OK=0 else echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} PASSWD_OK=1 fi else # log information about 'amanda' user parameters echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE} 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'`: 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} if [ "`id -gn %{amanda_user}`" != "disk" ] ; then echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected 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 group name of user 'amandabackup'" >>${TMPFILE} fi if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; 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'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} else echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE} fi if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before 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 home directory for user amandabackup" >>${TMPFILE} fi echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} PASSWD_OK=0 fi if [ -d %{AMANDAHOMEDIR} ] ; then echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE} if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \ [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then echo "correct." >>${TMPFILE} VARLIB_OK=0 else echo "incorrect!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE} VARLIB_OK=1 fi elif VARLIB_OK=0 fi echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} if [ ! -e ${LOGDIR} ] ; then # create log directory mkdir -p -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 elif [ ! -d ${LOGDIR} ] ; then mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 mkdir -p -m 0750 ${LOGDIR} >>${TMPFILE} 2> chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1 fi if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2 echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." exit 1 else cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: === Amanda Enterprise Edition installation started. ===" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -f "${TMPFILE}" ]; then rm -f "${TMPFILE}" fi %post TMPFILE=`mktemp /tmp/rpm-amanda_enterprise.XXXXXXXXXXX` if [ $? -ne 0 ]; then echo "Unable to mktemp!" 1>&2 exit 1 fi LOGDIR="%{LOGDIR}" INSTALL_LOG="${LOGDIR}/install.log" INSTALL_ERR="${LOGDIR}/install.err" echo -n "`date +'%b %e %Y %T'`: Updating library cache..." >${TMPFILE} /sbin/ldconfig >>${TMPFILE} 2>&1 echo "done." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then if [ ! -f /etc/xinetd.d/amandaserver ] ; then cp %{AMANDAHOMEDIR}/example/xinetd.amandaserver /etc/xinetd.d/amandaserver chmod 0644 /etc/xinetd.d/amandaserver >>${TMPFILE} 2>&1 if [ -f /etc/xinetd.d/amandaclient ] ; then rm /etc/xinetd.d/amandaclient fi echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE} if [ "%{xinetd_reload}" == "reload" ] ; then /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -ne 0 ] ; then echo -n "reload failed. Attempting restart..." >>${TMPFILE} /etc/init.d/xinetd restart >>${TMPFILE} 2>&1 ret_val=$? fi else /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 ret_val=$? fi if [ ${ret_val} -eq 0 ] ; then echo "success." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "failed. Please check your system logs." >>${TMPFILE} cat ${TMPFILE} 1>&2 cat ${TMPFILE} >>${INSTALL_ERR} fi fi fi echo "`date +'%b %e %Y %T'`: Installing '%{SYSCONFDIR}/amandates'." >${TMPFILE} ret_val=0 if [ ! -f %{SYSCONFDIR}/amandates ] ; then touch %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: The file '%{SYSCONFDIR}/amandates' has been created." >>${TMPFILE} fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/amandates'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 chmod 0640 %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 if [ -x /sbin/restorecon ] ; then /sbin/restorecon %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: '%{SYSCONFDIR}/amandates' Installation successful." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "`date +'%b %e %Y %T'`: '%{SYSCONFDIR}/amandates' Installation failed." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} fi # Install .gnupg directory echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE} ret_val=0 if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE} mkdir -p %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE} else echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE} fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} fi # Install .amandahosts to server echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE} if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 fi for host in localhost localhost.localdomain ; do if [ -z "`grep \"^${host}[[:blank:]]\+root[[:blank:]]\+amindexd[[:blank:]]\+amidxtaped\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then echo "${host} root amindexd amidxtaped" >>%{AMANDAHOMEDIR}/.amandahosts fi if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts fi done chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # SSH RSA key generation for amdump KEYDIR="%{AMANDAHOMEDIR}/.ssh" KEYFILE="id_rsa_amdump" COMMENT="%{amanda_user}@server" if [ ! -d ${KEYDIR} ] ; then if [ -f ${KEYDIR} ] ; then echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} mv ${KEYDIR} ${KEYDIR}.rpmsave cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} mkdir -p ${KEYDIR} >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} ${KEYDIR} ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # SSH RSA key generation on client for amrecover KEYDIR="%{AMANDAHOMEDIR}/.ssh" KEYFILE="id_rsa_amrecover" COMMENT="root@client" if [ ! -d ${KEYDIR} ] ; then if [ -f ${KEYDIR} ] ; then echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} mkdir -p ${KEYDIR} >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Setting permissions for '${KEYDIR}'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # environment variables (~amandabackup/.profile) echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE} if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 fi if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile fi echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # echo "`date +'%b %e %Y %T'`: Creating en_ZM locale" >>${TMPFILE} # localedef -i /usr/share/i18n/locales/en_US -f ISO-8859-1 en_ZM >>${TMPFILE} 2>&1 # cat ${TMPFILE} # cat ${TMPFILE} >>${INSTALL_LOG} echo "`date +'%b %e %Y %T'`: === Amanda installation complete. ===" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -f "${TMPFILE}" ]; then rm -f "${TMPFILE}" fi echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." %postun /sbin/ldconfig %pre backup_server TMPFILE=`mktemp /tmp/rpm-amanda_enterprise.XXXXXXXXXXX` if [ $? -ne 0 ]; then echo "Unable to mktemp!" 1>&2 exit 1 fi LOGDIR="%{LOGDIR}" INSTALL_LOG="${LOGDIR}/install.log" INSTALL_ERR="${LOGDIR}/install.err" echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE} # 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" -g disk -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} if [ %{dist} = "SuSE" ]; then PASSWD_EXIT=$? else # Lock the amanda account until admin sets password passwd -l %{amanda_user} >>/dev/null PASSWD_EXIT=$? fi if [ ${PASSWD_EXIT} -eq 0 ] ; then echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE} echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} PASSWD_OK=0 else echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} PASSWD_OK=1 fi else # log information about 'amanda' user parameters echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE} 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'`: 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} if [ "`id -gn %{amanda_user}`" != "disk" ] ; then echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected 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 group name of user 'amandabackup'" >>${TMPFILE} fi if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; 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'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} else echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE} fi if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before 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 home directory for user amandabackup" >>${TMPFILE} fi echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} PASSWD_OK=0 fi if [ -d %{AMANDAHOMEDIR} ] ; then echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE} if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \ [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then echo "correct." >>${TMPFILE} VARLIB_OK=0 else echo "incorrect!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE} VARLIB_OK=1 fi else VARLIB_OK=0 fi echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} if [ ! -e ${LOGDIR} ] ; then # create log directory mkdir -p -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 elif [ ! -d ${LOGDIR} ] ; then mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 mkdir -p -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1 fi if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2 echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." exit 1 else cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: === Amanda Enterprise backup server installation started. ===" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -f "${TMPFILE}" ]; then rm -f "${TMPFILE}" fi %post backup_server TMPFILE=`mktemp /tmp/rpm-amanda_enterprise.XXXXXXXXXXX` if [ $? -ne 0 ]; then echo "Unable to mktemp!" 1>&2 exit 1 fi LOGDIR="%{LOGDIR}" INSTALL_LOG="${LOGDIR}/install.log" INSTALL_ERR="${LOGDIR}/install.err" echo -n "`date +'%b %e %Y %T'`: Updating system library cache..." >${TMPFILE} /sbin/ldconfig echo "done." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then if [ ! -f /etc/xinetd.d/amandaserver ] ; then cp %{AMANDAHOMEDIR}/example/xinetd.amandaserver /etc/xinetd.d/amandaserver chmod 0644 /etc/xinetd.d/amandaserver >>${TMPFILE} 2>&1 if [ -f /etc/xinetd.d/amandaclient ] ; then rm /etc/xinetd.d/amandaclient fi echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE} if [ "%{xinetd_reload}" == "reload" ] ; then /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -ne 0 ] ; then echo -n "reload failed. Attempting restart..." >>${TMPFILE} /etc/init.d/xinetd restart >>${TMPFILE} 2>&1 ret_val=$? fi else /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 ret_val=$? fi if [ ${ret_val} -eq 0 ] ; then echo "success." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "failed. Please check your system logs." >>${TMPFILE} cat ${TMPFILE} 1>&2 cat ${TMPFILE} >>${INSTALL_ERR} fi fi fi echo "`date +'%b %e %Y %T'`: Installing '%{SYSCONFDIR}/amandates'." >${TMPFILE} ret_val=0 if [ ! -f %{SYSCONFDIR}/amandates ] ; then touch %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: The file '%{SYSCONFDIR}/amandates' has been created." >>${TMPFILE} fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/amandates'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 chmod 0640 %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: '%{SYSCONFDIR}/amandates' Installation successful." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "`date +'%b %e %Y %T'`: '%{SYSCONFDIR}/amandates' Installation failed." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} fi # Install .amandahosts to server echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE} if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 fi for host in localhost localhost.localdomain ; do if [ -z "`grep \"^${host}[[:blank:]]\+root[[:blank:]]\+amindexd[[:blank:]]\+amidxtaped\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then echo "${host} root amindexd amidxtaped" >>%{AMANDAHOMEDIR}/.amandahosts fi if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts fi done chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # Install amanda client configuration file echo "`date +'%b %e %Y %T'`: Checking '%{SYSCONFDIR}/amanda/amanda-client.conf' file." >${TMPFILE} if [ ! -f %{SYSCONFDIR}/amanda/amanda-client.conf ] ; then cp %{AMANDAHOMEDIR}/example/amanda-client.conf %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 fi chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 chmod 0600 %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # install am_passphrase file to server echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE} 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}'` echo ${phrase} >>%{AMANDAHOMEDIR}/.am_passphrase chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1 chmod 0700 %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1 fi cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # Install .gnupg directory echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE} ret_val=0 if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE} mkdir -p %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE} else echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE} fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} fi # SSH RSA key generation on server for amdump KEYDIR="%{AMANDAHOMEDIR}/.ssh" KEYFILE="id_rsa_amdump" COMMENT="%{amanda_user}@server" if [ ! -d ${KEYDIR} ] ; then if [ -f ${KEYDIR} ] ; then echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} mkdir -p ${KEYDIR} >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} ${KEYDIR} ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # SSH RSA key generation on client for amrecover KEYDIR="%{AMANDAHOMEDIR}/.ssh" KEYFILE="id_rsa_amrecover" COMMENT="root@client" if [ ! -d ${KEYDIR} ] ; then if [ -f ${KEYDIR} ] ; then echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} mkdir -p ${KEYDIR} >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # environment variables (~amandabackup/.profile) echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE} if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 fi if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE} fi cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} echo "`date +'%b %e %Y %T'`: === Amanda Enterprise backup server installation complete. ===" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -f "${TMPFILE}" ]; then rm -f "${TMPFILE}" >>${TMPFILE} 2>&1 fi echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." %postun backup_server /sbin/ldconfig %pre backup_client TMPFILE=`mktemp /tmp/rpm-amanda_enterprise.XXXXXXXXXXX` if [ $? -ne 0 ]; then echo "Unable to mktemp!" exit 1 fi LOGDIR="%{LOGDIR}" INSTALL_LOG="${LOGDIR}/install.log" INSTALL_ERR="${LOGDIR}/install.err" echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE} # 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" -g disk -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} >>${TMPFILE} 2>&1 if [ %{dist} = "SuSE" ]; then PASSWD_EXIT=$? else # Lock the amanda account until admin sets password passwd -l %{amanda_user} >>/dev/null PASSWD_EXIT=$? fi if [ ${PASSWD_EXIT} -eq 0 ] ; then echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE} echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE} echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} PASSWD_OK=0 else echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} PASSWD_OK=1 fi else # log information about 'amanda' user parameters echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE} 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'`: 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} if [ "`id -gn %{amanda_user}`" != "disk" ] ; then echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected 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 group name of user 'amandabackup'" >>${TMPFILE} fi if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; 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'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} else echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE} fi if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before 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 home directory for user amandabackup" >>${TMPFILE} fi echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} PASSWD_OK=0 fi if [ -d %{AMANDAHOMEDIR} ] ; then echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE} if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \ [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then echo "correct." >>${TMPFILE} VARLIB_OK=0 else echo "incorrect!" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE} echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE} VARLIB_OK=1 fi else VARLIB_OK=0 fi echo "`date +'%b %e %Y %T'`:" >>${TMPFILE} if [ ! -e ${LOGDIR} ] ; then # create log directory mkdir -p -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 elif [ ! -d ${LOGDIR} ] ; then mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 mkdir -p -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1 fi if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2 echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." exit 1 else cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: === Amanda Enterprise backup client installation started. ===" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -f "${TMPFILE}" ]; then rm -f "${TMPFILE}" fi %post backup_client TMPFILE=`mktemp /tmp/rpm-amanda_enterprise.XXXXXXXXXXX` if [ $? -ne 0 ]; then echo "Unable to mktemp!" 1>&2 exit 1 fi LOGDIR="%{LOGDIR}" INSTALL_LOG="${LOGDIR}/install.log" INSTALL_ERR="${LOGDIR}/install.err" echo -n "`date +'%b %e %Y %T'`: Updating system library cache..." >${TMPFILE} /sbin/ldconfig echo "done." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then if [ ! -f /etc/xinetd.d/amandaclient ] ; then cp %{AMANDAHOMEDIR}/example/xinetd.amandaclient /etc/xinetd.d/amandaclient echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE} if [ "%{xinetd_reload}" == "reload" ] ; then /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -ne 0 ] ; then echo -n "reload failed. Attempting restart..." >>${TMPFILE} /etc/init.d/xinetd restart >>${TMPFILE} 2>&1 ret_val=$? fi else /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1 ret_val=$? fi if [ ${ret_val} -eq 0 ] ; then echo "success." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "failed. Please check your system logs." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi fi fi echo "`date +'%b %e %Y %T'`: Installing '%{SYSCONFDIR}/amandates'." >${TMPFILE} ret_val=0 if [ ! -f %{SYSCONFDIR}/amandates ] ; then touch %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: The file '%{SYSCONFDIR}/amandates' has been created." >>${TMPFILE} fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/amandates'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 chmod 0640 %{SYSCONFDIR}/amandates >>${TMPFILE} 2>&1 fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: '%{SYSCONFDIR}/amandates' Installation successful." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "`date +'%b %e %Y %T'`: '%{SYSCONFDIR}/amandates' Installation failed." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} fi # Install .amandahosts to client echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE} if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 fi for host in localhost localhost.localdomain ; do if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts fi done chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} ### amdump touch %{SYSCONFDIR}/dumpdates chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/dumpdates # Install amanda client configuration file echo "`date +'%b %e %Y %T'`: Checking '%{SYSCONFDIR}/amanda/amanda-client.conf' file." >${TMPFILE} if [ ! -f %{SYSCONFDIR}/amanda/amanda-client.conf ] ; then cp %{AMANDAHOMEDIR}/example/amanda-client.conf %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 fi chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 chmod 0600 %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # Install .gnupg directory echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE} ret_val=0 if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE} mkdir -p %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE} else echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE} fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? if [ ${ret_val} -eq 0 ]; then chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1 ret_val=$? fi fi if [ ${ret_val} -eq 0 ]; then echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} else echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_ERR} fi # SSH RSA key generation on client for amrecover KEYDIR="%{AMANDAHOMEDIR}/.ssh" KEYFILE="id_rsa_amrecover" COMMENT="root@client" if [ ! -d ${KEYDIR} ] ; then if [ -f ${KEYDIR} ] ; then echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE} mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE} mkdir -p ${KEYDIR} >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE} ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} fi echo "`date +'%b %e %Y %T'`: Setting permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1 chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} # environment variables (~amandabackup/.profile) echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE} if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 fi if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile fi cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >${TMPFILE} chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} echo "`date +'%b %e %Y %T'`: Creating en_ZM locale" >>${TMPFILE} localedef -i /usr/share/i18n/locales/en_US -f ISO-8859-1 en_ZM >>${TMPFILE} 2>&1 cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} echo "`date +'%b %e %Y %T'`: === Amanda Enterprise backup client installation complete. ===" >${TMPFILE} cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG} if [ -f "${TMPFILE}" ]; then rm -f "${TMPFILE}" fi echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'." %postun backup_client /sbin/ldconfig # --- Files to install --- %files backup_client %defattr(0755,%{amanda_user},%{amanda_group}) %dir %{SYSCONFDIR}/amanda %dir %{AMANDAHOMEDIR} %dir %{AMANDAHOMEDIR}/gnutar-lists %dir %{LIBEXECDIR} %{LIBDIR}/libamanda* %{LIBDIR}/libamclient* %{LIBEXECDIR}/amandad %{LIBEXECDIR}/generic-dumper %{LIBEXECDIR}/amgtar %{LIBEXECDIR}/noop %{LIBEXECDIR}/patch-system %{LIBEXECDIR}/selfcheck %{LIBEXECDIR}/sendbackup %{LIBEXECDIR}/sendsize %{LIBEXECDIR}/amstar %{LIBEXECDIR}/versionsuffix %{SBINDIR}/amplot %defattr(4750,root,disk) %{LIBEXECDIR}/calcsize %{LIBEXECDIR}/killpgrp %{LIBEXECDIR}/rundump %{LIBEXECDIR}/runstar %{LIBEXECDIR}/runtar %{LIBEXECDIR}/amanda-sh-lib.sh %defattr(0750,%{amanda_user},%{amanda_group}) %dir %{LOGDIR} %{SBINDIR}/amaespipe %{SBINDIR}/amcryp* %{SBINDIR}/amgpgcrypt %{SBINDIR}/amoldrecover %{SBINDIR}/amrecover %defattr(0644,%{amanda_user},%{amanda_group}) %docdir %{MANDIR} %{MANDIR}/man5/amanda.conf.5.gz %{MANDIR}/man5/amanda-client.conf.5.gz %{MANDIR}/man8/amanda.8.gz %{MANDIR}/man8/amplot.8.gz %{MANDIR}/man8/amrecover.8.gz %{LIBEXECDIR}/amcat.awk %{LIBEXECDIR}/amplot* %defattr(0640,%{amanda_user},%{amanda_group}) %{AMANDAHOMEDIR}/amanda-release %{LOCALSTATEDIR}/lib/amanda/example/xinetd.amandaclient %{LOCALSTATEDIR}/lib/amanda/example/amanda-client.conf %{LOCALSTATEDIR}/lib/amanda/example/inetd.conf.amandaclient %{LOCALSTATEDIR}/lib/amanda/example/amanda.conf %files backup_server %defattr(0755,%{amanda_user},%{amanda_group}) %dir %{SYSCONFDIR}/amanda %dir %{LIBEXECDIR} %dir %{AMANDAHOMEDIR} %dir %{AMANDAHOMEDIR}/gnutar-lists %{LIBDIR}/libamanda* %{LIBDIR}/libamdevice* %{LIBDIR}/libamclient* %{LIBDIR}/libamserver* %{LIBDIR}/libamtape* %{LIBDIR}/librestore* %{LIBEXECDIR}/amandad %{LIBEXECDIR}/amcleanupdisk %{LIBEXECDIR}/amidxtaped %{LIBEXECDIR}/amindexd %{LIBEXECDIR}/amlogroll %{LIBEXECDIR}/amtrmidx %{LIBEXECDIR}/amtrmlog %{LIBEXECDIR}/chg-lib.sh %{LIBEXECDIR}/chg-chio %{LIBEXECDIR}/chg-chs %{LIBEXECDIR}/chg-disk %{LIBEXECDIR}/chg-iomega %{LIBEXECDIR}/chg-juke %{LIBEXECDIR}/chg-manual %{LIBEXECDIR}/chg-mcutil %{LIBEXECDIR}/chg-mtx %{LIBEXECDIR}/chg-multi %{LIBEXECDIR}/chg-null %{LIBEXECDIR}/chg-rait %{LIBEXECDIR}/chg-rth %{LIBEXECDIR}/chg-scsi %{LIBEXECDIR}/chg-zd-mtx %{LIBEXECDIR}/chunker %{LIBEXECDIR}/driver %{LIBEXECDIR}/generic-dumper %{LIBEXECDIR}/amgtar %{LIBEXECDIR}/noop %{LIBEXECDIR}/patch-system %{LIBEXECDIR}/selfcheck %{LIBEXECDIR}/sendbackup %{LIBEXECDIR}/sendsize %{LIBEXECDIR}/amstar %{LIBEXECDIR}/taper %{LIBEXECDIR}/versionsuffix %{LIBEXECDIR}/amanda-sh-lib.sh %{SBINDIR}/amaddclient %{SBINDIR}/amadmin %{SBINDIR}/amcheckdb %{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 %{SBINDIR}/zm-support-client #%{SBINDIR}/activate-devpay %defattr(4750,root,disk) %{LIBEXECDIR}/calcsize %{LIBEXECDIR}/killpgrp %{LIBEXECDIR}/rundump %{LIBEXECDIR}/runstar %{LIBEXECDIR}/runtar %{LIBEXECDIR}/dumper %{LIBEXECDIR}/planner %{SBINDIR}/amcheck %defattr(0750,%{amanda_user},%{amanda_group}) %dir %{LOGDIR} %{SBINDIR}/amaespipe %{SBINDIR}/amcrypt %{SBINDIR}/amcrypt-ossl %{SBINDIR}/amcrypt-ossl-asym %{SBINDIR}/amcryptsimple %{SBINDIR}/amgpgcrypt %{SBINDIR}/amoldrecover %{SBINDIR}/amrecover %defattr(0644,%{amanda_user},%{amanda_group}) %{LIBEXECDIR}/amcat.awk %{LIBEXECDIR}/amplot.awk %{LIBEXECDIR}/amplot.g %{LIBEXECDIR}/amplot.gp %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/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 %{LOCALSTATEDIR}/lib/amanda/template.d/* %defattr(0640,%{amanda_user},%{amanda_group}) %{AMANDAHOMEDIR}/amanda-release %defattr(0644,%{amanda_user},%{amanda_group}) %{LOCALSTATEDIR}/lib/amanda/example/xinetd.amandaserver %{LOCALSTATEDIR}/lib/amanda/example/label-templates/*.ps %{LOCALSTATEDIR}/lib/amanda/example/*/*/* # --- ChangeLog %changelog * Sat Jan 10 2009 Carsten Schoene <cs@linux-administrator.com> - 2.6.3-3 - fix openSUSE 11.1 build * Thu Apr 1 2008 Juergen Gotteswinter <jg@internetx.de> - extended portrange - buildreqs cleanup - autoreqprov on - specfile cleanup started * Mon Mar 17 2008 Juergen Gotteswinter <jg@internetx.de> - added configure params for dump - added requirements for dump * Mon Mar 10 2008 Juergen Gotteswinter <jg@internetx.de> - fixed typo in prescript * Fri Feb 15 2008 Carsten Schoene <cs@linux-administrator.com> - optimized mkdir calls (added option -p) - changes to filelist - fixed some typos / if constructs - added mailx to (Build)Requiers - added CFLAGS, CXXFLAGS workaround for openSUSE 10.3 builds * Mon Nov 12 2007 Dan Locks <dwlocks at zmanda dot com> - Revert change from bugID 3255 (pkg_config_path) * Mon Nov 12 2007 Dan Locks <dwlocks at zmanda dot com> - Removed librestore from client package. * Thu Nov 8 2007 Dan Locks <dwlocks at zmanda dot com> - Fixed Suse variant distribution detection. Thanks to Paddy for the hint. * Wed Nov 7 2007 Dan Locks <dwlocks at zmanda dot com> - Changed libcurl requirement from 7.12.1 to 7.10.0 * Mon Nov 5 2007 Dan Locks <dwlocks at zmanda dot com> - Collapsed more files into wildcard globs instead of including more files. * Mon Nov 5 2007 Dan Locks <dwlocks at zmanda dot com> - Moved amdevcheck from %{_LIBEXECDIR} to %{_SBINDIR} - Collapsed many files listed individually into wilcard globs * Mon Nov 5 2007 Dan Locks <dwlocks At zmanda dot com> - Added new --disable-installperms switch to configure options. * Fri Nov 2 2007 Dan Locks <dwlocks at zmanda dot com> - Fixed date format for previous entry. sheesh. * Thu Nov 1 2007 Dan Locks <dwlocks at zmanda dot com> - Added linux distribution detection routines - Simplified some shell macros - Collapsed identical conditionals with || - Modified formatting for readability * Fri Oct 3 2007 Paddy Sreenivasan <paddy at zmanda dot com> - Added S3 with DevPay * Fri Sep 21 2007 Paddy Sreenivasan <paddy at zmanda dot com> - Remove libamserver, libamtape and libamdevice from client rpm * Wed Sep 19 2007 Paddy Sreenivasan <paddy at zmanda dot com> - Added Fedora 7 and updated version number to 2.6.3 * Wed Mar 14 2007 Kevin Till <ktill at zmanda dot com> - - use md5sum so that this script has no dependency on sha1.pm * Fri Feb 9 2007 Kevin Till <ktill at zmanda dot com> - - install amandaserver 644 * Tue Jan 23 2007 Kevin Till <ktill at zmanda dot com> - - take away en_ZM locale stuff * Mon Jan 22 2007 Kevin Till <ktill at zmanda dot com> - remove /etc/xinetd.d/amandaclient if /etc/xinetd.d/amandaserver is installed. * Fri Jan 12 2007 Paddy Sreenivasan <paddy at zmanda dot com> - Added label templates * Fri Jan 05 2007 Kevin Till <ktill at zmanda dot com> - call localedef to create en_ZM * Thu Dec 07 2006 Paddy Sreenivasan <paddy at zmanda dot com> - Changes for 2.6 release. Application API changes * Mon Oct 02 2006 Kevin Till <ktill at zmanda dot com> - .ssh directory should be owned by amandabackup. - id_rsa_amrecover is used by root, so should be owned by root. - id_rsa_amdump is used by amandabackup, so should be owned by amandabackup. * Fri Jun 16 2006 Kevin Till <ktill at zmanda dot com> - make install will install necessary example files. No need to "cp" * Thu Jun 15 2006 Chris Lee <cmlee at zmanda dot com> - When reloading xinetd configuration, if reload fails then fall back to - restart. * Wed Jun 14 2006 Kevin Till <ktill at zmanda dot com> - Add amanda-client.conf to backup_server package. * Sun Jun 11 2006 Paddy Sreenivasan <paddy at zmanda dot com> - Remove xinetdclient and xinetdserver from installed files. * Fri Jun 09 2006 Kevin Till <ktill at zmanda dot com> - xinetd.amandaserver now contains client as well as server definition. - For backup_server install, just install xinetd.amandaserver. - xinetd.amandaserver and xinetd.amandaclient have the same service id name. * Wed Jun 07 2006 Chris Lee <cmlee at zmanda dot com> - - xinetd configuration is now conditional again. If an AEE xinetd - config exists the new is installed with the '.new' extension. * Thu Jun 02 2006 Kevin Till <ktill at zmanda dot com> - - not to copy template files now make install will install them. * Thu Jun 01 2006 Kevin Till <ktill at zmanda dot com> - - Added amcrypt-ossl, amcrypt-ossl-asym by Ben Slusky. - Changed low_tcpportrange to 700,710 * Thu May 18 2006 Paddy Sreenivasan <paddy at zmanda dot com> - - Added SLES10, RHEL3 build options. * Tue May 09 2006 Chris Lee <cmlee at zmanda dot com> - - Added amanda-release file to amandabackup home directory. - Installation message logging cleanup. - Changed xinetd restart to reload where appropriate. * Fri May 05 2006 Chris Lee <cmlee at zmanda dot com> - - Added libamandad libraries to files lists. * Tue May 02 2006 Chris Lee <cmlee at zmanda dot com> - - Added version message to pre-install scripts. - Changed pre-install scripts' check for xinetd files to not invoke - another instance of RPM. * Fri Apr 28 2006 Paddy Sreenivasan <paddy at zmanda dot com> - - Fixed a shell script bug. * Thu Apr 20 2006 Chris Lee <cmlee at zmanda dot com> - - Corrected inadequate regexp in the xinetd service detection loop. * Wed Apr 19 2006 Chris Lee <cmlee at zmanda dot com> - - Revised search list for xinetd services in pre-install scripts. - Added informative message to note the location of pre- and post- - install script logs files. * Tue Apr 18 2006 Chris Lee <cmlee at zmanda dot com> - - Changed xinetd configuration detection and installation. * Mon Apr 17 2006 Chris Lee <cmlee at zmanda dot com> - - Reworked installation message logging and reporting. * Mon Apr 17 2006 Paddy Sreenivasan <paddy at zmanda at com> - - Fixed permissions for id_rsa files. * Fri Apr 14 2006 Kevin Till <ktill at zmanda dot com> - - remove template.d/amanda.conf, add template.d/README * Fri Apr 14 2006 Chris Lee <cmlee at zmanda dot com> - - Changed behavior for creating required localhost entries in the - amandahosts file to check for these entries even when the file - already exists. - Added README to template configs directory. * Thu Apr 13 2006 Chris Lee <cmlee at zmanda dot com> - - Added example amanda.conf and corrected rpmbuild failure due to a - missing mkdir. * Wed Apr 12 2006 Chris Lee <cmlee at zmanda dot com> - - Removed pre-install check for "disk" group. This group should exist - by default on almost all modern distributions. * Tue Apr 11 2006 Chris Lee <cmlee at zmanda dot com> - - Added amandahosts entry for "localhost" without domain. - Added selinux example configuration. * Fri Apr 07 2006 Chris Lee <cmlee at zmanda dot com> - - Changed default entries in .amandahosts to use "localdomain" instead - of "localnet". * Wed Apr 05 2006 Kevin Till <ktill at zmanda dot com> - - Added amcryptsimple.8 and amcryptsimple * Tue Apr 04 2006 Chris Lee <cmlee at zmanda dot com> - - Added amcryptsimple.8.gz to files. * Mon Apr 03 2006 Chris Lee <cmlee at zmanda dot com> - - Added configure options to specify gnutar and star paths. - Changed template configuration directory to '/var/lib/amanda/template.d'. * Tue Mar 28 2006 Chris Lee <cmlee at zmanda dot com> - - Added template configuration files and configuration automation scripts. * Thu Mar 16 2006 Chris Lee <cmlee at zmanda dot com> - - Corrected an issue with pre-install scripts wrt bug #218. - Corrected an issue with post-install scripts and added testing .profile - in amandabackup's home directory for setting environment variables wrt - bug #220. * Mon Mar 13 2006 Chris Lee <cmlee at zmanda dot com> - - Corrected a syntactical error with setting ownership of amandates file - wrt bug #216. * Wed Mar 08 2006 Chris Lee <cmlee at zmanda dot com> - - Corrected duplicate file list entries warnings with xinetd - files when building rpms. - Added pre-install scripts to verify proper ownership of - amandabackup home directory. - Added post-install scripts to create a new ssh rsa key file - when one does not already exist. * Tue Feb 07 2006 Kevin Till <ktill at zmanda dot com> - - add amgpgcrypt and amgpgcrypt.8 * Thu Feb 2 2006 Paddy Sreenivasan <paddy at zmanda dot com> - - Require xinetd. Require termcap and initscripts for Fedora and Redhat. * Tue Jan 31 2006 Kevin Till <ktill at zmanda dot com> - - add --with-ssh-security configure flag * Mon Jan 09 2006 Chris Lee <cmlee at zmanda dot com> - - Pre/post install scripts updated: - o We now install xinetd config if xinetd is installed on the - system. - o Resolved an issue where an empty amandates file was installed - even if the file already existed on the system. - o If .amandahosts does not exist a default is now created. - The Amanda user account has been changed to 'amandabackup' for - additional security. * Tue Jan 03 2006 Paddy Sreenivasan <paddy at zmanda dot com> - - Removed amandates from files list. * Thu Dec 29 2005 Chris Lee <cmlee at zmanda dot com> - - Corrected dependency for awk to "/bin/awk". * Thu Dec 29 2005 Kevin Till <ktill at zmanda dot com> - - add man pages for amcrypt and amaespipe * Thu Dec 29 2005 Chris Lee <cmlee at zmanda dot com> - - Updated dependancy info to depend on tar >= 1.15. - Included dependancies from top-level package in backup_client and - backup_server packages. - Reorganized files lists for readability (alphabetically). - Updated backup_client files list to include some missing files per - bug #129. - Updated pre- and post-install to handle potential issue when - /var/log/amanda exists and is a file rather than a directory. - Corrected permissions for /var/log/amanda in pre-install scripts - per bug #78 and 13 December change. * Thu Dec 22 2005 Paddy Sreenivasan <paddy at zmanda dot com> - - Added amaespipe and amcrypt - Added sles9 build definitions * Tue Dec 13 2005 Chris Lee <cmlee at zmanda dot com> - - Changed permissions for /var/log/amanda, removing set group id bit. - Added /etc/amandates to backup_client package. * Thu Dec 08 2005 Chris Lee <cmlee at zmanda dot com> - - Corrected an issue with detection of existing 'amanda' user account. - Corrected ownership of setuid executables per Bug #66. - Moved the gnutar and noop files to the backup_client package (where - they sould be). - Removed amqde from files list. - Added logging features to pre- and post-install scripts. * Wed Dec 07 2005 Chris Lee <cmlee at zmanda dot com> - - Changed a number of directory and file permissions from amanda:root - to amanda:disk in response to Bug #57. * Fri Dec 02 2005 Chris Lee <cmlee at zmanda dot com> - - Corrected SYSCONFDIR path definition. Closes Bug #58. * Mon Nov 28 2005 Chris Lee <cmlee at zmanda dot com> - - Really fixed user creation preinstall scripts. * Wed Nov 23 2005 Paddy Sreenivasan <paddy at zmanda dot com> - - Updated package description. - Changed Group for packages. * Tue Nov 22 2005 Chris Lee <cmlee at zmanda dot com> - - Corrected dependancy packaging issue with amanda libraries. - Fixed creation of amanda user on systems which it does not exist. - Corrected Group definition for SuSE. - Updated descriptions to include amanda-libs package. - Updated release number to 2. * Tue Nov 08 2005 Chris Lee <cmlee at zmanda dot com> - - Permissions changes: now using user=amanda, group=disk * Sun Oct 30 2005 Chris Lee <cmlee at zmanda dot com> - - Parameters to configure options --with-user and --with-group changed - such that when test_build is set to '1' the username of the user who - runs rpmbuild is used for both values. If test_build is set to '0' - then root is used for both values. - The release field was also changed to automatically reflect the - distribution and distribution release version for which the RPM was - built. * Tue Oct 18 2005 Chris Lee <cmlee at zmanda dot com> - - Initial RPM SPEC file created.