-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·147 lines (117 loc) · 3.83 KB
/
install.sh
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
installpath=$(dirname "$0")
version='1.1.4'
if ! [ -d "$installpath/nwjs" ]; then
echo "Can't find nwjs folder"
exit 1;
fi
echo "Installing rpgmaker-linux v$version"
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
mainfd="$HOME/desktopapps/nwjs"
fi
localapplicationsfd="$HOME/.local/share/applications"
localbin="$HOME/.local/bin"
compatibilitytoolsfddef="$HOME/.steam/root/compatibilitytools.d/"
compatibilitytoolsfdflatpak="$HOME/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d/"
arch=$(uname -m)
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')
rm -rf "$mainfd"
createfd() {
if ! [ -d "$1" ]; then
echo "Missing $1 creating one"
mkdir -p "$1"
if [ "$1" = "$localbin" ]; then
nolocalbin=true
fi
fi;
}
rmfd() {
if [ -d "$1" ]; then
rm -rf "$1"
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
steamcompatibilitytoolinstaller() {
createfd "$1"
rmfd "$1/rpgmaker-linux-steam-wrapper"
cp -r "$installpath/nwjs/packagefiles/rpgmaker-linux-steam-wrapper/" "$1"
}
if ! file "$1" | grep -q "$archcheckmessage" ; then
# Use $ wget -qO- installscript.sh | bash
file "$1"
echo "Wrong architecture!!
Download corrent archive with $arch"
exit 1;
fi
}
createfd "$mainfd"
createfd "$localapplicationsfd"
createfd "$localbin"
checkthebinaryarch "$installpath/nwjs/cicpoffs"
cp "$installpath/install.sh" "$mainfd"
cp "$installpath/uninstall.sh" "$mainfd"
cp -r "$installpath/nwjs" "$mainfd"
if [ "$customrpgmakerlinuxpath" = "true" ]; then
sed "s@^mainfd=.*@mainfd=\"$mainfde\"@g" -i "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh"
fi
# echo "Making a desktop file"
echo -e "[Desktop Entry]
Name=RPG Maker MV/MZ (cicpoffs mount)
Exec=env gamef=\"%u\" $mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh --chooselatestnwjs
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
NoDisplay=true" > "$localapplicationsfd/nwjstest.desktop"
chmod +x "$localapplicationsfd/nwjstest.desktop"
echo -e "[Desktop Entry]
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;x-scheme-handler/rpgmakermp
Icon=$mainfd/nwjs/packagefiles/nwjs128.png
Terminal=true
NoDisplay=true" > "$localapplicationsfd/nwjsoptions.desktop"
chmod +x "$localapplicationsfd/nwjsoptions.desktop"
lnnew "$mainfd/nwjs/packagefiles/nwjsstart-cicpoffs.sh" "$localbin/rpgmaker-linux"
chmod +x "$localbin/rpgmaker-linux"
update-desktop-database -q ~/.local/share/applications
xdg-mime default nwjsoptions.desktop x-scheme-handler/rpgmakermp
echo "Installation Done"
if [ ! -f "$HOME/.profile" ]; then
if [ ! -f "$HOME/.bash_profile" ] || ! cat "$HOME/.bash_profile" | grep -q ".local/bin"; then
echo 'if [ -d "$HOME/.local/bin" ]; then export PATH="$PATH:$HOME/.local/bin" ; fi' >> ~/.bash_profile
fi
fi
if [ -d "$HOME/.steam/" ]; then
steamcompatibilitytoolinstaller "$compatibilitytoolsfddef"
fi
if [ -d "$HOME/.var/app/com.valvesoftware.Steam/data/Steam" ]; then
steamcompatibilitytoolinstaller "$compatibilitytoolsfdflatpak"
fi
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