-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstall.sh
executable file
·44 lines (37 loc) · 1.64 KB
/
install.sh
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
#!/bin/bash
# Lexiserver 1.0 - Installation Script
# Author: Alexia Michelle <[email protected]>
# Check if the script is being run as root
if [ "$(whoami)" != "root" ]; then
echo "Please run this script as root (sudo bash install.sh)"
echo "Error: Insufficient permissions to create /opt/lexiserver"
exit 1
else
echo "Welcome to Lexiserver 1.0 Installation"
echo "----------------------------------------"
echo "This script will install Lexiserver to /opt/lexiserver"
# Prompt user for confirmation
read -p "Continue with the installation? (Y/N): " choice
case $choice in
[YySs])
echo "Installing Lexiserver..."
# Create directory if it doesn't exist
sudo mkdir -p /opt/lexiserver || { echo "Error creating directory /opt/lexiserver"; exit 1; }
# Copy files to installation directory
sudo cp -r * /opt/lexiserver/ || { echo "Error copying files to /opt/lexiserver"; exit 1; }
# Append system information to 404.html
sysn=$(head -n 4 /etc/os-release | grep -v "PRETTY" | grep NAME= | awk -F '=' '{print $2}' | sed 's/"//g')
sysv=$(head -n 4 /etc/os-release | grep VERSION= | awk -F '=' '{print $2}' | sed 's/"//g')
echo "$sysn $sysv" >> /opt/lexiserver/404.html || { echo "Error updating 404.html"; exit 1; }
echo -e "</body>\n</html>" >> /opt/lexiserver/404.html
echo "Installation complete!"
echo "To uninstall, remove /opt/lexiserver"
;;
[Nn])
echo "Installation aborted"
;;
*)
echo "Invalid choice. Installation aborted."
;;
esac
fi