rpgmaker-linux/install.sh

142 lines
3.6 KiB
Bash
Raw Permalink Normal View History

2024-03-07 21:05:39 +01:00
#!/bin/bash
installpath=$(dirname "$0")
2024-08-12 22:16:35 +02:00
version='1.1.0'
2024-03-07 21:05:39 +01:00
if ! [ -d "$installpath/nwjs" ]; then
echo "Can't find nwjs folder"
exit 1;
fi
echo "Installing rpgmaker-linux v$version"
2024-08-12 22:16:35 +02:00
mainfdtxt="$HOME/.config/defrpgmakerlinuxpath.txt"
if [ -e "$mainfdtxt" ]; then
mainfd=$(cat "$mainfdtxt" | sed -e 's@/$@@g' -e 's@$@/nwjs@g');
mainfde=$(cat "$mainfdtxt" | sed -e 's@/$@@g')
customrpgmakerlinuxpath=true
else
2024-03-07 21:05:39 +01:00
mainfd="$HOME/desktopapps/nwjs"
2024-08-12 22:16:35 +02:00
fi
2024-05-14 19:58:49 +02:00
localapplicationsfd="$HOME/.local/share/applications"
2024-03-07 21:05:39 +01:00
localbin="$HOME/.local/bin"
2024-05-22 13:28:05 +02:00
compatibilitytoolsfddef="$HOME/.steam/root/compatibilitytools.d/"
compatibilitytoolsfdflatpak="$HOME/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d/"
2024-03-07 21:05:39 +01:00
arch=$(uname -m)
2024-05-09 01:35:51 +02:00
archcheckmessage=$(echo "$arch" | sed -e 's@x86_64@, x86-64, version@g' -e 's@aarch64@, ARM aarch64,@g' -e 's@i686@, Intel 80386,@g' -e 's@i386@, Intel 80386,@g' -e 's@armv7l@, ARM,@g' -e 's@armhf@, ARM,@g')
2024-03-07 21:05:39 +01:00
rm -rf "$mainfd"
2024-05-22 13:28:05 +02:00
2024-03-07 21:05:39 +01:00
createfd() {
if ! [ -d "$1" ]; then
echo "Missing $1 creating one"
mkdir -p "$1"
2024-03-15 22:34:23 +01:00
if [ "$1" = "$localbin" ]; then
nolocalbin=true
fi
2024-03-07 21:05:39 +01:00
fi;
}
2024-05-22 13:28:05 +02:00
rmfd() {
if [ -d "$1" ]; then
rm -rf "$1"
fi;
}
2024-03-07 21:05:39 +01:00
lnnew() {
if ! [ -f "$1" ]; then
echo "Can't find the $1 file"
fi
if [ -h "$2" ]; then
rm "$2"
fi
ln -s "$1" "$2"
}
checkthebinaryarch() {
if ! [ -f "$1" ]; then
echo "Missing file $1"
fi
2024-05-22 13:28:05 +02:00
steamcompatibilitytoolinstaller() {
createfd "$1"
rmfd "$1/rpgmaker-linux-steam-wrapper"
cp -r "$installpath/nwjs/packagefiles/rpgmaker-linux-steam-wrapper/" "$1"
}
2024-03-07 21:05:39 +01:00
if ! file "$1" | grep -q "$archcheckmessage" ; then
# Use $ wget -qO- installscript.sh | bash
file "$1"
echo "Wrong architecture!!
2024-03-08 06:18:03 +01:00
Download corrent archive with $arch"
2024-03-07 21:05:39 +01:00
exit 1;
fi
}
createfd "$mainfd"
createfd "$localapplicationsfd"
createfd "$localbin"
2024-05-22 13:28:05 +02:00
2024-03-07 21:05:39 +01:00
checkthebinaryarch "$installpath/nwjs/cicpoffs"
cp "$installpath/install.sh" "$mainfd"
2024-05-22 13:28:05 +02:00
cp "$installpath/uninstall.sh" "$mainfd"
2024-05-14 20:33:13 +02:00
cp -r "$installpath/nwjs" "$mainfd"
2024-03-07 21:05:39 +01:00
2024-08-12 22:16:35 +02:00
if [ "$customrpgmakerlinuxpath" = "true" ]; then
sed "s@^mainfd=.*@mainfd=\"$mainfde\"@g" -i "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh"
fi
2024-03-07 21:05:39 +01:00
# echo "Making a desktop file"
2024-05-14 19:58:49 +02:00
echo -e "[Desktop Entry]
2024-03-07 21:05:39 +01:00
Name=RPG Maker MV/MZ (cicpoffs mount)
2024-05-09 01:35:51 +02:00
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --chooselatestnwjs
2024-03-07 21:05:39 +01:00
Type=Application
2024-05-09 01:35:51 +02:00
Categories=Games
2024-03-07 21:05:39 +01:00
StartupNotify=true
MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp;
Icon=$mainfd/nwjs/packagefiles/nwjs128.png
Terminal=true
NoDisplay=true" > "$localapplicationsfd/nwjstest.desktop"
chmod +x "$localapplicationsfd/nwjstest.desktop"
2024-05-14 19:58:49 +02:00
echo -e "[Desktop Entry]
2024-05-09 01:35:51 +02:00
Name=RPG Maker MV/MZ Options
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --gui
Type=Application
Categories=Games
StartupNotify=true
2024-05-22 13:28:05 +02:00
MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp;x-scheme-handler/rpgmakermp
2024-05-09 01:35:51 +02:00
Icon=$mainfd/nwjs/packagefiles/nwjs128.png
Terminal=true
2024-05-14 19:58:49 +02:00
NoDisplay=true" > "$localapplicationsfd/nwjsoptions.desktop"
2024-05-09 01:35:51 +02:00
chmod +x "$localapplicationsfd/nwjsoptions.desktop"
2024-03-07 21:05:39 +01:00
lnnew "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh" "$localbin/rpgmaker-linux"
2024-05-14 20:33:13 +02:00
chmod +x "$localbin/rpgmaker-linux"
2024-03-15 22:41:49 +01:00
update-desktop-database -q ~/.local/share/applications
2024-05-22 13:28:05 +02:00
xdg-mime default nwjsoptions.desktop x-scheme-handler/rpgmakermp
2024-03-07 21:05:39 +01:00
echo "Installation Done"
2024-03-15 22:34:23 +01:00
2024-05-22 13:28:05 +02:00
if [ -d "$HOME/.steam/" ]; then
steamcompatibilitytoolinstaller "$compatibilitytoolsfddef"
fi
if [ -d "$HOME/.var/app/com.valvesoftware.Steam/data/Steam" ]; then
steamcompatibilitytoolinstaller "$compatibilitytoolsfdflatpak"
fi
2024-03-15 22:34:23 +01:00
if [ -n "$nolocalbin" ]; then
echo "$localbin folder was created, you might need to restart your computer if you want to use the program in the terminal
Or use
$ export PATH=\$PATH:$localbin"
fi