]> granicus.if.org Git - sysstat/blob - iconfig
sar/sadc: Dereference nr array pointer in struct activity
[sysstat] / iconfig
1 #!/bin/sh
2 #@(#) Configuration script for sysstat
3 # (C) 2000-2020 Sebastien GODARD (sysstat <at> orange.fr)
4
5 ASK="sh build/Ask.sh"
6
7 echo ; echo
8 echo Welcome to sysstat\'s  Interactive Configuration script!
9 echo
10 echo This script enables you to set the parameters value used by ./configure.
11 echo Please enter the value for the parameters listed below.
12 echo Press Return to tell ./configure to use the default value or to try to guess the proper one.
13 echo "Defaut value for yes/no questions is no (parameter is NOT set)."
14 echo You can enter a ? to display a help message at any time...
15 echo
16
17 # Syntax: Ask <QUESTION> <PARM> <TEXT_FILE>
18
19 # Installation directory
20 PREFIX=`${ASK} 'Installation directory:' "--prefix" "prefix"`
21 if [ "${PREFIX}" != "" ]; then
22         PREFIX="--prefix=${PREFIX} "
23 fi
24
25 # sadc directory
26 SA_LIB_DIR=`${ASK} 'sadc directory:' "sa_lib_dir" "sa_lib_dir"`
27 if [ "${SA_LIB_DIR}" != "" ]; then
28         SA_LIB_DIR="sa_lib_dir=${SA_LIB_DIR} "
29 fi
30
31 # System Activity directory
32 SA_DIR=`${ASK} 'System activity directory:' "sa_dir" "sa_dir"`
33 if [ "${SA_DIR}" != "" ]; then
34         SA_DIR="sa_dir=${SA_DIR} "
35 fi
36
37 # sysstat configuration directory
38 SYSCONFIG_DIR=`${ASK} 'sysstat configuration directory:' "conf_dir" "conf_dir"`
39 if [ "${SYSCONFIG_DIR}" != "" ]; then
40         SYSCONFIG_DIR="conf_dir=${SYSCONFIG_DIR} "
41 fi
42
43 # sysstat configuration file
44 SYSCONFIG_FILE=`${ASK} 'sysstat configuration file:' "conf_file" "conf_file"`
45 if [ "${SYSCONFIG_FILE}" != "" ]; then
46         SYSCONFIG_FILE="conf_file=${SYSCONFIG_FILE} "
47 fi
48
49 # Clean sa directory
50 CLEAN_SA_DIR=`${ASK} 'Clean system activity directory? (y/n)' "--enable-clean-sa-dir" "clean-sa-dir"`
51 if [ "${CLEAN_SA_DIR}" = "y" ]; then
52         CLEAN_SA_DIR="--enable-clean-sa-dir "
53 else
54         CLEAN_SA_DIR=""
55         echo "Parameter --enable-clean-sa-dir is NOT set"
56 fi
57
58 # National Language Support
59 NLS=`${ASK} 'Disable National Language Support (NLS)? (y/n)' "--disable-nls" "nls"`
60 if [ "${NLS}" = "y" ]; then
61         NLS="--disable-nls "
62 else
63         NLS=""
64         echo "Parameter --disable-nls is NOT set"
65 fi
66
67 # Sensors support
68 SENSORS=`${ASK} 'Disable sensors support? (y/n)' "--disable-sensors" "sensors"`
69 if [ "${SENSORS}" = "y" ]; then
70         SENSORS="--disable-sensors "
71 else
72         SENSORS=""
73         echo "Parameter --disable-sensors is NOT set"
74 fi
75
76 # PCP support
77 PCP=`${ASK} 'Disable PCP support? (y/n)' "--disable-pcp" "pcp"`
78 if [ "${PCP}" = "y" ]; then
79         PCP="--disable-pcp "
80 else
81         PCP=""
82         echo "Parameter --disable-pcp is NOT set"
83 fi
84
85 # Data history to keep by sa2
86 HISTORY=`${ASK} 'Number of daily data files to keep:' "history" "history"`
87 if [ "${HISTORY}" != "" ]; then
88         HISTORY="history=${HISTORY} "
89 fi
90
91 # Random delay before sa2 script generates its reports files
92 DELAY_RANGE=`${ASK} 'Maximum delay in seconds to wait before sa2 script runs:' "delay_range" "delay_range"`
93 if [ "${DELAY_RANGE}" != "" ]; then
94         DELAY_RANGE="delay_range=${DELAY_RANGE} "
95 fi
96
97 # Delay after which datafiles are to be compressed
98 COMPRESSAFTER=`${ASK} 'Number of days after which sar datafiles must be compressed:' "compressafter" "compressafter"`
99 if [ "${COMPRESSAFTER}" != "" ]; then
100         COMPRESSAFTER="compressafter=${COMPRESSAFTER} "
101 fi
102
103 # Manual page group
104 MAN=`${ASK} 'Group for manual pages:' "man_group" "man_group"`
105 if [ "${MAN}" != "" ]; then
106         MAN="man_group=${MAN} "
107 fi
108
109 # Don't set attributes on files being installed
110 IGNORE_FILE_ATTR=`${ASK} 'Do not set attributes on files being installed? (y/n)' "--disable-file-attr" "ignore-file-attr"`
111 if [ "${IGNORE_FILE_ATTR}" = "y" ]; then
112         IGNORE_FILE_ATTR="--disable-file-attr "
113 else
114         IGNORE_FILE_ATTR=""
115         echo "Parameter --disable-file-attr is NOT set"
116 fi
117
118 # Crontab
119 CRON=`${ASK} 'Set crontab to start sar automatically? (y/n)' "--enable-install-cron" "install-cron"`
120 if [ "${CRON}" = "y" ]; then
121         CRON="--enable-install-cron "
122 else
123         CRON=""
124         echo "Parameter --enable-install-cron is NOT set"
125 fi
126
127 if [ "${CRON}" != "" ];
128 then
129         CRON_OWNER=`${ASK} 'Crontab owner:' "cron_owner" "cron_owner"`
130         if [ "${CRON_OWNER}" != "" ]; then
131                 CRON="${CRON}cron_owner=${CRON_OWNER} "
132         fi
133 fi
134
135 if [ "${CRON}" != "" ];
136 then
137         USE_CROND=`${ASK} 'Use standard cron daemon? (y/n)' "--enable-use-crond" "use-crond"`
138         if [ "${USE_CROND}" = "y" ]; then
139                 USE_CROND="--enable-use-crond "
140         else
141                 USE_CROND=""
142                 echo "Parameter --enable-use-crond is NOT set"
143         fi
144 fi
145
146 if [ "${CRON}" != "" ];
147 then
148         CRON_INTERVAL=`${ASK} 'Crontab sampling interval (in minutes):' "cron_interval" "cron_interval"`
149         if [ "${CRON_INTERVAL}" != "" ]; then
150                 CRON="${CRON}cron_interval=${CRON_INTERVAL} "
151         fi
152 fi
153
154 if [ "${CRON}" != "" ];
155 then
156         COLL_ALL=`${ASK} 'Should sadc collect optional activities? (y/n)' "--enable-collect-all" "collect-all"`
157         if [ "${COLL_ALL}" = "y" ]; then
158                 CRON="${CRON}--enable-collect-all "
159         else
160                 echo "Parameter --enable-collect-all is NOT set"
161         fi
162 fi
163
164 if [ "${CRON}" != "" -a "${COLL_ALL}" != "y" ];
165 then
166         # Optional args for sadc
167         SADC_OPT=`${ASK} 'Options to be passed to sadc:' "sadc_options" "sadc_options"`
168 else
169         SADC_OPT=
170 fi
171
172 if [ "${CRON}" != "" ];
173 then
174         # rc directory
175         RCDIR=`${ASK} 'rc directory:' "rcdir" "rcdir"`
176         if [ "${RCDIR}" != "" ]; then
177                 RCDIR="rcdir=${RCDIR} "
178         fi
179 fi
180
181 if [ "${CRON}" != "" ];
182 then
183         # Only copy files
184         COPY_ONLY=`${ASK} 'Only copy files when installing sysstat? (y/n)' "--enable-copy-only" "copy-only"`
185         if [ "${COPY_ONLY}" = "y" ]; then
186                 COPY_ONLY="--enable-copy-only "
187         else
188                 COPY_ONLY=""
189                 echo "Parameter --enable-copy-only is NOT set"
190         fi
191 fi
192
193 # Compress manual pages
194 COMPRESSMANPG=`${ASK} 'Do not compress manual pages? (y/n)' "--disable-compress-manpg" "compress-manpg"`
195 if [ "${COMPRESSMANPG}" = "y" ]; then
196         COMPRESSMANPG="--disable-compress-manpg "
197 else
198         COMPRESSMANPG=""
199         echo "Parameter --disable-compress-manpg is NOT set"
200 fi
201
202 # Install documentation
203 INSTALL_DOC=`${ASK} 'Skip documentation installation? (y/n)' "--disable-documentation" "install-doc"`
204 if [ "${INSTALL_DOC}" = "y" ]; then
205         INSTALL_DOC="--disable-documentation "
206 else
207         INSTALL_DOC=""
208         echo "Parameter --disable-documentation is NOT set"
209 fi
210
211 # Debug mode
212 DEBUGINFO=`${ASK} 'Debug mode support? (y/n)' "--enable-debuginfo" "debuginfo"`
213 if [ "${DEBUGINFO}" = "y" ]; then
214         DEBUGINFO="--enable-debuginfo "
215 else
216         DEBUGINFO=""
217         echo "Parameter --enable-debuginfo is NOT set"
218 fi
219
220 # Strip object files
221 STRIP=`${ASK} 'Do not strip object files? (y/n)' "--disable-stripping" "stripping"`
222 if [ "${STRIP}" = "y" ]; then
223         STRIP="--disable-stripping "
224 else
225         STRIP=""
226         echo "Parameter --disable-stripping is NOT set"
227 fi
228
229 echo
230 echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
231 ${CLEAN_SA_DIR}${NLS}${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR} \
232 ${CRON}${USE_CROND}${RCDIR}"
233 if [ "${SADC_OPT}" != "" ];
234 then
235         echo -n "sadc_options=\"${SADC_OPT}\""
236 fi
237 echo "${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS}${PCP}${STRIP}${COPY_ONLY}"
238 echo
239
240 ./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
241 ${CLEAN_SA_DIR}${NLS} \
242 ${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${USE_CROND}${RCDIR} \
243 sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \
244 ${PCP}${STRIP}${COPY_ONLY}