]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - tools/make-functions
Removed also the pata mkinitcpio hook if install on hda
[people/pmueller/ipfire-2.x.git] / tools / make-functions
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21 ###############################################################################
22 #
23 # Beautifying variables & presentation & input output interface
24 #
25 ###############################################################################
26
27 ## Screen Dimentions
28 # Find current screen size
29 if [ -z "${COLUMNS}" ]; then
30 COLUMNS=$(stty size)
31 COLUMNS=${COLUMNS##* }
32 fi
33
34 # When using remote connections, such as a serial port, stty size returns 0
35 if [ "${COLUMNS}" = "0" ]; then
36 COLUMNS=80
37 fi
38
39 ## Measurements for positioning result messages
40 RESULT_WIDTH=4
41 TIME_WIDTH=8
42 OPT_WIDTH=6
43 VER_WIDTH=10
44 RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
45 TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
46 OPT_COL=$((${TIME_COL} - $OPT_WIDTH - 5))
47 VER_COL=$((${OPT_COL} - $VER_WIDTH - 5))
48
49 ## Set Cursur Position Commands, used via echo -e
50 SET_RESULT_COL="\\033[${RESULT_COL}G"
51 SET_TIME_COL="\\033[${TIME_COL}G"
52 SET_OPT_COL="\\033[${OPT_COL}G"
53 SET_VER_COL="\\033[${VER_COL}G"
54
55 # Define color for messages
56 BOLD="\\033[1;39m"
57 DONE="\\033[1;32m"
58 SKIP="\\033[1;34m"
59 WARN="\\033[1;35m"
60 FAIL="\\033[1;31m"
61 NORMAL="\\033[0;39m"
62
63 evaluate() {
64 if [ "$?" -eq "0" ]; then
65 beautify message DONE
66 else
67 EXITCODE=$1
68 shift 1
69 beautify message FAIL
70 $*
71 if [ $EXITCODE -ne "0" ]; then
72 exit $EXITCODE
73 fi
74 fi
75 }
76
77 position_cursor()
78 {
79 # ARG1=starting position on screen
80 # ARG2=string to be printed
81 # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
82 # For example if your starting position is column 50 and you want to print Hello three columns to the right
83 # of your starting position, your call will look like this:
84 # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
85 # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
86 # your call will look like this:
87 # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
88 # If you want to start printing at the exact starting location, use offset 0
89
90 START=$1
91 STRING=$2
92 OFFSET=$3
93
94 STRING_LENGTH=${#STRING}
95
96 if [ ${OFFSET} -lt 0 ]; then
97 COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
98 else
99 COL=$((${START} + ${OFFSET}))
100 fi
101
102 SET_COL="\\033[${COL}G"
103
104 echo $SET_COL
105 } # End of position_cursor()
106
107
108 beautify()
109 {
110 # Commands: build_stage, make_pkg, message, result
111 case "$1" in
112 message)
113 case "$2" in
114 DONE)
115 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
116 ;;
117 WARN)
118 echo -ne "${WARN}${3}${NORMAL}${SET_RESULT_COL}[${WARN} WARN ${NORMAL}]\n"
119 ;;
120 FAIL)
121 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
122 ;;
123 SKIP)
124 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
125 ;;
126 esac
127 ;;
128 build_stage)
129 MESSAGE=$2
130 if [ "$STAGE_TIME_START" ]; then
131 LAST_STAGE_TIME=$[ `date +%s` - $STAGE_TIME_START ]
132 fi
133 STAGE_TIME_START=`date +%s`
134 echo -ne "${BOLD}*** ${MESSAGE}${NORMAL}"
135 if [ "$LAST_STAGE_TIME" ]; then
136 echo -ne "${DONE} (Last stage took $LAST_STAGE_TIME secs)${NORMAL}"
137 fi
138 echo -ne "${BOLD}${SET_VER_COL} version${SET_OPT_COL} options${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
139 ;;
140 build_start)
141 BUILD_TIME_START=`date +%s`
142 ;;
143 build_end)
144 BUILD_TIME_END=`date +%s`
145 echo -ne "${DONE}***Build is finished now and took $[ $BUILD_TIME_END - $BUILD_TIME_START ] secs!${NORMAL}\n"
146 ;;
147 make_pkg)
148 echo "$2" | while read PKG_VER PROGRAM OPTIONS
149 do
150 SET_VER_COL_REAL=`position_cursor $OPT_COL $PKG_VER -3`
151
152 if [ "$OPTIONS" == "" ]; then
153 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
154 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
155 else
156 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
157 echo -ne "${NORMAL} ]${SET_OPT_COL}[ ${BOLD}${OPTIONS}"
158 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
159 fi
160 done
161 ;;
162 result)
163 RESULT=$2
164
165 if [ ! $3 ]; then
166 PKG_TIME=0
167 else
168 PKG_TIME=$3
169 fi
170
171 SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
172 case "$RESULT" in
173 DONE)
174 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
175 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
176 ;;
177 FAIL)
178 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
179 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
180 ;;
181 SKIP)
182 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
183 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
184 ;;
185 esac
186 ;;
187 esac
188 } # End of beautify()
189
190
191 get_pkg_ver()
192 {
193 PKG_VER=`grep ^VER $1 | awk '{print $3}'`
194
195 if [ -z $PKG_VER ]; then
196 PKG_VER=`grep "Exp " $1 | awk '{print $4}'`
197 fi
198
199 if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
200 # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
201 # and replace enough characters to fit the resulting string on the screen. We'll replace
202 # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
203 # Example: if we have a 21-long version number that we want to fit into a 10-long space,
204 # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
205 # end up with a 12-character long string. That's why we replace 12 characters with ..
206 REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
207 PKG_VER=`echo ${PKG_VER/$REMOVE/..}`
208 fi
209
210 echo "$PKG_VER"
211 } # End of get_pkg_ver()
212
213 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE ]; then
214 echo "`date -u '+%b %e %T'`: Machine is iX86 (or equivalent)" >> $LOGFILE
215 MACHINE=i586
216 BUILDTARGET=i586-pc-linux-gnu
217 CFLAGS="-O2 -march=i586 -pipe -fomit-frame-pointer"
218 CXXFLAGS="-O2 -march=i586 -pipe -fomit-frame-pointer"
219 C2FLAGS="-O2 -march=i586 -mtune=i586 -pipe -fomit-frame-pointer"
220 CXX2FLAGS="-O2 -march=i586 -mtune=i586 -pipe -fomit-frame-pointer"
221 else
222 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
223 exit 1
224 fi
225
226 # Define immediately
227 stdumount() {
228 umount $BASEDIR/build/sys 2>/dev/null;
229 umount $BASEDIR/build/dev/shm 2>/dev/null;
230 umount $BASEDIR/build/dev/pts 2>/dev/null;
231 umount $BASEDIR/build/dev 2>/dev/null;
232 umount $BASEDIR/build/proc 2>/dev/null;
233 umount $BASEDIR/build/install/mnt 2>/dev/null;
234 umount $BASEDIR/build/usr/src/cache 2>/dev/null;
235 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;
236 umount $BASEDIR/build/usr/src/config 2>/dev/null;
237 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
238 umount $BASEDIR/build/usr/src/html 2>/dev/null;
239 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
240 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;
241 umount $BASEDIR/build/usr/src/log 2>/dev/null;
242 umount $BASEDIR/build/usr/src/src 2>/dev/null;
243 }
244
245 exiterror() {
246 stdumount
247 for i in `seq 0 7`; do
248 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
249 losetup -d /dev/loop${i} 2>/dev/null
250 fi;
251 done
252 echo -e "\nERROR: $*"
253 echo " Check $LOGFILE for errors if applicable"
254 exit 1
255 }
256
257 entershell() {
258 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
259 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
260 fi
261 echo "Entering to a shell inside LFS chroot, go out with exit"
262 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
263 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
264 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
265 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
266 CFLAGS="$CF2LAGS" CXXFLAGS="$CXX2FLAGS" \
267 CCACHE_DIR=/usr/src/ccache \
268 CCACHE_HASHDIR=1 \
269 KVER=$KVER \
270 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
271 KGCC="ccache /usr/bin/gcc" \
272 /tools/bin/bash
273 if [ $? -ne 0 ]; then
274 beautify message FAIL
275 exiterror "chroot error"
276 else
277 stdumount
278 fi
279 }
280
281 ############################################################################
282 # #
283 # Necessary shell functions #
284 # #
285 ############################################################################
286 #
287 # Common checking before entering the chroot and compilling
288 #
289 # Return:0 caller can continue
290 # :1 skip (nothing to do)
291 # or fail if no script file found
292 #
293 lfsmakecommoncheck()
294 {
295 # Script present?
296 if [ ! -f $BASEDIR/lfs/$1 ]; then
297 exiterror "No such file or directory: $BASEDIR/$1"
298 fi
299
300 local PKG_VER=`get_pkg_ver $BASEDIR/lfs/$1`
301 beautify make_pkg "$PKG_VER $*"
302
303 # Script slipped?
304 local i
305 for i in $SKIP_PACKAGE_LIST
306 do
307 if [ "$i" == "$1" ]; then
308 beautify result SKIP
309 return 1;
310 fi
311 done
312
313 echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
314
315 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
316 if [ $? -ne 0 ]; then
317 exiterror "Download error in $1"
318 fi
319
320 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
321 if [ $? -ne 0 ]; then
322 exiterror "md5sum error in $1, check file in cache or signature"
323 fi
324
325 return 0 # pass all!
326 } # End of lfsmakecommoncheck()
327
328 lfsmake1() {
329 lfsmakecommoncheck $*
330 [ $? == 1 ] && return 0
331
332 local PKG_TIME_START=`date +%s`
333
334 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
335 MACHINE=$MACHINE \
336 LFS_BASEDIR=$BASEDIR \
337 ROOT=$LFS \
338 KVER=$KVER \
339 MAKETUNING=$MAKETUNING \
340 install >> $LOGFILE 2>&1
341 local COMPILE_SUCCESS=$?
342 local PKG_TIME_END=`date +%s`
343
344 if [ $COMPILE_SUCCESS -ne 0 ]; then
345 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
346 exiterror "Building $*";
347 else
348 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
349 fi
350
351 return 0
352 }
353
354 lfsmake2() {
355 lfsmakecommoncheck $*
356 [ $? == 1 ] && return 0
357
358 local PKG_TIME_START=`date +%s`
359 chroot $LFS /tools/bin/env -i HOME=/root \
360 TERM=$TERM PS1='\u:\w\$ ' \
361 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
362 VERSION=$VERSION \
363 CONFIG_ROOT=$CONFIG_ROOT \
364 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
365 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
366 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
367 KVER=$KVER MAKETUNING=$MAKETUNING \
368 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
369 IPFVER="$IPFVER" \
370 /tools/bin/bash -x -c "cd /usr/src/lfs && \
371 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
372 local COMPILE_SUCCESS=$?
373 local PKG_TIME_END=`date +%s`
374
375 if [ $COMPILE_SUCCESS -ne 0 ]; then
376 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
377 exiterror "Building $*";
378 else
379 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
380 fi
381
382 return 0
383 }
384
385 ipfiremake() {
386 lfsmakecommoncheck $*
387 [ $? == 1 ] && return 0
388
389 local PKG_TIME_START=`date +%s`
390 chroot $LFS /tools/bin/env -i HOME=/root \
391 TERM=$TERM PS1='\u:\w\$ ' \
392 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
393 VERSION=$VERSION \
394 CONFIG_ROOT=$CONFIG_ROOT \
395 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
396 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
397 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
398 KVER=$KVER MAKETUNING=$MAKETUNING \
399 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
400 IPFVER="$IPFVER" \
401 /bin/bash -x -c "cd /usr/src/lfs && \
402 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
403
404 local COMPILE_SUCCESS=$?
405 local PKG_TIME_END=`date +%s`
406
407 if [ $COMPILE_SUCCESS -ne 0 ]; then
408 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
409 exiterror "Building $*";
410 else
411 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
412 fi
413 return 0
414 }
415
416 ipfiredist() {
417 lfsmakecommoncheck $*
418 [ $? == 1 ] && return 0
419
420 local PKG_TIME_START=`date +%s`
421 chroot $LFS /tools/bin/env -i HOME=/root \
422 TERM=$TERM PS1='\u:\w\$ ' \
423 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
424 VERSION=$VERSION \
425 CONFIG_ROOT=$CONFIG_ROOT \
426 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
427 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
428 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
429 KVER=$KVER IPFVER="$IPFVER" \
430 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
431 /bin/bash -x -c "cd /usr/src/lfs && \
432 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
433
434 local COMPILE_SUCCESS=$?
435 local PKG_TIME_END=`date +%s`
436
437 if [ $COMPILE_SUCCESS -ne 0 ]; then
438 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
439 exiterror "Packaging $*";
440 else
441 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
442 fi
443 return 0
444 }
445
446 installmake() {
447 lfsmakecommoncheck $*
448 [ $? == 1 ] && return 0
449
450 local PKG_TIME_START=`date +%s`
451 chroot $LFS /tools/bin/env -i HOME=/root \
452 TERM=$TERM PS1='\u:\w\$ ' \
453 PATH=/opt/i586-uClibc/i586-linux-uclibc/bin:/opt/i586-uClibc/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
454 VERSION=$VERSION \
455 CONFIG_ROOT=$CONFIG_ROOT \
456 LFS_PASS="install" \
457 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
458 CFLAGS="-Os" CXXFLAGS="-Os" \
459 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
460 KVER=$KVER IPFVER="$IPFVER" \
461 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
462 /bin/bash -x -c "cd /usr/src/lfs && \
463 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
464
465 local COMPILE_SUCCESS=$?
466 local PKG_TIME_END=`date +%s`
467
468 if [ $COMPILE_SUCCESS -ne 0 ]; then
469 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
470 exiterror "Building $*";
471 else
472 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
473 fi
474 return 0
475 }
476
477 update_logs() {
478 tar cfz log/ipfire-logs-`date +'%Y-%m-%d-%H:%M'`.tgz log/_build.*
479 rm -f log/_build.*
480 }
481
482 batch_script() {
483 echo -ne "${BOLD}***This is our auto buildscript! Have fun...${NORMAL}\n"
484 update_logs
485 evaluate 1
486
487 if [ "$IPFIRE_REBUILD" -eq "0" ]; then
488 export IPFIRE_START_TIME=`date`
489 evaluate 1
490
491 $0 git update
492 evaluate 1 mail_me UPDATE
493
494 echo "### EXPORT SOURCES"
495 $0 git dist
496 evaluate 1 mail_me DIST
497 fi
498
499 echo "### RUNNING BUILD"
500 $0 build
501 evaluate 1 mail_me ERROR
502
503 echo "### UPLOADING ISO"
504 $0 upload iso
505 evaluate 1 mail_me ISO
506
507 echo -ne "### UPLOADING PAKS"
508 $0 upload paks
509 evaluate 1 mail_me PAKS
510
511 echo -ne "${BOLD}***SUCCESS!${NORMAL}"
512 mail_me success
513 exit 0
514 }
515
516 watch_screen() {
517 echo -e "${BOLD}Exit with Ctrl+A, Ctrl+D.${NORMAL}"
518 sleep 0.5
519 screen -x ipfire
520 }
521
522 mail_me() {
523 echo "From: $MAIL_FROM" > /tmp/ipfire_mail_body.$$
524 echo "To: $MAIL_TO" >> /tmp/ipfire_mail_body.$$
525 case "$1" in
526 success)
527 cat <<END >> /tmp/ipfire_mail_body.$$
528 Subject: SUCCESS: IPFIRE-BUILD on `hostname`
529 Building IPFire on `hostname` was successfull!
530 You can find the ISO on your ftp server if you told the script where it is.
531
532 Statistics:
533 -----------
534 Started: $IPFIRE_START_TIME
535 Finished: `date`
536
537 Best Regards
538 Your IPFire-Build-Script
539
540 END
541 echo -ne "${BOLD}***Sending success message${NORMAL}"
542 ;;
543 *)
544 cat <<END >> /tmp/ipfire_mail_body.$$
545 Subject: ERROR $1: IPFIRE-BUILD on `hostname`
546 When I was building IPFire on `hostname`, I have found an ERROR with name $1!
547 Here you can see the logs and detect the reason for this error.
548
549 Best Regards
550 Your IPFire-Build-Script
551
552
553 Here is a summary... The full logs are in the attachment.
554 ---------------------------------------------------------
555
556 `tail log/_*`
557 END
558 echo -ne "${BOLD}***Sending error message${NORMAL}"
559 ;;
560 esac
561
562 sleep 15
563 python tools/sendEmail < /tmp/ipfire_mail_body.$$
564 if [ "$?" -eq "0" ]; then
565 beautify message DONE
566 else
567 beautify message FAIL
568 fi
569 rm -f /tmp/ipfire_mail_body.$$
570 }
571
572 make_config() {
573 clear
574 echo -e "${BOLD}***This will create your configuration...${NORMAL}"
575 echo -ne "***If your are ready press <ENTER>!"
576 read
577 clear
578 echo -ne "***The buildscript will create a full iso image.\n"
579 echo -ne "***If you want to skip any package please enter its name here seperated with space.\n"
580 echo -ne "Actually in the list are: $SKIP_PACKAGE_LIST\n"
581 echo -ne "Do you want to change this? (y/N) "
582 read YESNO
583 if [ "$YESNO" == "y" ]; then
584 echo -ne "Please type: "
585 read SKIP_PACKAGE_LIST
586 echo -ne "You entered: $SKIP_PACKAGE_LIST\n"
587 fi
588
589 clear
590 echo -ne "***When you have compiled successfully, there is the possibility\n"
591 echo -ne "***to upload the iso image to a ftp server.\n"
592 echo -ne "***If the url is empty there will be no upload.\n"
593 echo -ne "Actually there is: $FTP_ISO_URL\n"
594 echo -ne "Do you want to change this? (y/N) "
595 read YESNO
596 if [ "$YESNO" == "y" ]; then
597 echo -ne "Please type the url: "
598 read FTP_ISO_URL
599 echo -ne "Please type the path: "
600 read FTP_ISO_PATH
601 echo -ne "Please type the username: "
602 read FTP_ISO_USER
603 echo -ne "Please type the password (hidden): "
604 read -s FTP_ISO_PASS
605
606 fi
607
608 clear
609 echo -ne "***When you add some new software you can easyly\n"
610 echo -ne "***upload the source code to our repository server.\n"
611 echo -ne "***If the url is empty there will be no upload.\n"
612 echo -ne "Actually there is: $FTP_CACHE_URL\n"
613 echo -ne "Do you want to change this? (y/N) "
614 read YESNO
615 if [ "$YESNO" == "y" ]; then
616 echo -ne "Please type the url: "
617 read FTP_CACHE_URL
618 echo -ne "Please type the path: "
619 read FTP_CACHE_PATH
620 echo -ne "Please type the username: "
621 read FTP_CACHE_USER
622 echo -ne "Please type the password (hidden): "
623 read -s FTP_CACHE_PASS
624
625 fi
626
627 clear
628 echo -ne "***If there are some important messages you\n"
629 echo -ne "***can get a notification mail.\n"
630 echo -ne "***Please type one ore more email adresses (seperated by comma).\n"
631 echo -ne "Actually there is: $MAIL_TO\n"
632 echo -ne "Do you want to change this? (y/N) "
633 read YESNO
634 if [ "$YESNO" == "y" ]; then
635 echo -ne "Please type: "
636 read MAIL_TO
637 echo -ne "You should enter a mail server to login...\n"
638 echo -ne "Please type the url: "
639 read MAIL_SERVER
640 echo -ne "Please type where the email is from: "
641 read MAIL_FROM
642 echo -ne "Please type the username: "
643 read MAIL_USER
644 echo -ne "Please type the password (hidden): "
645 read -s MAIL_PASS
646
647 fi
648 echo -ne "\n${BOLD}***Saving...${NORMAL}"
649 cat <<END > $BASEDIR/.config
650 ### iso server
651 FTP_ISO_URL=$FTP_ISO_URL
652 FTP_ISO_PATH=$FTP_ISO_PATH
653 FTP_ISO_USER=$FTP_ISO_USER
654 FTP_ISO_PASS=$FTP_ISO_PASS
655 ### cache server
656 FTP_CACHE_URL=$FTP_CACHE_URL
657 FTP_CACHE_PATH=$FTP_CACHE_PATH
658 FTP_CACHE_USER=$FTP_CACHE_USER
659 FTP_CACHE_PASS=$FTP_CACHE_PASS
660 ### mail reports
661 MAIL_TO="$MAIL_TO"
662 MAIL_FROM=$MAIL_FROM
663 MAIL_SERVER=$MAIL_SERVER
664 MAIL_USER=$MAIL_USER
665 MAIL_PASS=$MAIL_PASS
666 ### misc
667 SKIP_PACKAGE_LIST="$SKIP_PACKAGE_LIST"
668 END
669 beautify message DONE
670 }
671
672 compile_tftpd() {
673 mkdir $BASEDIR/tmp
674 tar xvfz $BASEDIR/cache/tftp-hpa-0.42.tar.gz -C $BASEDIR/tmp
675 cd $BASEDIR/tmp/tftp-hpa-*
676 ./configure --prefix=/ipfire/trunk/tools/ \
677 --sbindir=/ipfire/trunk/tools/ --disable-nls
678 make
679 install -c tftpd/tftpd $BASEDIR/tools/in.tftpd
680 cd -
681 rm -rf $BASEDIR/tmp/tftp-hpa-*
682 }
683
684 start_tftpd() {
685 if [ ! -e $BASEDIR/tools/in.tftpd ]; then
686 compile_tftpd
687 fi
688 reload_tftpd
689 if [ "$?" == "0" ]; then
690 $BASEDIR/tools/in.tftpd -l -s $BASEDIR/tftpboot
691 beautify message DONE
692 else
693 echo -en "You don not have a pxe boot image in your base directory.\nPlease compile first."
694 beautify message FAIL
695 exit 1
696 fi
697 }
698
699 stop_tftpd() {
700 echo -n "Stopping TFTPD..."
701 killall in.tftpd >/dev/null 2>&1
702 sleep 3
703 killall -9 in.tftp >/dev/null 2>&1
704 beautify message DONE
705 }
706
707 reload_tftpd() {
708 if [ -e $BASEDIR/ipfire-$VERSION.$MACHINE-pxe.tgz ]; then
709 mkdir -p $BASEDIR/tftpboot
710 tar xfz $BASEDIR/ipfire-$VERSION.$MACHINE-pxe.tgz -C $BASEDIR/tftpboot
711 return 0
712 fi
713 return 1
714 }
715
716 update_langs() {
717 echo -ne "Checking the translations for missing or obsolete strings..."
718 chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
719 $BASEDIR/tools/sort_strings.pl en
720 $BASEDIR/tools/sort_strings.pl de
721 $BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en
722 $BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de
723 $BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
724 beautify message DONE
725 }