urtware / tools / ide / idesetup.sh @ 5c6cb22f
History | View | Annotate | Download (6.201 KB)
1 | 1fb06240 | skenneweg | ################################################################################ |
---|---|---|---|
2 | # AMiRo-uRtWare is a collection of applications and configurations for the # |
||
3 | # Autonomous Mini Robot (AMiRo). # |
||
4 | # Copyright (C) 2018..2020 Thomas Schöpping et al. # |
||
5 | # # |
||
6 | # This program is free software: you can redistribute it and/or modify # |
||
7 | # it under the terms of the GNU General Public License as published by # |
||
8 | # the Free Software Foundation, either version 3 of the License, or # |
||
9 | # (at your option) any later version. # |
||
10 | # # |
||
11 | # This program is distributed in the hope that it will be useful, # |
||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
||
14 | # GNU General Public License for more details. # |
||
15 | # # |
||
16 | # You should have received a copy of the GNU General Public License # |
||
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # |
||
18 | # # |
||
19 | # This research/work was supported by the Cluster of Excellence Cognitive # |
||
20 | # Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is # |
||
21 | # funded by the German Research Foundation (DFG). # |
||
22 | ################################################################################ |
||
23 | |||
24 | #!/bin/bash |
||
25 | |||
26 | # load library |
||
27 | source "$(dirname ${BASH_SOURCE[0]})/../bash/setuplib.sh" |
||
28 | |||
29 | ### print welcome text ######################################################### |
||
30 | # Prints a welcome message to standard out. |
||
31 | # |
||
32 | # usage: printWelcomeText |
||
33 | # arguments: n/a |
||
34 | # return: n/a |
||
35 | # |
||
36 | function printWelcomeText { |
||
37 | printf "######################################################################\n" |
||
38 | printf "# #\n" |
||
39 | printf "# Welcome to the AMiRo-uRtWare IDE setup! #\n" |
||
40 | printf "# #\n" |
||
41 | printf "######################################################################\n" |
||
42 | printf "# #\n" |
||
43 | printf "# Copyright (c) 2018..2020 Thomas Schöpping #\n" |
||
44 | printf "# #\n" |
||
45 | printf "# This is free software; see the source for copying conditions. #\n" |
||
46 | printf "# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR #\n" |
||
47 | printf "# A PARTICULAR PURPOSE. The development of this software was #\n" |
||
48 | printf "# supported by the Excellence Cluster EXC 227 Cognitive Interaction #\n" |
||
49 | printf "# Technology. The Excellence Cluster EXC 227 is a grant of the #\n" |
||
50 | printf "# Deutsche Forschungsgemeinschaft (DFG) in the context of the German #\n" |
||
51 | printf "# Excellence Initiative. #\n" |
||
52 | printf "# #\n" |
||
53 | printf "######################################################################\n" |
||
54 | } |
||
55 | |||
56 | ### print help ################################################################# |
||
57 | # Prints a help text to standard out. |
||
58 | # |
||
59 | # usage: printHelp |
||
60 | # arguments: n/a |
||
61 | # return: n/a |
||
62 | # |
||
63 | function printHelp { |
||
64 | printInfo "printing help text\n" |
||
65 | printf "usage: $(basename ${BASH_SOURCE[0]}) [-h|--help] [--QtCreator] [-q|--quit]\n" |
||
66 | printf "\n" |
||
67 | printf "options: -h, --help\n" |
||
68 | printf " Print this help text.\n" |
||
69 | printf " --QtCreator\n" |
||
70 | printf " Enter QtCreator setup.\n" |
||
71 | printf " -q, --quit\n" |
||
72 | printf " Quit the script.\n" |
||
73 | } |
||
74 | |||
75 | ### enter QtCreator setup ###################################################### |
||
76 | # Enter the QtCreator IDE setup. |
||
77 | # |
||
78 | # usage: qtCreatorSetup |
||
79 | # arguments: n/a |
||
80 | # return: n/a |
||
81 | function qtCreatorSetup { |
||
82 | printInfo "entering QtCreator setup...\n" |
||
83 | $(realpath $(dirname ${BASH_SOURCE[0]}))/QtCreator/QtCreatorSetup.sh |
||
84 | } |
||
85 | |||
86 | ### main function of this script ############################################### |
||
87 | # The IDE setup lets the user select an IDE of choice. |
||
88 | # As of now, only QtCreator is supported. |
||
89 | # |
||
90 | # usage: see function printHelp |
||
91 | # arguments: see function printHelp |
||
92 | # return: 0 |
||
93 | # No error or warning occurred. |
||
94 | # |
||
95 | function main { |
||
96 | # print welcome/info text if not suppressed |
||
97 | printWelcomeText |
||
98 | printf "\n" |
||
99 | |||
100 | # if --help or -h was specified, print the help text and exit |
||
101 | if [[ $@ == *"--help"* || $@ == *"-h"* ]]; then |
||
102 | printHelp |
||
103 | printf "\n" |
||
104 | quitScript |
||
105 | fi |
||
106 | |||
107 | # parse arguments |
||
108 | local otherargs=() |
||
109 | while [ $# -gt 0 ]; do |
||
110 | if ( parseIsOption $1 ); then |
||
111 | case "$1" in |
||
112 | -h|--help) # already handled; ignore |
||
113 | shift 1;; |
||
114 | --QtCreator) |
||
115 | qtCreatorSetup; printf "\n"; shift 1;; |
||
116 | -q|--quit) |
||
117 | quitScript; printf "\n"; shift 1;; |
||
118 | *) |
||
119 | printError "invalid option: $1\n"; shift 1;; |
||
120 | esac |
||
121 | else |
||
122 | otherargs+=("$1") |
||
123 | shift 1 |
||
124 | fi |
||
125 | done |
||
126 | |||
127 | # interactive menu |
||
128 | while ( true ); do |
||
129 | # main menu info prompt and selection |
||
130 | printInfo "AMiRo-OS IDE setup main menu\n" |
||
131 | printf "Please select one of the following actions:\n" |
||
132 | printf " [C] - enter QtCreator setup\n" |
||
133 | printf " [Q] - quit this setup\n" |
||
134 | local userinput="" |
||
135 | readUserInput "CcQq" userinput |
||
136 | printf "\n" |
||
137 | |||
138 | # evaluate user selection |
||
139 | case "$userinput" in |
||
140 | C|c) |
||
141 | qtCreatorSetup; printf "\n";; |
||
142 | Q|q) |
||
143 | quitScript;; |
||
144 | *) # sanity check (exit with error) |
||
145 | printError "unexpected argument: $userinput\n";; |
||
146 | esac |
||
147 | done |
||
148 | |||
149 | exit 0 |
||
150 | } |
||
151 | |||
152 | ################################################################################ |
||
153 | # SCRIPT ENTRY POINT # |
||
154 | ################################################################################ |
||
155 | |||
156 | main "$@" |