forked from ashtonjamesd/lavandula
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·164 lines (128 loc) · 3.7 KB
/
install.sh
File metadata and controls
executable file
·164 lines (128 loc) · 3.7 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
set -e
REPO="ashtonjamesd/lavandula"
INSTALL_DIR="/usr/local"
TMP_DIR="/tmp/lavandula-install"
LAVANDULA_LIB_DIR="/usr/local/lib/lavandula"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
command_exists() {
command -v "$1" >/dev/null 2>&1
}
check_dependencies() {
if ! command_exists gcc; then
log_error "GCC is required but not installed. Please install GCC first."
exit 1
fi
if ! command_exists make; then
log_error "make is required but not installed. Please install make first."
exit 1
fi
if ! command_exists git; then
log_error "git is required but not installed. Please install git first."
exit 1
fi
# temporary fix, does not work on MacOS currently
# if [ ! -f "/usr/include/sqlite3.h" ]; then
# log_error "Development tools for the sqlite3 is required but not installed. Please install sqlite3 devel first."
# exit 1
# fi
}
download_source() {
log_info "Downloading source code..."
rm -rf "$TMP_DIR"
mkdir -p "$TMP_DIR"
cd "$TMP_DIR"
git clone "https://github.com/${REPO}.git" .
log_success "Source code downloaded"
}
install_repository() {
log_info "Installing repository to ${LAVANDULA_LIB_DIR}..."
sudo mkdir -p "${LAVANDULA_LIB_DIR}"
sudo cp -r "$TMP_DIR/." "${LAVANDULA_LIB_DIR}/"
if [[ "$OSTYPE" == "darwin"* ]]; then
sudo chown -R root:wheel "${LAVANDULA_LIB_DIR}"
else
sudo chown -R root:root "${LAVANDULA_LIB_DIR}"
fi
sudo chmod -R 755 "${LAVANDULA_LIB_DIR}"
log_success "Repository installed to ${LAVANDULA_LIB_DIR}"
}
build_project() {
log_info "Building Lavandula..."
make
log_success "Build completed"
}
install_project() {
log_info "Installing Lavandula to ${INSTALL_DIR}..."
if [ ! -f build/lavu ]; then
log_error "Built binary 'lavu' not found. Build may have failed."
exit 1
fi
if [ ! -d "${INSTALL_DIR}/bin" ]; then
mkdir -p "${INSTALL_DIR}/bin"
fi
sudo cp build/lavu "${INSTALL_DIR}/bin/"
sudo chmod +x "${INSTALL_DIR}/bin/lavu"
log_success "Installation completed"
}
verify_installation() {
if command_exists lavu; then
log_success "Lavandula installed successfully!"
else
log_error "Lavandula installation failed."
exit 1
fi
}
cleanup() {
log_info "Cleaning up temporary files..."
rm -rf "$TMP_DIR"
log_success "Cleanup completed"
}
show_usage() {
echo ""
log_success "🎉 Lavandula installation completed!"
echo ""
echo -e "${BLUE}Quick Start:${NC}"
echo " lavu new my-project # Create a new project"
echo " cd my-project"
echo " lavu run # Run your project"
echo ""
echo -e "${BLUE}Documentation:${NC}"
echo " GitHub: https://github.com/$REPO"
echo ""
}
main() {
echo -e "${BLUE}"
echo " _ _ _ "
echo " | | | | | | "
echo " | | __ ___ ____ _ _ __ __| |_ _| | __ _ "
echo " | | / _\` \ \ / / _\` | '_ \ / _\` | | | | |/ _\` |"
echo " | |___| (_| |\ V / (_| | | | | (_| | |_| | | (_| |"
echo " |______\__,_| \_/ \__,_|_| |_|\__,_|\__,_|_|\__,_|"
echo -e "${NC}"
echo "Installing Lavandula Web Framework..."
echo ""
check_dependencies
download_source
build_project
install_project
install_repository
cleanup
show_usage
}
main "$@"