PortValhalla/scripts/Common/Software/Godot/install.sh

38 lines
1 KiB
Bash
Raw Normal View History

2022-11-17 09:18:13 +00:00
#!/bin/bash
# Elevate script
if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE" "$USER";
2022-11-17 09:18:13 +00:00
else
tempDir="$(mktemp -d)";
archiveName="$(mktemp)";
destination="/var/lib/godot";
2022-11-17 09:18:13 +00:00
2023-01-23 15:16:26 +00:00
if [ -d "$destination" ]
then
rm -rf "$destination";
2022-11-17 09:18:13 +00:00
fi
2023-03-16 17:43:35 +00:00
wget https://github.com/godotengine/godot/releases/download/4.0-stable/Godot_v4.0-stable_mono_linux_x86_64.zip -O "$archiveName";
unzip "$archiveName" -d "$tempDir";
mkdir -p "$destination";
mv "$tempDir"/*/* "$destination";
2023-03-16 17:43:35 +00:00
wget https://github.com/godotengine/godot/raw/4.0-stable/icon.svg -O "$destination/icon.svg";
2022-11-17 09:18:13 +00:00
rm -rf "$tempDir";
rm -f "$archiveName";
2022-11-17 09:18:13 +00:00
exeFile="$(find "$destination" -maxdepth 1 -perm -111 -type f)";
2023-03-16 17:43:35 +00:00
ln -fs "$exeFile" /usr/local/bin/godot;
2022-11-17 09:18:13 +00:00
{
echo "[Desktop Entry]";
echo "Encoding=UTF-8";
echo "Type=Application";
echo "Terminal=false";
echo "Exec=$exeFile";
echo "Name=Godot Engine";
echo "Icon=$destination/icon.svg";
} > /usr/share/applications/godot.desktop;
2022-11-17 09:18:13 +00:00
fi