📄 amanda.spec
字号:
%else%define LIBDIR %{EPREFIX}/lib%endif%define AMLIBDIR %{LIBDIR}/amanda%define INCLUDEDIR %{PREFIX}/include%define MANDIR %{DATADIR}/man%define LOGDIR /var/log/amanda%define PERLSITELIB %(eval "`perl -V:installsitelib`"; echo $installsitelib)# Installation directories:%define ROOT_SBINDIR %{buildroot}/%{SBINDIR}%define ROOT_LIBEXECDIR %{buildroot}/%{LIBEXECDIR}%define ROOT_DATADIR %{buildroot}/%{DATADIR}%define ROOT_LOCALSTATEDIR %{buildroot}/%{LOCALSTATEDIR}%define ROOT_SYSCONFDIR %{buildroot}/%{SYSCONFDIR}%define ROOT_AMANDAHOMEDIR %{buildroot}/%{AMANDAHOMEDIR}%define ROOT_LIBDIR %{buildroot}/%{LIBDIR}%define ROOT_MANDIR %{buildroot}/%{MANDIR}%define ROOT_LOGDIR %{buildroot}/%{LOGDIR}# --- Unpack ---%prep%setup -q# --- Configure and compile ---%build%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../configure \ %{?PKG_CONFIG_PATH: PKG_CONFIG_PATH=%PKG_CONFIG_PATH} \ CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \ --quiet \ --prefix=%{PREFIX} \ --sysconfdir=%{SYSCONFDIR} \ --sharedstatedir=%{LOCALSTATEDIR} \ --localstatedir=%{LOCALSTATEDIR} \ --libdir=%{LIBDIR} \ --includedir=%{INCLUDEDIR} \ --with-star=/usr/bin/star \ --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%endifmake# --- Install to buildroot ---%installif [ "%{buildroot}" != "/" ]; then if [ -d "%{buildroot}" ] ; then rm -rf %{buildroot} fielse echo "BuildRoot was somehow set to / !" exit -1fimake -j1 DESTDIR=%{buildroot} installrm -rf %{ROOT_DATADIR}/amandarm -f %{ROOT_AMANDAHOMEDIR}/example/inetd.conf.amandaclientmkdir %{buildroot}/{etc,var/log}mkdir %{ROOT_LOCALSTATEDIR}/amanda mkdir %{ROOT_SYSCONFDIR}/amandamkdir %{ROOT_AMANDAHOMEDIR}/gnutar-listsmkdir %{ROOT_LOGDIR}echo "%{amanda_version_info}" >%{ROOT_AMANDAHOMEDIR}/amanda-release# --- Clean up buildroot ---%cleanif [ "%{buildroot}" != "/" ]; then if [ -d "%{buildroot}" ] ; then rm -rf %{buildroot} fielse echo "BuildRoot was somehow set to / !" exit -1fi# --- Pre/post (un)installation scripts ---%preTMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX`if [ $? -ne 0 ]; then echo "Unable to mktemp!" 1>&2 exit 1fiLOGDIR="%{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' userecho "`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} 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 fielse # 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=0fiif [ -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 fielse VARLIB_OK=0fiecho "`date +'%b %e %Y %T'`:" >>${TMPFILE}if [ ! -e ${LOGDIR} ] ; then # create log directory mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1elif [ ! -d ${LOGDIR} ] ; then mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1 mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1 chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1 mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1fiif [ ${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 1else cat ${TMPFILE} cat ${TMPFILE} >>${INSTALL_LOG}fiecho "`date +'%b %e %Y %T'`: === Amanda installation started. ===" >${TMPFILE}cat ${TMPFILE}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -