Instantly share code, notes, and snippets.

Embed
What would you like to do?
Haxe Linux install script
#!/bin/sh
HAXE_VERSION=3.2.1
NEKO_VERSION=2.0.0
if [ `uname -m` = "armv7l" ]; then
HAXE_VERSION=3.1.3
fi
if [ "$1" = "y" -o "$1" = "-y" ]; then
echo "Do you want to install Haxe $HAXE_VERSION and Neko $NEKO_VERSION? (y/n) y"
RESP=y
else
read -p "Do you want to install Haxe $HAXE_VERSION and Neko $NEKO_VERSION? (y/n) " RESP
fi
if [ $RESP = "y" ]; then
if [ -n "$(command -v yum)" ]; then
echo ""
echo "---------------------------------------"
echo " Installing Dependencies"
echo "---------------------------------------"
sudo yum -y install wget
elif [ -n "$(command -v pacman)" ]; then
echo ""
echo "---------------------------------------"
echo " Installing Dependencies"
echo "---------------------------------------"
set -e
sudo pacman -S wget --noconfirm
elif [ -n "$(command -v apt-get)" ]; then
echo ""
echo "---------------------------------------"
echo " Removing Haxe (if installed)"
echo "---------------------------------------"
set +e
sudo apt-get remove haxe neko
set -e
fi
if [ `uname -m` = "x86_64" ]; then
echo ""
echo "---------------------------------------"
echo " Downloading Neko $NEKO_VERSION (64-bit)"
echo "---------------------------------------"
wget -c http://nekovm.org/_media/neko-$NEKO_VERSION-linux64.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Neko $NEKO_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/neko
tar xvzf neko-$NEKO_VERSION-linux64.tar.gz
sudo mkdir -p /usr/lib/neko
sudo rm -rf /usr/lib/neko/neko
sudo rm -rf /usr/lib/neko/nekotools
sudo cp -r neko-$NEKO_VERSION-linux/* /usr/lib/neko
# Add symlinks
sudo rm -rf /usr/bin/neko
sudo rm -rf /usr/bin/nekoc
sudo rm -rf /usr/bin/nekotools
sudo rm -rf /usr/lib/libneko.so
sudo ln -s /usr/lib/neko/libneko.so /usr/lib/libneko.so
sudo ln -s /usr/lib/neko/neko /usr/bin/neko
sudo ln -s /usr/lib/neko/nekoc /usr/bin/nekoc
sudo ln -s /usr/lib/neko/nekotools /usr/bin/nekotools
if [ -d "/usr/lib64" ]; then
set +e
sudo rm -rf /usr/lib64/libneko.so
sudo ln -s /usr/lib/neko/libneko.so /usr/lib64/libneko.so
set -e
fi
# Cleanup
rm -rf neko-$NEKO_VERSION-linux
rm neko-$NEKO_VERSION-linux64.tar.gz
elif [ `uname -m` = "armv7l" ]; then
echo ""
echo "---------------------------------------"
echo " Downloading Neko $NEKO_VERSION (armv7)"
echo "---------------------------------------"
wget -c http://www.openfl.org/builds/neko/neko-2.0.0-rpi.zip
echo ""
echo "---------------------------------------"
echo " Installing Neko $NEKO_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/neko
sudo mkdir -p /usr/lib/neko
sudo rm -rf /usr/lib/neko/neko
sudo rm -rf /usr/lib/neko/nekotools
sudo unzip -o neko-$NEKO_VERSION-rpi.zip -d /usr/lib/neko/
sudo cp -r /usr/lib/neko/bin/* /usr/lib/neko
sudo rm -rf /usr/lib/neko/bin
# Add symlinks
sudo rm -rf /usr/bin/neko
sudo rm -rf /usr/bin/nekoc
sudo rm -rf /usr/bin/nekotools
sudo rm -rf /usr/lib/libneko.so
sudo ln -s /usr/lib/neko/libneko.so /usr/lib/libneko.so
sudo ln -s /usr/lib/neko/neko /usr/bin/neko
sudo ln -s /usr/lib/neko/nekoc /usr/bin/nekoc
sudo ln -s /usr/lib/neko/nekotools /usr/bin/nekotools
# Cleanup
rm neko-$NEKO_VERSION-rpi.zip
else
echo ""
echo "--------------------------------------"
echo " Downloading Neko $NEKO_VERSION (32-bit)"
echo "---------------------------------------"
wget -c http://nekovm.org/_media/neko-$NEKO_VERSION-linux.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Neko $NEKO_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/neko
tar xvzf neko-$NEKO_VERSION-linux.tar.gz
sudo mkdir -p /usr/lib/neko
sudo rm -rf /usr/lib/neko/neko
sudo rm -rf /usr/lib/neko/nekotools
sudo cp -r neko-$NEKO_VERSION-linux/* /usr/lib/neko
# Add symlinks
sudo rm -rf /usr/bin/neko
sudo rm -rf /usr/bin/nekoc
sudo rm -rf /usr/bin/nekotools
sudo rm -rf /usr/lib/libneko.so
sudo ln -s /usr/lib/neko/neko /usr/bin/neko
sudo ln -s /usr/lib/neko/nekoc /usr/bin/nekoc
sudo ln -s /usr/lib/neko/nekotools /usr/bin/nekotools
sudo ln -s /usr/lib/neko/libneko.so /usr/lib/libneko.so
# Cleanup
rm -rf neko-$NEKO_VERSION-linux
rm neko-$NEKO_VERSION-linux.tar.gz
fi
# Install libgc, which is required for Neko
if [ -n "$(command -v yum)" ]; then
sudo yum -y install libgc
elif [ -n "$(command -v pacman)" ]; then
sudo pacman -S gc --noconfirm
elif [ -n "$(command -v zypper)" ]; then
sudo zypper --non-interactive install libgc1
else
sudo apt-get -y install libgc-dev
fi
if [ -d "/usr/lib64" ] && [ ! -f "/usr/lib64/libpcre.so.3" ]; then
set +e
sudo ln -s /usr/lib64/libpcre.so.1 /usr/lib64/libpcre.so.3
set -e
fi
if [ `uname -m` = "x86_64" ]; then
echo ""
echo "---------------------------------------"
echo " Downloading Haxe $HAXE_VERSION (64-bit)"
echo "---------------------------------------"
wget -c http://haxe.org/website-content/downloads/$HAXE_VERSION/downloads/haxe-$HAXE_VERSION-linux64.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Haxe $HAXE_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/haxe
sudo mkdir -p /usr/lib/haxe
sudo rm -rf /usr/lib/haxe/haxe
sudo tar xvzf haxe-$HAXE_VERSION-linux64.tar.gz -C /usr/lib/haxe --strip-components=1
# Add symlinks
sudo rm -rf /usr/bin/haxe
sudo rm -rf /usr/bin/haxelib
sudo rm -rf /usr/bin/haxedoc
sudo ln -s /usr/lib/haxe/haxe /usr/bin/haxe
sudo ln -s /usr/lib/haxe/haxelib /usr/bin/haxelib
# Set up haxelib
sudo mkdir -p /usr/lib/haxe/lib
sudo chmod -R 777 /usr/lib/haxe/lib
haxelib setup /usr/lib/haxe/lib
# Cleanup
rm haxe-$HAXE_VERSION-linux64.tar.gz
elif [ `uname -m` = "armv7l" ]; then
echo ""
echo "---------------------------------------"
echo " Downloading Haxe $HAXE_VERSION (armv7)"
echo "---------------------------------------"
wget -c http://haxe.org/website-content/downloads/$HAXE_VERSION/downloads/haxe-$HAXE_VERSION-raspi.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Haxe $HAXE_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/haxe
sudo mkdir -p /usr/lib/haxe
sudo rm -rf /usr/lib/haxe/haxe
sudo tar xvzf haxe-$HAXE_VERSION-raspi.tar.gz -C /usr/lib/haxe --strip-components=1
# Add symlinks
sudo rm -rf /usr/bin/haxe
sudo rm -rf /usr/bin/haxelib
sudo rm -rf /usr/bin/haxedoc
sudo ln -s /usr/lib/haxe/haxe /usr/bin/haxe
sudo ln -s /usr/lib/haxe/haxelib /usr/bin/haxelib
# Set up haxelib
sudo mkdir -p /usr/lib/haxe/lib
sudo chmod -R 777 /usr/lib/haxe/lib
haxelib setup /usr/lib/haxe/lib
# Cleanup
rm haxe-$HAXE_VERSION-raspi.tar.gz
else
echo ""
echo "---------------------------------------"
echo " Downloading Haxe $HAXE_VERSION (32-bit)"
echo "---------------------------------------"
wget -c http://haxe.org/website-content/downloads/$HAXE_VERSION/downloads/haxe-$HAXE_VERSION-linux32.tar.gz
echo ""
echo "---------------------------------------"
echo " Installing Haxe $HAXE_VERSION"
echo "---------------------------------------"
# Extract and copy files to /usr/lib/haxe
sudo mkdir -p /usr/lib/haxe
sudo rm -rf /usr/lib/haxe/haxe
sudo tar xvzf haxe-$HAXE_VERSION-linux32.tar.gz -C /usr/lib/haxe --strip-components=1
# Add symlinks
sudo rm -rf /usr/bin/haxe
sudo rm -rf /usr/bin/haxelib
sudo rm -rf /usr/bin/haxedoc
sudo ln -s /usr/lib/haxe/haxe /usr/bin/haxe
sudo ln -s /usr/lib/haxe/haxelib /usr/bin/haxelib
# Set up haxelib
sudo mkdir -p /usr/lib/haxe/lib
sudo chmod -R 777 /usr/lib/haxe/lib
sudo haxelib setup /usr/lib/haxe/lib
# Cleanup
rm haxe-$HAXE_VERSION-linux32.tar.gz
fi
fi
echo ""
@oscarcs

This comment has been minimized.

oscarcs commented Nov 13, 2016

Should sudo cp -r neko-$NEKO_VERSION-linux/* /usr/lib/neko be
sudo cp -r neko-$NEKO_VERSION-linux64/* /usr/lib/neko ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment