~ubuntu-branches/ubuntu/hoary/sysstat/hoary

« back to all changes in this revision

Viewing changes to build/Configure.sh

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2004-06-15 18:47:50 UTC
  • Revision ID: james.westby@ubuntu.com-20040615184750-y9zskvg3k6tf9j15
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Configuration script for sysstat
 
3
# (C) 2000-2004 Sebastien GODARD (sysstat <at> wanadoo.fr)
 
4
 
 
5
ASK="sh build/Ask.sh"
 
6
 
 
7
echo ; echo
 
8
echo You can enter a ? to display a help message at any time...
 
9
echo
 
10
 
 
11
# Installation directory
 
12
 
 
13
PREFIX=`${ASK} 'Installation directory:' "/usr/local" "prefix"`
 
14
if [ ! -d ${PREFIX} ]; then
 
15
        echo "WARNING: Directory ${PREFIX} not found: Using default (/usr/local)."
 
16
        PREFIX=/usr/local
 
17
fi
 
18
 
 
19
# System Activity directory
 
20
 
 
21
SA_DIR=`${ASK} 'System activity directory:' "/var/log/sa" "sa-dir"`
 
22
if [ ! -d ${SA_DIR} ]; then
 
23
        echo "INFO: Directory ${SA_DIR} will be created during installation stage."
 
24
fi
 
25
 
 
26
CLEAN_SA_DIR=`${ASK} 'Clean system activity directory?' "n" "clean-sa-dir"`
 
27
 
 
28
# National Language Support
 
29
NLS=`${ASK} 'Enable National Language Support (NLS)?' "y" "nls"`
 
30
which msgfmt > /dev/null 2>&1
 
31
WHICH=`echo $?`
 
32
if [ "${NLS}" = "y" -a ${WHICH} -eq 1 ]; then
 
33
        echo WARNING: msgfmt command not found!
 
34
fi
 
35
 
 
36
# Linux SMP race workaround
 
37
 
 
38
SMPRACE=`${ASK} 'Linux SMP race in serial driver workaround?' "n" "smp-race"`
 
39
 
 
40
# sa2 processes data file of the day before
 
41
 
 
42
YESTERDAY=`${ASK} 'sa2 uses daily data file of previous day?' "n" "yesterday"`
 
43
if [ "${YESTERDAY}" = "y" ];
 
44
then
 
45
        YDAY="--date=yesterday"
 
46
else
 
47
        YDAY=""
 
48
fi
 
49
 
 
50
# Data history to keep by sa2
 
51
 
 
52
HISTORY=`${ASK} 'Number of daily data files to keep:' "7" "history"`
 
53
 
 
54
# Manual page group
 
55
 
 
56
grep ^man: /etc/group >/dev/null 2>&1
 
57
if [ $? -eq 1 ];
 
58
then
 
59
        GRP=root
 
60
else
 
61
        GRP=man
 
62
fi
 
63
MAN=`${ASK} 'Group for manual pages:' "${GRP}" "man-group"`
 
64
grep ^${MAN}: /etc/group >/dev/null 2>&1
 
65
if [ $? -eq 1 ];
 
66
then
 
67
        echo WARNING: Group ${MAN} not found: Using ${GRP} instead.
 
68
        MAN=${GRP}
 
69
fi
 
70
 
 
71
# Set system directories
 
72
 
 
73
if [ -d /etc/init.d ];
 
74
then
 
75
        if [ -d /etc/init.d/rc2.d ];
 
76
        then
 
77
                RC_DIR=/etc/init.d
 
78
                INITD_DIR=.
 
79
        else
 
80
                RC_DIR=/etc
 
81
                INITD_DIR=init.d
 
82
        fi
 
83
        INIT_DIR=/etc/init.d
 
84
elif [ -d /sbin/init.d ];
 
85
then
 
86
        RC_DIR=/sbin/init.d
 
87
        INIT_DIR=/sbin/init.d
 
88
        INITD_DIR=.
 
89
else
 
90
        RC_DIR=/etc/rc.d
 
91
        INIT_DIR=/etc/rc.d/init.d
 
92
        INITD_DIR=init.d
 
93
fi
 
94
 
 
95
# Crontab
 
96
 
 
97
grep ^adm: /etc/passwd >/dev/null 2>&1
 
98
if [ $? -eq 1 ];
 
99
then
 
100
        USR=root
 
101
else
 
102
        USR=adm
 
103
fi
 
104
CRON_OWNER=${USR}
 
105
CRON=`${ASK} 'Set crontab to start sar automatically?' "n" "start-crontab"`
 
106
if [ "${CRON}" = "y" ];
 
107
then
 
108
        CRON_OWNER=`${ASK} 'Crontab owner (his crontab will be saved in current directory):' "${USR}" "crontab-owner"`
 
109
 
 
110
        grep ^${CRON_OWNER}: /etc/passwd >/dev/null 2>&1
 
111
        if [ $? -eq 1 ];
 
112
        then
 
113
                echo WARNING: User ${CRON_OWNER} not found: Using ${USR} instead.
 
114
                CRON_OWNER=${USR}
 
115
        fi
 
116
fi
 
117
 
 
118
# Man directory
 
119
 
 
120
if [ -L ${PREFIX}/man -a -d ${PREFIX}/share/man ];
 
121
then
 
122
        MANDIR=${PREFIX}/share/man
 
123
else
 
124
        MANDIR=${PREFIX}/man
 
125
fi
 
126
 
 
127
echo
 
128
echo " man directory is ${MANDIR}"
 
129
echo "  rc directory is ${RC_DIR}"
 
130
echo "init directory is ${INIT_DIR}"
 
131
echo
 
132
 
 
133
# Create CONFIG file
 
134
 
 
135
echo -n Creating CONFIG file now... 
 
136
 
 
137
sed <build/CONFIG.in >build/CONFIG \
 
138
        -e "s+^\\(PREFIX =\\)\$+\\1 ${PREFIX}+" \
 
139
        -e "s+^\\(SA_DIR =\\)\$+\\1 ${SA_DIR}+" \
 
140
        -e "s+^\\(MAN_DIR =\\)\$+\\1 ${MANDIR}+" \
 
141
        -e "s+^\\(CLEAN_SA_DIR =\\)\$+\\1 ${CLEAN_SA_DIR}+" \
 
142
        -e "s+^\\(ENABLE_NLS =\\)\$+\\1 ${NLS}+" \
 
143
        -e "s+^\\(ENABLE_SMP_WRKARD =\\)\$+\\1 ${SMPRACE}+" \
 
144
        -e "s+^\\(YESTERDAY =\\)\$+\\1 ${YDAY}+" \
 
145
        -e "s+^\\(HISTORY =\\)\$+\\1 ${HISTORY}+" \
 
146
        -e "s+^\\(MAN_GROUP =\\)\$+\\1 ${MAN}+" \
 
147
        -e "s+^\\(RC_DIR =\\)\$+\\1 ${RC_DIR}+" \
 
148
        -e "s+^\\(INIT_DIR =\\)\$+\\1 ${INIT_DIR}+" \
 
149
        -e "s+^\\(INITD_DIR =\\)\$+\\1 ${INITD_DIR}+" \
 
150
        -e "s+^\\(CRON_OWNER =\\)\$+\\1 ${CRON_OWNER}+" \
 
151
        -e "s+^\\(INSTALL_CRON =\\)\$+\\1 ${CRON}+"
 
152
echo " Done."
 
153
 
 
154
echo
 
155
echo 'Now enter "make" to build sysstat commands.'
 
156
if [ "${CRON}" = "y" ];
 
157
then
 
158
        echo 'Then edit the crontab file created in current directory ("vi crontab")'
 
159
fi
 
160
echo 'The last step is to log in as root and enter "make install"'
 
161
echo 'to perform installation process.'
 
162