⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preinst

📁 开源备份软件源码 AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that a
💻
字号:
#!/bin/sh amanda_user=amandabackupamanda_group=diskTMPFILE=`mktemp /tmp/deb-amanda.XXXXXXXXXXX`if [ $? -ne 0 ]; then	echo "Unable to mktemp!" 1>&2	exit 1fiLOGDIR="/var/log/amanda"INSTALL_LOG="${LOGDIR}/install.log"INSTALL_ERR="${LOGDIR}/install.err"echo "`date +'%b %e %Y %T'`: Preparing to install Amanda" >${TMPFILE}# Check for the '${amanda_user}' 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" -g ${amanda_group} -d /var/lib/amanda -s /bin/sh ${amanda_user}	# Lock the ${amanda_user} account until admin sets password	passwd -l ${amanda_user} >>/dev/null	PASSWD_EXIT=$?	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 /etc/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 /var/lib/amanda/.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}' 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:           /var/lib/amanda" >>${TMPFILE}	echo "`date +'%b %e %Y %T'`:  Default group:  ${amanda_group}" >>${TMPFILE}	echo "`date +'%b %e %Y %T'`:  Verifying ${amanda_user} user parameters :" >>${TMPFILE}	        if [ "`id -gn ${amanda_user}`" != "${amanda_group}" ] ; then                echo "`date +'%b %e %Y %T'`:  !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}                echo "`date +'%b %e %Y %T'`:  !!! user '${amanda_user}' is not part of the ${amanda_group} group, !!!" >>${TMPFILE}                echo "`date +'%b %e %Y %T'`:  !!! please 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 '${amanda_user}'" >>${TMPFILE}        fi	echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}	PASSWD_OK=0fiif [ -d /var/lib/amanda ] ; then	echo -n "`date +'%b %e %Y %T'`:  Checking ownership of '/var/lib/amanda'... " >>${TMPFILE}	if [ "`ls -dl /var/lib/amanda | awk '//{split($_,x); print x[3]}'`" = "${amanda_user}" ] && \	   [ "`ls -dl /var/lib/amanda | 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 '/var/lib/amanda' 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>&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 installation." >&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}cat ${TMPFILE} >>${INSTALL_LOG}if [ -f "${TMPFILE}" ]; then	rm -f "${TMPFILE}"fi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -