Magellan Linux

Contents of /trunk/installer/include/bootstrap-wrapper.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1063 - (show annotations) (download) (as text)
Mon May 31 21:03:18 2010 UTC (13 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1934 byte(s)
-pipe everything to INSTALLER_LOG

1 #!/bin/sh
2 # $Id$
3
4 source /etc/installer.conf
5
6 convert_to_message()
7 {
8 # only für ncurses gui
9 [[ ${GUITYPE} != ncurses ]] && return 0
10
11 local method="$1"
12 local message
13 local pkg
14
15 if [[ ${method} = --install ]]
16 then
17 pkg=$(echo "${@#$1}" | sed 's/.*:\ .*\/\(.*\).*/\1/')
18 else
19 pkg=$(echo "${@#$1}" | sed 's/.*:\ \(.*\).mpk.*/\1/;s/\//\ /g')
20 fi
21
22 case ${method} in
23 --fetch) message="Fetching ${pkg}..." ;;
24 --unpack) message="Decompressing ${pkg}..." ;;
25 --install) message="Installing ${pkg}..." ;;
26 esac
27 echo -en "\nXXX\n${message}\nXXX\n"
28 }
29
30 convert_to_percent()
31 {
32 local percent
33 # never get 100% here, we define it our self or the dialogbox closes unwilingly
34 percent=$(echo "$@" | sed 's/.*(\(.*\)).*/\1/;s/\//\ /g' | awk '{print ($1 / $2 * 100) - 1}')
35 if [[ ${GUITYPE} = ncurses ]]
36 then
37 # no floats in ncurses gui possible
38 printf %.0f "${percent}"
39 else
40 echo "${percent}"
41 fi
42 }
43
44 wrapper()
45 {
46 local action="$1"
47 local line
48
49 ${action} | while read line
50 do
51 # add an entry to install log
52 echo "${line}" >> ${INSTALLER_LOG}
53
54 case $line in
55 #*fetching*:*|*!fetch*|*fetch\ complete*) convert_to_message --fetch ${line}; convert_to_percent ${line};;
56 #*unpacking*:*|*!unpack*) convert_to_message --unpack ${line}; convert_to_percent ${line};;
57 #*installing*:*) convert_to_message --install ${line}; convert_to_percent ${line};;
58 *fetching*:*) convert_to_message --fetch ${line}; convert_to_percent ${line};;
59 *unpacking*:*) convert_to_message --unpack ${line}; convert_to_percent ${line};;
60 *installing*:*) convert_to_message --install ${line}; convert_to_percent ${line};;
61 *) [[ ${DEBUG} = true ]] && echo "${line}" ;;
62 esac
63 done
64
65 # 100% here, close the dialog
66 echo "100"
67 }
68
69 install_stage()
70 {
71 # redirect stderr to stdout!
72 NOCOLORS=true bootstrap-default-system 2>&1
73 }
74
75 case $1 in
76 --ncurses) GUITYPE="ncurses" ;;
77 --gtk) GUITYPE="gtk" ;;
78 *) GUITYPE="gtk" ;;
79 esac
80 wrapper install_stage

Properties

Name Value
svn:executable *