forked from lyarinet/Samba-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_remote.sh
More file actions
executable file
·81 lines (64 loc) · 1.93 KB
/
Copy pathinstall_remote.sh
File metadata and controls
executable file
·81 lines (64 loc) · 1.93 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
#!/bin/bash
#
# Samba Manager Remote Installer
# This script downloads and runs the auto_install.sh script
#
# Check if script is running as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Please use sudo."
exit 1
fi
echo "=========================================================="
echo " Samba Manager Remote Installer"
echo "=========================================================="
echo ""
# Function to check if a command exists
command_exists() {
command -v "$1" &> /dev/null
}
# Function to download the installation script
download_script() {
local url="https://raw.githubusercontent.com/lyarinet/Samba-Manager/main/auto_install.sh"
local output="/tmp/samba_manager_auto_install.sh"
echo "Downloading installation script..."
if command_exists curl; then
curl -sSL "$url" -o "$output"
elif command_exists wget; then
wget -q "$url" -O "$output"
else
echo "Error: Neither curl nor wget is installed. Please install one of them and try again."
exit 1
fi
if [ ! -f "$output" ]; then
echo "Error: Failed to download the installation script."
exit 1
fi
chmod +x "$output"
echo "Download complete."
return 0
}
# Function to run the installation script
run_script() {
local script="/tmp/samba_manager_auto_install.sh"
echo "Running installation script..."
"$script"
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Error: Installation failed with exit code $exit_code."
exit $exit_code
fi
# Clean up
rm -f "$script"
return 0
}
# Main function
main() {
download_script
run_script
echo ""
echo "=========================================================="
echo " Samba Manager Installation Complete!"
echo "=========================================================="
}
# Run the main function
main