Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1063 - (hide 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 niro 773 #!/bin/sh
2 niro 1017 # $Id$
3 niro 773
4 niro 1063 source /etc/installer.conf
5    
6 niro 1017 convert_to_message()
7     {
8     # only für ncurses gui
9     [[ ${GUITYPE} != ncurses ]] && return 0
10 niro 773
11 niro 1017 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 niro 773 convert_to_percent()
31     {
32 niro 1017 local percent
33 niro 773 # never get 100% here, we define it our self or the dialogbox closes unwilingly
34 niro 1017 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 niro 773 }
43    
44     wrapper()
45     {
46     local action="$1"
47     local line
48    
49     ${action} | while read line
50     do
51 niro 1063 # add an entry to install log
52     echo "${line}" >> ${INSTALLER_LOG}
53    
54 niro 773 case $line in
55 niro 1017 #*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 niro 773 *) [[ ${DEBUG} = true ]] && echo "${line}" ;;
62     esac
63     done
64    
65     # 100% here, close the dialog
66     echo "100"
67     }
68    
69 niro 1017 install_stage()
70 niro 773 {
71 niro 1063 # redirect stderr to stdout!
72     NOCOLORS=true bootstrap-default-system 2>&1
73 niro 773 }
74    
75 niro 1017 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 *