📄 configure.sh
字号:
#!/bin/sh# Configuration script for sysstat# (C) 2000-2004 Sebastien GODARD (sysstat <at> wanadoo.fr)ASK="sh build/Ask.sh"echo ; echoecho You can enter a ? to display a help message at any time...echo# Installation directoryPREFIX=`${ASK} 'Installation directory:' "/usr/local" "prefix"`if [ ! -d ${PREFIX} ]; then echo "WARNING: Directory ${PREFIX} not found: Using default (/usr/local)." PREFIX=/usr/localfi# sadc directoryif [ -d ${PREFIX}/lib ]; then SADC_DIR=${PREFIX}/libelif [ -d ${PREFIX}/lib64 ]; then SADC_DIR=${PREFIX}/lib64else SADC_DIR=${PREFIX}/libfiSA_LIB_DIR=`${ASK} 'sadc directory:' "${SADC_DIR}/sa" "sadc-dir"`if [ ! -d ${SA_LIB_DIR} ]; then echo "INFO: Directory ${SA_LIB_DIR} will be created during installation stage."fi# System Activity directorySA_DIR=`${ASK} 'System activity directory:' "/var/log/sa" "sa-dir"`if [ ! -d ${SA_DIR} ]; then echo "INFO: Directory ${SA_DIR} will be created during installation stage."fiCLEAN_SA_DIR=`${ASK} 'Clean system activity directory?' "n" "clean-sa-dir"`# National Language SupportNLS=`${ASK} 'Enable National Language Support (NLS)?' "y" "nls"`which msgfmt > /dev/null 2>&1WHICH=`echo $?`if [ "${NLS}" = "y" -a ${WHICH} -eq 1 ]; then echo WARNING: msgfmt command not found!fi# Linux SMP race workaroundSMPRACE=`${ASK} 'Linux SMP race in serial driver workaround?' "n" "smp-race"`# sa2 processes data file of the day beforeYESTERDAY=`${ASK} 'sa2 uses daily data file of previous day?' "n" "yesterday"`if [ "${YESTERDAY}" = "y" ];then YDAY="--date=yesterday"else YDAY=""fi# Data history to keep by sa2HISTORY=`${ASK} 'Number of daily data files to keep:' "7" "history"`# Manual page groupgrep ^man: /etc/group >/dev/null 2>&1if [ $? -eq 1 ];then GRP=rootelse GRP=manfiMAN=`${ASK} 'Group for manual pages:' "${GRP}" "man-group"`grep ^${MAN}: /etc/group >/dev/null 2>&1if [ $? -eq 1 ];then echo WARNING: Group ${MAN} not found: Using ${GRP} instead. MAN=${GRP}fi# Set system directoriesif [ -d /etc/init.d ];then if [ -d /etc/init.d/rc2.d ]; then RC_DIR=/etc/init.d INITD_DIR=. else RC_DIR=/etc INITD_DIR=init.d fi INIT_DIR=/etc/init.delif [ -d /sbin/init.d ];then RC_DIR=/sbin/init.d INIT_DIR=/sbin/init.d INITD_DIR=.else RC_DIR=/etc/rc.d INIT_DIR=/etc/rc.d/init.d INITD_DIR=init.dfi# Crontabgrep ^adm: /etc/passwd >/dev/null 2>&1if [ $? -eq 1 ];then USR=rootelse USR=admfiCRON_OWNER=${USR}CRON=`${ASK} 'Set crontab to start sar automatically?' "n" "start-crontab"`if [ "${CRON}" = "y" ];then CRON_OWNER=`${ASK} 'Crontab owner (his crontab will be saved in current directory if necessary):' "${USR}" "crontab-owner"` grep ^${CRON_OWNER}: /etc/passwd >/dev/null 2>&1 if [ $? -eq 1 ]; then echo WARNING: User ${CRON_OWNER} not found: Using ${USR} instead. CRON_OWNER=${USR} fifi# Man directory# Beware that ${PREFIX}/share/man may not be in the man pathif [ -L ${PREFIX}/man -a -d ${PREFIX}/share/man ];then MANDIR=${PREFIX}/share/manelse MANDIR=${PREFIX}/manfiechoecho " man directory is ${MANDIR}"echo " rc directory is ${RC_DIR}"echo "init directory is ${INIT_DIR}"echo# Create CONFIG fileecho -n Creating CONFIG file now... sed <build/CONFIG.in >build/CONFIG \ -e "s+^\\(PREFIX =\\)\$+\\1 ${PREFIX}+" \ -e "s+^\\(SA_LIB_DIR =\\)\$+\\1 ${SA_LIB_DIR}+" \ -e "s+^\\(SA_DIR =\\)\$+\\1 ${SA_DIR}+" \ -e "s+^\\(MAN_DIR =\\)\$+\\1 ${MANDIR}+" \ -e "s+^\\(CLEAN_SA_DIR =\\)\$+\\1 ${CLEAN_SA_DIR}+" \ -e "s+^\\(ENABLE_NLS =\\)\$+\\1 ${NLS}+" \ -e "s+^\\(ENABLE_SMP_WRKARD =\\)\$+\\1 ${SMPRACE}+" \ -e "s+^\\(YESTERDAY =\\)\$+\\1 ${YDAY}+" \ -e "s+^\\(HISTORY =\\)\$+\\1 ${HISTORY}+" \ -e "s+^\\(MAN_GROUP =\\)\$+\\1 ${MAN}+" \ -e "s+^\\(RC_DIR =\\)\$+\\1 ${RC_DIR}+" \ -e "s+^\\(INIT_DIR =\\)\$+\\1 ${INIT_DIR}+" \ -e "s+^\\(INITD_DIR =\\)\$+\\1 ${INITD_DIR}+" \ -e "s+^\\(CRON_OWNER =\\)\$+\\1 ${CRON_OWNER}+" \ -e "s+^\\(INSTALL_CRON =\\)\$+\\1 ${CRON}+"echo " Done."echoecho 'Now enter "make" to build sysstat commands.'if [ "${CRON}" = "y" ];then echo 'Then edit the crontab file created in current directory ("vi crontab")'fiecho 'The last step is to log in as root and enter "make install"'echo 'to perform installation process.'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -