forked from lyarinet/Samba-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto_install.sh
More file actions
executable file
·139 lines (115 loc) · 4.14 KB
/
Copy pathauto_install.sh
File metadata and controls
executable file
·139 lines (115 loc) · 4.14 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
#!/bin/bash
#
# Samba Manager Auto-Installation Script
# This script downloads and installs Samba Manager on any Linux distribution
#
# 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 Auto-Installation Script"
echo "=========================================================="
echo ""
# Create a temporary directory
TEMP_DIR=$(mktemp -d)
echo "Created temporary directory: $TEMP_DIR"
cd $TEMP_DIR
# Check for required tools
check_requirements() {
echo "Checking for required tools..."
# Check for git
if ! command -v git &> /dev/null; then
echo "Git is not installed. Installing..."
# Detect the Linux distribution
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO=$ID
DISTRO_FAMILY=$ID_LIKE
else
echo "Cannot detect Linux distribution. Please install git manually."
exit 1
fi
# Install git based on distribution
if [[ "$DISTRO" == "ubuntu" || "$DISTRO" == "debian" || "$DISTRO_FAMILY" == *"debian"* ]]; then
apt-get update
apt-get install -y git
elif [[ "$DISTRO" == "fedora" || "$DISTRO" == "rhel" || "$DISTRO" == "centos" || "$DISTRO_FAMILY" == *"fedora"* || "$DISTRO_FAMILY" == *"rhel"* ]]; then
dnf install -y git
elif [[ "$DISTRO" == "arch" || "$DISTRO" == "manjaro" || "$DISTRO_FAMILY" == *"arch"* ]]; then
pacman -Sy --noconfirm git
else
echo "Unsupported distribution for automatic git installation."
echo "Please install git manually and run this script again."
exit 1
fi
fi
echo "Git is installed."
}
# Download Samba Manager
download_samba_manager() {
echo "Downloading Samba Manager from repository..."
# Clone the repository with the correct URL
git clone https://github.com/lyarinet/Samba-Manager.git
if [ $? -ne 0 ]; then
echo "Failed to download Samba Manager. Please check your internet connection."
exit 1
fi
echo "Download complete."
cd Samba-Manager
}
# Run the installation script
run_installation() {
echo "Running installation script..."
# Make the installation script executable
chmod +x install_all_distros.sh
# Run the installation script
./install_all_distros.sh
if [ $? -ne 0 ]; then
echo "Installation failed. Please check the error messages above."
exit 1
fi
}
# Configure network access
configure_network_access() {
echo "Configuring network access for remote connections..."
# Make the fix script executable
chmod +x fix_network_access.sh
# Run the network access fix script
./fix_network_access.sh
if [ $? -ne 0 ]; then
echo "Warning: Network access configuration may not be complete."
echo "You may need to run 'sudo /opt/samba-manager/fix_network_access.sh' manually."
else
echo "Network access configured successfully."
fi
}
# Clean up
cleanup() {
echo "Cleaning up temporary files..."
cd /
rm -rf $TEMP_DIR
echo "Cleanup complete."
}
# Main function
main() {
check_requirements
download_samba_manager
run_installation
configure_network_access
cleanup
echo ""
echo "=========================================================="
echo " Samba Manager Auto-Installation Complete!"
echo "=========================================================="
echo "Samba Manager has been successfully installed on your system."
echo "You can access it at: http://$(hostname -I | awk '{print $1}'):5000"
echo "Terminal service is available at: http://$(hostname -I | awk '{print $1}'):8080"
echo ""
echo "Both services should be accessible from other computers on your network."
echo "If you have connection issues, run: sudo /opt/samba-manager/fix_network_access.sh"
echo "=========================================================="
}
# Run the main function
main