-
Notifications
You must be signed in to change notification settings - Fork 1
/
initmain.sh
executable file
·64 lines (55 loc) · 2.33 KB
/
initmain.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Copyright (C) 2024 Raven Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# #***************************************************************************#
# * *
# * *** Project Init Main Script *** *
# * *
# #***************************************************************************#
#
# This is the entry point for the Project Init system. It implements the
# main function, which will be called when executing this script.
# This script file depends on the global functions and variables defined
# in the 'libinit.sh' and 'libform.sh' files.
#
# The developer documentation is available on GitHub:
# https://github.com/raven-computing/project-init/wiki
#
# Please consult the docs for further information on the Init System and
# the provided APIs. The system and its behaviour is customizable by
# an add-on mechanism without having to change the core code of the system.
function main() {
# Get the path to the directory of this script to make it call site independent
local libpath="";
libpath="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)";
# Load core libraries
source "${libpath}/libinit.sh";
source "${libpath}/libform.sh";
# Make sure this script is not executed by the root user
if (( $(id -u) == 0 )); then
logW "There is no need for this program to be executed by the root user.";
logW "Please use a regular user instead";
return $EXIT_FAILURE;
fi
project_init_start "$@";
if [[ $PROJECT_INIT_QUICKSTART_REQUESTED == true ]]; then
project_init_process_quickstart;
else
project_init_show_main_form;
proceed_next_level "$FORM_MAIN_NEXT_DIR";
fi
project_init_finish;
return $?;
}
main "$@";