Magellan Linux

Annotation of /tags/installer-0_1_2/include/bootstrap-wrapper.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1017 - (hide annotations) (download) (as text)
Sun May 30 17:36:22 2010 UTC (14 years ago) by niro
Original Path: trunk/installer/include/bootstrap-wrapper.sh
File MIME type: application/x-sh
File size: 1814 byte(s)
-fixed header
-cleanups
-added support for different guitypes and variable status messages

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

Properties

Name Value
svn:executable *