Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1017 - (show annotations) (download) (as text)
Sun May 30 17:36:22 2010 UTC (13 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1814 byte(s)
-fixed header
-cleanups
-added support for different guitypes and variable status messages

1 #!/bin/sh
2 # $Id$
3
4 convert_to_message()
5 {
6 # only für ncurses gui
7 [[ ${GUITYPE} != ncurses ]] && return 0
8
9 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 convert_to_percent()
29 {
30 local percent
31 # never get 100% here, we define it our self or the dialogbox closes unwilingly
32 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 }
41
42 wrapper()
43 {
44 local action="$1"
45 local line
46
47 ${action} | while read line
48 do
49 case $line in
50 #*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 *) [[ ${DEBUG} = true ]] && echo "${line}" ;;
57 esac
58 done
59
60 # 100% here, close the dialog
61 echo "100"
62 }
63
64 install_stage()
65 {
66 NOCOLORS=true bootstrap-default-system 2> /dev/null
67 }
68
69 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 *