rpgmaker-linux/install.sh

102 lines
2.6 KiB
Bash
Raw Normal View History

2024-03-07 22:05:39 +02:00
#!/bin/bash
installpath=$(dirname "$0")
2024-05-09 02:38:34 +03:00
version='1.0.6'
2024-03-07 22:05:39 +02:00
if ! [ -d "$installpath/nwjs" ]; then
echo "Can't find nwjs folder"
exit 1;
fi
echo "Installing rpgmaker-linux v$version"
mainfd="$HOME/desktopapps/nwjs"
2024-05-15 00:58:49 +07:00
localapplicationsfd="$HOME/.local/share/applications"
2024-03-07 22:05:39 +02:00
localbin="$HOME/.local/bin"
arch=$(uname -m)
2024-05-09 02:35:51 +03: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 22:05:39 +02:00
rm -rf "$mainfd"
createfd() {
if ! [ -d "$1" ]; then
echo "Missing $1 creating one"
mkdir -p "$1"
2024-03-15 23:34:23 +02:00
if [ "$1" = "$localbin" ]; then
nolocalbin=true
fi
2024-03-07 22:05:39 +02:00
fi;
}
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
if ! file "$1" | grep -q "$archcheckmessage" ; then
# Use $ wget -qO- installscript.sh | bash
file "$1"
echo "Wrong architecture!!
2024-03-08 07:18:03 +02:00
Download corrent archive with $arch"
2024-03-07 22:05:39 +02:00
exit 1;
fi
}
createfd "$mainfd"
createfd "$localapplicationsfd"
createfd "$localbin"
checkthebinaryarch "$installpath/nwjs/cicpoffs"
cp "$installpath/install.sh" "$mainfd"
2024-05-15 01:33:13 +07:00
cp -r "$installpath/nwjs" "$mainfd"
2024-03-07 22:05:39 +02:00
# echo "Making a desktop file"
2024-05-15 00:58:49 +07:00
echo -e "[Desktop Entry]
2024-03-07 22:05:39 +02:00
Name=RPG Maker MV/MZ (cicpoffs mount)
2024-05-09 02:35:51 +03:00
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --chooselatestnwjs
2024-03-07 22:05:39 +02:00
Type=Application
2024-05-09 02:35:51 +03:00
Categories=Games
2024-03-07 22:05:39 +02: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-15 00:58:49 +07:00
echo -e "[Desktop Entry]
2024-05-09 02:35:51 +03:00
Name=RPG Maker MV/MZ Options
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --gui
Type=Application
Categories=Games
StartupNotify=true
MimeType=application/x-ms-dos-executable;application/x-wine-extension-msp;
Icon=$mainfd/nwjs/packagefiles/nwjs128.png
Terminal=true
2024-05-15 00:58:49 +07:00
NoDisplay=true" > "$localapplicationsfd/nwjsoptions.desktop"
2024-05-09 02:35:51 +03:00
chmod +x "$localapplicationsfd/nwjsoptions.desktop"
2024-03-15 23:34:23 +02:00
# Exec=bash -c "/home/pasha/desktopapps/nwjs/nwjs/packagefiles/nwjsstart-cicpoffs.sh --latestnwjs --gamepath '$(pwd)'";#
2024-03-07 22:05:39 +02:00
lnnew "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh" "$localbin/rpgmaker-linux"
2024-05-15 01:33:13 +07:00
chmod +x "$localbin/rpgmaker-linux"
2024-03-15 23:41:49 +02:00
update-desktop-database -q ~/.local/share/applications
2024-03-07 22:05:39 +02:00
echo "Installation Done"
2024-03-15 23:34:23 +02: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