-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
57 lines (48 loc) · 1.56 KB
/
install.sh
File metadata and controls
57 lines (48 loc) · 1.56 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
#!/bin/bash
set -e
# Function to install dependencies for Debian/Ubuntu
install_deps_debian() {
sudo apt-get update
sudo apt-get install -y libvips-dev golang-go
}
# Function to install dependencies for macOS
install_deps_macos() {
brew update
brew install vips go
}
# Function to install dependencies for Windows (using chocolatey)
install_deps_windows() {
choco install -y vips golang
}
# Detect the operating system and install dependencies
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
. /etc/os-release
if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then
install_deps_debian
else
echo "Unsupported Linux distribution. Please install libvips-dev and golang-go manually."
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
install_deps_macos
elif [[ "$OSTYPE" == "msys" ]]; then
install_deps_windows
else
echo "Unsupported OS. Please install libvips and Go manually."
exit 1
fi
# Set PKG_CONFIG_PATH for pkg-config to find vips
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig' >> ~/.bashrc
# shellcheck disable=SC1090
source ~/.bashrc
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Please add the directory containing 'vips.pc' to the PKG_CONFIG_PATH environment variable manually."
fi
# Install Go packages
go get -u github.com/h2non/bimg
go get -u github.com/spf13/cobra
# Build the application
go build -o image-processor app/main.go
echo "Setup and build completed successfully."