-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
39 lines (32 loc) · 1.02 KB
/
install.sh
File metadata and controls
39 lines (32 loc) · 1.02 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
#!/bin/bash
# Define the repository URL and the directory containing the scripts
REPO_URL="https://github.com/DOSCON-development/doscon_linux_utils.git"
SCRIPTS_DIR="scripts"
TARGET_DIR="/usr/local/sbin"
# Check if running as root
if [ "$(id -u)" -ne 0 ]; then
echo "Please run this script as root."
exit 1
fi
# Clone the repository
cd /tmp
git clone "$REPO_URL" repository
# Check if the scripts directory exists
if [ ! -d "repository/$SCRIPTS_DIR" ]; then
echo "No scripts directory found. Exiting installation."
rm -rf /tmp/repository
exit 1
fi
# Install each script in the scripts directory
for script in repository/$SCRIPTS_DIR/*; do
script_name=$(basename "$script")
echo "Installing $script_name..."
mv "$script" "$TARGET_DIR/$script_name"
chmod +x "$TARGET_DIR/$script_name"
done
# Clean up
rm -rf /tmp/repository
# Confirm completion
echo "Installation completed successfully."
echo "You can run the scripts from $TARGET_DIR"
echo "or if /usr/local/sbin is in path, directly from the terminal"