-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
131 lines (116 loc) · 4.05 KB
/
install.sh
File metadata and controls
131 lines (116 loc) · 4.05 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
#!/bin/bash
# ============================================================================
# RegressionLab - Installation Script for Unix/Mac
# ============================================================================
# This script clones the repository and runs the setup automatically
# ============================================================================
set -e # Exit on error
# Detect Linux and package manager (for optional auto-install of dependencies)
is_linux_with_pkg_manager() {
[ "$(uname -s)" = "Linux" ] || return 1
command -v apt-get &> /dev/null || command -v dnf &> /dev/null || \
command -v yum &> /dev/null || command -v zypper &> /dev/null || \
command -v pacman &> /dev/null
}
install_git_linux() {
if command -v apt-get &> /dev/null; then
sudo apt-get update && sudo apt-get install -y git
elif command -v dnf &> /dev/null; then
sudo dnf install -y git
elif command -v yum &> /dev/null; then
sudo yum install -y git
elif command -v zypper &> /dev/null; then
sudo zypper install -y git
elif command -v pacman &> /dev/null; then
sudo pacman -S --noconfirm git
else
return 1
fi
}
echo ""
echo "===================================="
echo " RegressionLab Installation"
echo "===================================="
echo ""
# Check if Git is installed
if ! command -v git &> /dev/null; then
echo "Git is not installed."
if is_linux_with_pkg_manager; then
read -p "Do you want to install Git now? (y/n): " INSTALL_GIT
if [[ "$INSTALL_GIT" =~ ^[Yy]$ ]]; then
echo "Installing Git..."
if install_git_linux; then
echo "Git installed successfully."
else
echo "ERROR: Failed to install Git automatically."
echo "Please install Git manually:"
echo " - Ubuntu/Debian: sudo apt-get install git"
echo " - Fedora/RHEL: sudo dnf install git"
echo " - openSUSE: sudo zypper install git"
echo " - Arch: sudo pacman -S git"
exit 1
fi
else
echo "Please install Git and run this script again:"
echo " - Ubuntu/Debian: sudo apt-get install git"
echo " - macOS: git is included with Xcode Command Line Tools"
echo " - Or download from: https://git-scm.com/downloads"
exit 1
fi
else
echo "ERROR: Git is not installed"
echo "Please install Git:"
echo " - Ubuntu/Debian: sudo apt-get install git"
echo " - macOS: git is included with Xcode Command Line Tools"
echo " - Or download from: https://git-scm.com/downloads"
exit 1
fi
fi
echo "[1/3] Git found:"
git --version
# Set repository URL
REPO_URL="https://github.com/DOKOS-TAYOS/RegressionLab.git"
REPO_NAME="regressionlab"
# Check if directory already exists
if [ -d "$REPO_NAME" ]; then
echo ""
echo "WARNING: Directory '$REPO_NAME' already exists"
read -p "Do you want to remove it and clone again? (y/N): " OVERWRITE
if [[ "$OVERWRITE" =~ ^[Yy]$ ]]; then
echo " Removing existing directory..."
rm -rf "$REPO_NAME"
else
echo " Using existing directory..."
cd "$REPO_NAME"
./setup.sh
exit 0
fi
fi
echo ""
echo "[2/3] Cloning repository..."
if ! git clone "$REPO_URL" "$REPO_NAME"; then
echo "ERROR: Failed to clone repository"
echo "Please check your internet connection and try again"
exit 1
fi
echo " Repository cloned successfully"
# Change to repository directory
cd "$REPO_NAME" || {
echo "ERROR: Failed to change to repository directory"
exit 1
}
echo ""
echo "[3/3] Running setup..."
echo ""
# Make setup script executable
chmod +x setup.sh
# Run setup
./setup.sh
echo ""
echo "===================================="
echo " Installation Complete!"
echo "===================================="
echo ""
echo "The RegressionLab repository has been cloned and set up."
echo "You can now run the application from: $(pwd)"
echo ""