-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathoda.sh
More file actions
executable file
·173 lines (148 loc) · 4.86 KB
/
oda.sh
File metadata and controls
executable file
·173 lines (148 loc) · 4.86 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
# Enable strict mode for better error handling
set -euo pipefail
trap 'error "Failed at line $LINENO. Exit code: $?"' ERR
# Source configuration and function files
source oda.conf
source setup_functions.sh
source install_functions.sh
# ODA Installer version
ODA_INSTALLER_VERSION="0.1.0"
# Initialize global variables
DISTRO=""
PACKAGE_MANAGER=""
INSTALL_CMD=""
UPDATE_CMD=""
HAS_GPU=false
VERBOSE=false
# Main function - Script entry point
main() {
# Print banner
echo -e "${BLUE}"
echo "╔═══════════════════════════════════════════╗"
echo "║ ODA Installer ║"
echo "║ On Device AI Development Setup ║"
echo "╚═══════════════════════════════════════════╝"
echo -e "${NC}"
# Display installer version
echo "ODA Installer version: $ODA_INSTALLER_VERSION"
echo ""
# Check if the script is run with any arguments
if [ $# -eq 0 ]; then
error "No arguments provided. Use -h or --help for usage information."
fi
# Parse command-line arguments
while getopts ":h-:" opt; do
case "$opt" in
h)
usage
exit 0
;;
-)
case "${OPTARG}" in
help)
usage
exit 0
;;
no-gpu)
HAS_GPU=false
;;
verbose)
VERBOSE=true
;;
*)
echo "Invalid option: --${OPTARG}" >&2
usage
exit 1
;;
esac
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit 1
;;
esac
done
shift $((OPTIND -1))
log "Starting ODA installation..."
# Validate system requirements
validate_system_requirements
# Detect user type
# Detect distribution
detect_distribution
# Setup package manager
setup_package_manager
# Interactive prompts for component selection
read -r -p "Install PyTorch? (y/N) " INSTALL_PYTORCH_PROMPT
if [[ "$INSTALL_PYTORCH_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_PYTORCH=true
else
INSTALL_PYTORCH=false
fi
read -r -p "Install TensorFlow? (y/N) " INSTALL_TENSORFLOW_PROMPT
if [[ "$INSTALL_TENSORFLOW_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_TENSORFLOW=true
else
INSTALL_TENSORFLOW=false
fi
read -r -p "Install TVM? (y/N) " INSTALL_TVM_PROMPT
if [[ "$INSTALL_TVM_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_TVM=true
else
INSTALL_TVM=false
fi
read -r -p "Install OpenVINO? (y/N) " INSTALL_OPEN_VINO_PROMPT
if [[ "$INSTALL_OPEN_VINO_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_OPEN_VINO=true
else
INSTALL_OPEN_VINO=false
fi
read -r -p "Install NCNN? (y/N) " INSTALL_NCNN_PROMPT
if [[ "$INSTALL_NCNN_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_NCNN=true
else
INSTALL_NCNN=false
fi
read -r -p "Install ArmNN? (y/N) " INSTALL_ARMNN_PROMPT
if [[ "$INSTALL_ARMNN_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_ARMNN=true
else
INSTALL_ARMNN=false
fi
read -r -p "Install llama.cpp? (y/N) " INSTALL_LLAMA_CPP_PROMPT
if [[ "$INSTALL_LLAMA_CPP_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_LLAMA_CPP=true
else
INSTALL_LLAMA_CPP=false
fi
read -r -p "Install VS Code? (y/N) " INSTALL_VSCODE_PROMPT
if [[ "$INSTALL_VSCODE_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_VSCODE=true
else
INSTALL_VSCODE=false
fi
read -r -p "Install ZSH? (y/N) " INSTALL_ZSH_PROMPT
if [[ "$INSTALL_ZSH_PROMPT" =~ ^[Yy]$ ]]; then
INSTALL_ZSH=true
else
INSTALL_ZSH=false
fi
# Call setup and installation functions
run_step "base" install_base_packages || return 1
run_step "python" install_python || return 1
run_step "python-env" setup_python_environment || return 1
if [ "$HAS_GPU" = true ]; then
run_step "nvidia" install_nvidia || return 1
fi
run_step "docker" setup_docker || return 1
run_step "dev-tools" setup_development_tools || return 1
run_step "ai-tools" setup_ai_tools || return 1
# Installation completed successfully
log "ODA installation completed successfully!"
echo -e "\nTo activate the Python environment, run: ${GREEN}source $VENV_DIR/bin/activate${NC}"
echo -e "To start using ZSH, run: ${GREEN}zsh${NC}"
echo -e "Installation log: $LOG_FILE"
}
# Execute the main function with command-line arguments
main "$@"