diff options
Diffstat (limited to 'meta/recipes-devtools/installer/adt-installer/scripts/util')
-rw-r--r-- | meta/recipes-devtools/installer/adt-installer/scripts/util | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/util b/meta/recipes-devtools/installer/adt-installer/scripts/util new file mode 100644 index 0000000000..4b88feea5a --- /dev/null +++ b/meta/recipes-devtools/installer/adt-installer/scripts/util | |||
@@ -0,0 +1,104 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Yocto ADT Installer | ||
4 | # | ||
5 | # Copyright 2010-2011 by Intel Corp. | ||
6 | # | ||
7 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
8 | # of this software and associated documentation files (the "Software"), to deal | ||
9 | # in the Software without restriction, including without limitation the rights | ||
10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
11 | # copies of the Software, and to permit persons to whom the Software is | ||
12 | # furnished to do so, subject to the following conditions: | ||
13 | |||
14 | # The above copyright notice and this permission notice shall be included in | ||
15 | # all copies or substantial portions of the Software. | ||
16 | |||
17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
23 | # THE SOFTWARE. | ||
24 | |||
25 | echo_info() | ||
26 | { | ||
27 | echo -e $1 | tee -a $YOCTOADT_INSTALL_LOG_FILE | ||
28 | } | ||
29 | |||
30 | select_install_type() | ||
31 | { | ||
32 | # If choosing silent install, all older installation data will be | ||
33 | # overriden without user's interaction | ||
34 | while true; do | ||
35 | #echo_info "[ADT_INST] Silent install means overrides all existing older" | ||
36 | #echo_info "[ADT_INST] data and the installation needs least user interaction" | ||
37 | #echo_info "[ADT_INST] If you want to use silent installation, please enter S:" | ||
38 | #echo_info "[ADT_INST] If you want to customize installation, please enter C:" | ||
39 | #echo_info "[ADT_INST} If you want to exit current installation, please enter X:" | ||
40 | echo_info "There're two ways you can do installation: silent mode or interactive mode. To choose silent mode, which means you opt for the system to override the existing data under the specified installation directories without prompting for your confirmation. Please be cautious with this selection which may trigger your losing data. With the interactive mode, you have to closely monitor the installation process, since it will prompt you each step it needs to override some existing data. To choose silent mode, please enter [S], for interactive mode, please enter [I] or [X] to exit the installation." | ||
41 | echo_info "[ADT_INST] Please enter your selections here:" | ||
42 | read YOCTOADT_SEL | ||
43 | YOCTOADT_SEL=`tr '[a-z]' '[A-Z]'<<<"$YOCTOADT_SEL"` | ||
44 | if [ "$YOCTOADT_SEL" == "S" ]; then | ||
45 | return "0" | ||
46 | elif [ "$YOCTOADT_SEL" == "I" ]; then | ||
47 | return "1" | ||
48 | elif [ "$YOCTOADT_SEL" == "X" ]; then | ||
49 | echo_info "\n############################################################" | ||
50 | echo_info "# User cancelled installation!" | ||
51 | echo_info "############################################################\n" | ||
52 | exit 1 | ||
53 | fi | ||
54 | done | ||
55 | |||
56 | |||
57 | } | ||
58 | |||
59 | confirm_install() | ||
60 | { | ||
61 | # below are prompt, make sure user still want to install even meet | ||
62 | # some prompts | ||
63 | |||
64 | #User likes to enjoy silent installation, we will not break his | ||
65 | #installation process here | ||
66 | if [ "$1" == "0" ]; then | ||
67 | return | ||
68 | fi | ||
69 | |||
70 | while true; do | ||
71 | echo_info "[ADT_INST] Do you want to continue installation? Please enter Y/N:" | ||
72 | read YOCTOADT_INSTALL | ||
73 | YOCTOADT_INSTALL=`tr '[a-z]' '[A-Z]'<<<"$YOCTOADT_INSTALL"` | ||
74 | if [ "$YOCTOADT_INSTALL" == "Y" ]; then | ||
75 | break | ||
76 | elif [ "$YOCTOADT_INSTALL" == "N" ]; then | ||
77 | echo_info "\n############################################################" | ||
78 | echo_info "# User cancelled installation!" | ||
79 | echo_info "############################################################\n" | ||
80 | exit 1 | ||
81 | fi | ||
82 | done | ||
83 | } | ||
84 | |||
85 | check_result() | ||
86 | { | ||
87 | result="$?" | ||
88 | if [ "$result" == "-1" ]; then | ||
89 | echo_info "\n#############################################################################" | ||
90 | echo_info "# Meet error(s) when installing Yocto ADT! Please check log file for details. " | ||
91 | echo_info "#############################################################################\n" | ||
92 | exit -1 | ||
93 | elif [ "$result" == "1" ]; then | ||
94 | exit -1 | ||
95 | fi | ||
96 | } | ||
97 | |||
98 | # yocto adt installation log file | ||
99 | YOCTOADT_INSTALL_LOG_FILE="adt_installer.log" | ||
100 | # Temp folders holding qemu/rootfs downloaded images | ||
101 | # It will be put into the installation folder | ||
102 | LOCAL_DOWNLOAD="./download_image" | ||
103 | |||
104 | |||