Make.sh gesplittet und maechtig ueberarbeitet.
[people/pmueller/ipfire-2.x.git] / tools / make-functions
CommitLineData
15679d9f
MT
1#!/bin/bash
2############################################################################
3#
4# Beautifying variables & presentation & input output interface
5#
6############################################################################
7
8## Screen Dimentions
9# Find current screen size
10if [ -z "${COLUMNS}" ]; then
11 COLUMNS=$(stty size)
12 COLUMNS=${COLUMNS##* }
13fi
14
15# When using remote connections, such as a serial port, stty size returns 0
16if [ "${COLUMNS}" = "0" ]; then
17 COLUMNS=80
18fi
19
20## Measurements for positioning result messages
21RESULT_WIDTH=4
22TIME_WIDTH=8
23OPT_WIDTH=6
24VER_WIDTH=10
25RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
26TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
27OPT_COL=$((${TIME_COL} - $OPT_WIDTH - 5))
28VER_COL=$((${OPT_COL} - $VER_WIDTH - 5))
29
30## Set Cursur Position Commands, used via echo -e
31SET_RESULT_COL="\\033[${RESULT_COL}G"
32SET_TIME_COL="\\033[${TIME_COL}G"
33SET_OPT_COL="\\033[${OPT_COL}G"
34SET_VER_COL="\\033[${VER_COL}G"
35
36# Define color for messages
37BOLD="\\033[1;39m"
38DONE="\\033[1;32m"
39SKIP="\\033[1;34m"
40WARN="\\033[1;35m"
41FAIL="\\033[1;31m"
42NORMAL="\\033[0;39m"
43
44evaluate() {
45 if [ "$?" -eq "0" ]; then
46 beautify message DONE
47 else
48 EXITCODE=$1
49 shift 1
50 beautify message FAIL
51 $*
52 if [ $EXITCODE -ne "0" ]; then
53 exit $EXITCODE
54 fi
55 fi
56}
57
58position_cursor()
59{
60 # ARG1=starting position on screen
61 # ARG2=string to be printed
62 # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
63 # For example if your starting position is column 50 and you want to print Hello three columns to the right
64 # of your starting position, your call will look like this:
65 # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
66 # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
67 # your call will look like this:
68 # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
69 # If you want to start printing at the exact starting location, use offset 0
70
71 START=$1
72 STRING=$2
73 OFFSET=$3
74
75 STRING_LENGTH=${#STRING}
76
77 if [ ${OFFSET} -lt 0 ]; then
78 COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
79 else
80 COL=$((${START} + ${OFFSET}))
81 fi
82
83 SET_COL="\\033[${COL}G"
84
85 echo $SET_COL
86} # End of position_cursor()
87
88
89beautify()
90{
91 # Commands: build_stage, make_pkg, message, result
92 case "$1" in
93 message)
94 case "$2" in
95 DONE)
96 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
97 ;;
98 WARN)
99 echo -ne "${WARN}${3}${NORMAL}${SET_RESULT_COL}[${WARN} WARN ${NORMAL}]\n"
100 ;;
101 FAIL)
102 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
103 ;;
104 SKIP)
105 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
106 ;;
107 esac
108 ;;
109 build_stage)
110 MESSAGE=$2
111 echo -ne "${BOLD}*** ${MESSAGE}${SET_VER_COL} version${SET_OPT_COL} options"
112 echo -ne "${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
113 ;;
114 make_pkg)
115 echo "$2" | while read PKG_VER PROGRAM OPTIONS
116 do
117 SET_VER_COL_REAL=`position_cursor $OPT_COL $PKG_VER -3`
118
119 if [ "$OPTIONS" == "" ]; then
120 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
121 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
122 else
123 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
124 echo -ne "${NORMAL} ]${SET_OPT_COL}[ ${BOLD}${OPTIONS}"
125 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
126 fi
127 done
128 ;;
129 result)
130 RESULT=$2
131
132 if [ ! $3 ]; then
133 PKG_TIME=0
134 else
135 PKG_TIME=$3
136 fi
137
138 SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
139 case "$RESULT" in
140 DONE)
141 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
142 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
143 ;;
144 FAIL)
145 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
146 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
147 ;;
148 SKIP)
149 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
150 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
151 ;;
152 esac
153 ;;
154 esac
155} # End of beautify()
156
157
158get_pkg_ver()
159{
160 PKG_VER=`grep ^VER $1 | awk '{print $3}'`
161
162 if [ -z $PKG_VER ]; then
163 PKG_VER=`grep "Exp " $1 | awk '{print $4}'`
164 fi
165
166 if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
167 # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
168 # and replace enough characters to fit the resulting string on the screen. We'll replace
169 # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
170 # Example: if we have a 21-long version number that we want to fit into a 10-long space,
171 # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
172 # end up with a 12-character long string. That's why we replace 12 characters with ..
173 REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
174 PKG_VER=`echo ${PKG_VER/$REMOVE/..}`
175 fi
176
177 echo "$PKG_VER"
178} # End of get_pkg_ver()
179
180if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE ]; then
181 echo "`date -u '+%b %e %T'`: Machine is iX86 (or equivalent)" >> $LOGFILE
182 MACHINE=i586
183 BUILDTARGET=i586-pc-linux-gnu
184 C2FLAGS="-O2 -march=i586 -mtune=i586 -pipe -fomit-frame-pointer"
185 CXX2FLAGS="-O2 -march=i586 -mtune=i586 -pipe -fomit-frame-pointer"
186else
187 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
188 exit 1
189fi
190
191# Define immediately
192stdumount() {
193 umount $BASEDIR/build/dev/pts 2>/dev/null;
194 umount $BASEDIR/build/proc 2>/dev/null;
195 umount $BASEDIR/build/install/mnt 2>/dev/null;
196 umount $BASEDIR/build/usr/src/cache 2>/dev/null;
197 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;
198 umount $BASEDIR/build/usr/src/config 2>/dev/null;
199 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
200 umount $BASEDIR/build/usr/src/html 2>/dev/null;
201 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
202 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;
203 umount $BASEDIR/build/usr/src/log 2>/dev/null;
204 umount $BASEDIR/build/usr/src/src 2>/dev/null;
205}
206
207exiterror() {
208 stdumount
209 for i in `seq 0 7`; do
210 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
211 losetup -d /dev/loop${i} 2>/dev/null
212 fi;
213 done
214 echo -e "\nERROR: $*"
215 echo " Check $LOGFILE for errors if applicable"
216 exit 1
217}
218
219entershell() {
220 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
221 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
222 fi
223 echo "Entering to a shell inside LFS chroot, go out with exit"
224 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
225 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
226 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
227 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
228 CFLAGS="$CF2LAGS" CXXFLAGS="$CXX2FLAGS" \
229 CCACHE_DIR=/usr/src/ccache \
230 CCACHE_HASHDIR=1 \
231 KVER=$KVER \
232 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
233 KGCC="ccache /usr/bin/gcc" \
234 /tools/bin/bash
235 if [ $? -ne 0 ]; then
236 beautify message FAIL
237 exiterror "chroot error"
238 else
239 stdumount
240 fi
241}
242
243############################################################################
244# #
245# Necessary shell functions #
246# #
247############################################################################
248#
249# Common checking before entering the chroot and compilling
250#
251# Return:0 caller can continue
252# :1 skip (nothing to do)
253# or fail if no script file found
254#
255lfsmakecommoncheck()
256{
257
258 # Script present?
259 if [ ! -f $BASEDIR/lfs/$1 ]; then
260 exiterror "No such file or directory: $BASEDIR/$1"
261 fi
262
263 local PKG_VER=`get_pkg_ver $BASEDIR/lfs/$1`
264 beautify make_pkg "$PKG_VER $*"
265
266 # Script slipped?
267 local i
268 for i in $SKIP_PACKAGE_LIST
269 do
270 if [ "$i" == "$1" ]; then
271 beautify result SKIP
272 return 1;
273 fi
274 done
275
276 echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
277
278 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
279 if [ $? -ne 0 ]; then
280 exiterror "Download error in $1"
281 fi
282
283 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
284 if [ $? -ne 0 ]; then
285 exiterror "md5sum error in $1, check file in cache or signature"
286 fi
287
288 return 0 # pass all!
289} # End of lfsmakecommoncheck()
290
291lfsmake1() {
292 lfsmakecommoncheck $*
293 [ $? == 1 ] && return 0
294
295 local PKG_TIME_START=`date +%s`
296
297 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
298 MACHINE=$MACHINE \
299 LFS_BASEDIR=$BASEDIR \
300 ROOT=$LFS \
301 KVER=$KVER \
302 MAKETUNING=$MAKETUNING \
303 install >> $LOGFILE 2>&1
304 local COMPILE_SUCCESS=$?
305 local PKG_TIME_END=`date +%s`
306
307 if [ $COMPILE_SUCCESS -ne 0 ]; then
308 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
309 exiterror "Building $*";
310 else
311 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
312 fi
313
314 return 0
315}
316
317lfsmake2() {
318 lfsmakecommoncheck $*
319 [ $? == 1 ] && return 0
320
321 local PKG_TIME_START=`date +%s`
322 chroot $LFS /tools/bin/env -i HOME=/root \
323 TERM=$TERM PS1='\u:\w\$ ' \
324 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
325 VERSION=$VERSION \
326 CONFIG_ROOT=$CONFIG_ROOT \
327 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
328 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
329 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
330 KVER=$KVER MAKETUNING=$MAKETUNING \
331 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
332 /tools/bin/bash -x -c "cd /usr/src/lfs && \
333 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
334 local COMPILE_SUCCESS=$?
335 local PKG_TIME_END=`date +%s`
336
337 if [ $COMPILE_SUCCESS -ne 0 ]; then
338 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
339 exiterror "Building $*";
340 else
341 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
342 fi
343
344 return 0
345}
346
347ipfiremake() {
348 lfsmakecommoncheck $*
349 [ $? == 1 ] && return 0
350
351 local PKG_TIME_START=`date +%s`
352 chroot $LFS /tools/bin/env -i HOME=/root \
353 TERM=$TERM PS1='\u:\w\$ ' \
354 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
355 VERSION=$VERSION \
356 CONFIG_ROOT=$CONFIG_ROOT \
357 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
358 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
359 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
360 KVER=$KVER MAKETUNING=$MAKETUNING \
361 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
362 /bin/bash -x -c "cd /usr/src/lfs && \
363 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
364
365 local COMPILE_SUCCESS=$?
366 local PKG_TIME_END=`date +%s`
367
368 if [ $COMPILE_SUCCESS -ne 0 ]; then
369 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
370 exiterror "Building $*";
371 else
372 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
373 fi
374 return 0
375}
376
377ipfiredist() {
378 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
379 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
380 chroot $LFS /tools/bin/env -i HOME=/root \
381 TERM=$TERM PS1='\u:\w\$ ' \
382 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
383 VERSION=$VERSION \
384 CONFIG_ROOT=$CONFIG_ROOT \
385 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
386 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
387 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
388 KVER=$KVER \
389 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
390 /bin/bash -x -c "cd /usr/src/lfs && \
391 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
392 if [ $? -ne 0 ]; then
393 exiterror "Packaging $1"
394 fi
395 else
396 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
397 fi
398 return 0
399}
400
401installmake() {
402 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
403 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
404 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
405 if [ $? -ne 0 ]; then
406 exiterror "Download error in $1"
407 fi
408 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
409 if [ $? -ne 0 ]; then
410 exiterror "md5sum error in $1, check file in cache or signature"
411 fi
412 chroot $LFS /tools/bin/env -i HOME=/root \
413 TERM=$TERM PS1='\u:\w\$ ' \
414 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
415 VERSION=$VERSION \
416 CONFIG_ROOT=$CONFIG_ROOT \
417 LFS_PASS="install" \
418 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
419 CFLAGS="-Os" CXXFLAGS="-Os" \
420 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
421 KVER=$KVER \
422 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
423 /bin/bash -x -c "cd /usr/src/lfs && \
424 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
425 if [ $? -ne 0 ]; then
426 exiterror "Building $*"
427 fi
428 else
429 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
430 fi
431 return 0
432}
433
434update_logs() {
435 tar cfz log/ipfire-logs-`date +'%Y-%m-%d-%H:%M'`.tgz log/_build.*
436 rm -f log/_build.*
437}
438
439batch_script() {
440 echo -ne "### UPDATE LOGS"
441 update_logs
442 evaluate 1
443
444 if [ "$IPFIRE_REBUILD" -eq "0" ]; then
445 echo -ne "### SAVING TIME"
446 export IPFIRE_START_TIME=`date`
447 evaluate 1
448
449 echo "### RUNNING SVN-UPDATE"
450 $0 svn update
451 evaluate 1 mail SVNUPDATE
452
453 echo "### EXPORT SOURCES"
454 $0 svn dist
455 evaluate 1 mail SVNDIST
456
457 echo "### RUNNING PREFETCH"
458 $0 prefetch | grep -q "md5 difference"
459 evaluate 1 mail PREFETCH
460 fi
461
462 echo "### RUNNING BUILD"
463 $0 build
464 evaluate 1 mail ERROR
465
466 echo "### UPLOADING ISO"
467 $0 upload iso
468 evaluate 1 mail ISO
469
470 echo -ne "### UPLOADING PAKS"
471 $0 upload paks
472 evaluate 1 mail PAKS
473
474 echo -n "${BOLD}***SUCCESS!${NORMAL}"
475 evaluate 0 mail SUCCESS
476 exit 0
477}
478
479watch_screen() {
480 echo -e "${BOLD}Exit with Ctrl+A, Ctrl+D.${NORMAL}"
481 sleep 0.5
482 screen -x ipfire
483}
484
485mail() {
486 chmod 755 tools/sendEmail
487 ATTACHMENT=/tmp/ipfire-build-logs-R$SVN_REVISION.tar.gz
488 case "$1" in
489 success)
490 SUBJECT="SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
491 cat <<END > /tmp/ipfire_mail_body
492Building IPFire on `hostname` in Revision $SVN_REVISION was successfull!
493You can find the ISO on your ftp server.
494
495Statistics:
496-----------
497Started: $IPFIRE_START_TIME
498Finished: `date`
499
500Best Regards
501Your IPFire-Build-Script
502
503END
504 echo -ne "${BOLD}***Sending success message${NORMAL}"
505 ;;
506 *)
507 SUBJECT="ERROR $1: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
508 cat <<END > /tmp/ipfire_mail_body
509When I was building IPFire on `hostname`, I have found an ERROR with name $1!
510Here you can see the logs and detect the reason for this error.
511
512Best Regards
513Your IPFire-Build-Script
514
515
516Here is a summary... The full logs are in the attachment.
517---------------------------------------------------------
518
519`tail log/_*`
520END
521 echo -ne "${BOLD}***Sending error message${NORMAL}"
522 ;;
523 esac
524 tar cfz $ATTACHMENT log/_build*
525 cat /tmp/ipfire_mail_body | tools/sendEmail -q \
526 -f $IPFIRE_MAIL_FROM \
527 -t $IPFIRE_MAIL_REPORT \
528 -u $SUBJECT \
529 -s $IPFIRE_MAIL_SERVER:25 \
530 -xu $IPFIRE_MAIL_USER \
531 -xp $IPFIRE_MAIL_PASS \
532 -l log/_build.mail.log \
533 -a $ATTACHMENT # -v
534 if [ "$?" -eq "0" ]; then
535 beautify message DONE
536 else
537 beautify message FAIL
538 fi
539 rm -f /tmp/ipfire_mail_body $ATTACHMENT
540}
541
542make_config() {
543 echo -e "This is for creating your configuration..."
544 echo -e "We will need some input:"
545 echo -e ""
546 echo -n "FTP-DOMAIN FOR THE ISO: "
547 read IPFIRE_FTP_URL_EXT
548 echo -n "PATH FOR $IPFIRE_FTP_URL_EXT: "
549 read IPFIRE_FTP_PATH_EXT
550 echo -n "USERNAME FOR $IPFIRE_FTP_URL_EXT: "
551 read IPFIRE_FTP_USER_EXT
552 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_EXT: "
553 read -s IPFIRE_FTP_PASS_EXT
554 echo ""
555 echo "(You can leave this empty if the cache-server is the same as your iso-server.)"
556 echo -n "FTP-DOMAIN FOR THE CACHE: "
557 read IPFIRE_FTP_URL_INT
558 echo -n "PATH FOR $IPFIRE_FTP_URL_INT: "
559 read IPFIRE_FTP_PATH_INT
560 if [ $IPFIRE_FTP_URL_INT ]; then
561 echo -n "USERNAME FOR $IPFIRE_FTP_URL_INT: "
562 read IPFIRE_FTP_USER_INT
563 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_INT: "
564 read -s IPFIRE_FTP_PASS_INT
565 else
566 IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_EXT
567 IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_EXT
568 IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_EXT
569 echo "USERNAME FOR $IPFIRE_FTP_URL_INT: $IPFIRE_FTP_USER_INT"
570 echo "PASSWORD FOR $IPFIRE_FTP_URL_INT: !HIDDEN!"
571 fi
572 echo ""
573 echo "(You can leave this empty if the pak-server is the same as your iso-server.)"
574 echo -n "FTP-DOMAIN FOR THE PAKS: "
575 read IPFIRE_FTP_URL_PAK
576 echo -n "PATH FOR $IPFIRE_FTP_URL_PAK: "
577 read IPFIRE_FTP_PATH_PAK
578 if [ $IPFIRE_FTP_URL_PAK ]; then
579 echo -n "USERNAME FOR $IPFIRE_FTP_URL_PAK: "
580 read IPFIRE_FTP_USER_PAK
581 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_PAK: "
582 read -s IPFIRE_FTP_PASS_PAK
583 else
584 IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_EXT
585 IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_EXT
586 IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_EXT
587 echo "USERNAME FOR $IPFIRE_FTP_URL_PAK: $IPFIRE_FTP_USER_PAK"
588 echo "PASSWORD FOR $IPFIRE_FTP_URL_PAK: !HIDDEN!"
589 fi
590 echo ""
591 echo -e "ONE OR MORE EMAIL ADDRESS(ES) TO WHICH THE REPORTS WILL BE SENT"
592 echo -e "(seperated by comma)"
593 read IPFIRE_MAIL_REPORT
594 echo -n "EMAIL FROM: "
595 read IPFIRE_MAIL_FROM
596 echo -n "EMAIL SERVER: "
597 read IPFIRE_MAIL_SERVER
598 echo -n "LOGIN TO MAIL SERVER: "
599 read IPFIRE_MAIL_USER
600 echo -n "MAIL PASSWORD: "
601 read -s IPFIRE_MAIL_PASS
602 echo -n "Saving..."
603 cat <<END > .config
604### ISO server
605IPFIRE_FTP_URL_EXT=$IPFIRE_FTP_URL_EXT
606IPFIRE_FTP_PATH_EXT=$IPFIRE_FTP_PATH_EXT
607IPFIRE_FTP_USER_EXT=$IPFIRE_FTP_USER_EXT
608IPFIRE_FTP_PASS_EXT=$IPFIRE_FTP_PASS_EXT
609### cache server
610IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_INT
611IPFIRE_FTP_PATH_INT=$IPFIRE_FTP_PATH_INT
612IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_INT
613IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_INT
614### paks server
615IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_PAK
616IPFIRE_FTP_PATH_PAK=$IPFIRE_FTP_PATH_PAK
617IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_PAK
618IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_PAK
619### mail reports
620IPFIRE_MAIL_REPORT=$IPFIRE_MAIL_REPORT
621IPFIRE_MAIL_FROM=$IPFIRE_MAIL_FROM
622IPFIRE_MAIL_SERVER=$IPFIRE_MAIL_SERVER
623IPFIRE_MAIL_USER=$IPFIRE_MAIL_USER
624IPFIRE_MAIL_PASS=$IPFIRE_MAIL_PASS
625END
626 beautify message DONE
627}