summaryrefslogtreecommitdiff
path: root/apps/installer/main.sh
blob: 44fc65efb009a2158409e640a1928da69b62c2aa (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash

CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$CURRENT_PATH/includes/includes.sh"

cmdopt=$1

while true
do
echo "=====     INSTALLER SCRIPT     ====="
PS3='Please enter your choice: '
options=(
    "First Installation" "Configure OS dep" "Update Repository" "Reset & Clean Repository"
    "Compile" "Clean & Compile" "Assemble & Import DB" "Module Search" "Module Install" "Module Update" "Module Remove"
    "Sub Menu >> Compiler" "Sub Menu >> DB Assembler"
    "Quit"
    )

function _switch() {
    case $1 in
        "First Installation")
            inst_allInOne
            ;;
        "Configure OS dep")
            inst_configureOS
            ;;
        "Update Repository")
            inst_updateRepo
            ;;
        "Reset & Clean Repository")
            inst_resetRepo
            ;;
        "Compile")
            inst_compile
            ;;
        "Clean & Compile")
            inst_cleanCompile
            ;;
        "Assemble & Import DB")
            inst_assembleDb
            ;;
        "Module Search")
            inst_module_search $2
            ;;
        "Module Install")
            inst_module_install $2
            ;;
        "Module Update")
            inst_module_update $2
            ;;
        "Module Remove")
            inst_module_remove $2
            ;;
        "Sub Menu >> Compiler")
            bash "$AC_PATH_APPS/compiler/compiler.sh"
            ;;
        "Sub Menu >> DB Assembler")
            bash "$AC_PATH_APPS/db_assembler/db_assembler.sh"
            ;;
        "Quit")
            echo "Goodbye!"
            exit
            ;;
        *) echo invalid option;;
    esac
}

# run option directly if specified in argument
[ ! -z $1 ] && _switch "${options[$cmdopt-1]}"
[ ! -z $1 ] && exit 0

select opt in "${options[@]}"
do
    _switch "$opt"
    break
done
done