aboutsummaryrefslogtreecommitdiffstats
path: root/install.sh
blob: 704de75f543be3834364ab1cbc91ec41ecdcb61f (plain) (blame)
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
#!/bin/sh

# Function to install packages using apt (Debian/Ubuntu)
install_with_apt() {
    sudo apt-get update
    sudo apt-get install -y lua5.4 liblua5.4-dev
}

# Function to install packages using yum (Red Hat/CentOS)
install_with_yum() {
    sudo yum install -y epel-release
    sudo yum install -y lua lua-devel
}

# New package manager used in Fedora
install_with_dnf() {
    sudo dnf install -y lua lua-devel
}

# Function to install packages using pacman (Arch Linux)
install_with_pacman() {
    sudo pacman -Sy --noconfirm lua
}

if [ -f /etc/arch-release ]; then
    install_with_pacman
elif [ -f /etc/debian_version ]; then
    install_with_apt
elif [ -f /etc/redhat-release ] || [ -f /etc/centos-release ]; then
    if command -v dnf >/dev/null 2>&1; then
        install_with_dnf
    else
        install_with_yum
    fi
else
    echo "Your linux distro is not supported currently."
    echo "You need to manually install those packages: exiftool, jq, glfw"
fi

PREMAKE_VERSION="5.0.0-beta2"
OS="linux"

echo "downloading premake $PREMAKE_VERSION"
wget -q https://github.com/premake/premake-core/releases/download/v${PREMAKE_VERSION}/premake-${PREMAKE_VERSION}-${OS}.tar.gz -O premake.tar.gz
echo "extracting premake"
tar -xzf premake.tar.gz
echo "installing premake"
sudo mv premake5 example.so libluasocket.so /usr/bin
sudo chmod +x /usr/bin/premake5
rm premake.tar.gz

premake5 gmake
make
cp -rf ./.lush ~/

# Install the new shell binary to a temporary location
sudo cp ./bin/Debug/lush/lush /usr/bin/lush.new

# Atomically replace the old binary
sudo mv /usr/bin/lush.new /usr/bin/lush

# Ensure the shell is registered in /etc/shells
if ! grep -Fxq "/usr/bin/lush" /etc/shells; then
    echo "/usr/bin/lush" | sudo tee -a /etc/shells >/dev/null
fi

# Optionally change the shell
chsh -s /usr/bin/lush

echo "====================="
echo "INSTALLATION FINISHED"
echo "====================="