forked from bottlesdevs/Bottles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppRun
executable file
·52 lines (47 loc) · 1.93 KB
/
AppRun
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
#!/bin/bash
export APPDIR="$(dirname "$(readlink -f "$0")")"
export PATH="$APPDIR/usr/bin/:$PATH"
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$PATH"
export XDG_DATA_DIRS="$APPDIR/usr/share/:/usr/share/:$XDG_DATA_DIRS"
export DESKTOP_FILE_PATH=$APPDIR/usr/share/applications/com.usebottles.bottles.desktop
export ICON_FILE_PATH=$APPDIR/usr/share/icons/hicolor/scalable/apps/com.usebottles.bottles.svg
export SYMBOLIC_ICON_FILE_PATH=$APPDIR/usr/share/icons/symbolic/scalable/apps/com.usebottles.bottles-symbolic.svg
export INSTALLED_DESKTOP_FILE_PATH=~/.local/share/applications/bottles.desktop
export INSTALLED_ICON_FILE_PATH=~/.local/share/icons/hicolor/scalable/apps/com.usebottles.bottles.svg
export INSTALLED_SYMBOLIC_ICON_FILE_PATH=~/.local/share/icons/hicolor/symbolic/apps/com.usebottles.bottles-symbolic.svg
export G_MESSAGES_DEBUG="fatal"
INSTALL_DESKTOP_FILE=false
if ! test -f $INSTALLED_ICON_FILE_PATH; then
mkdir -p ~/.local/share/icons/hicolor/scalable/apps/
cp $ICON_FILE_PATH $INSTALLED_SYMBOLIC_ICON_FILE_PATH
fi
if ! test -f $INSTALLED_SYMBOLIC_ICON_FILE_PATH; then
mkdir -p ~/.local/share/icons/hicolor/symbolic/apps/
cp $ICON_FILE_PATH $INSTALLED_SYMBOLIC_ICON_FILE_PATH
fi
if ! test -f $INSTALLED_DESKTOP_FILE_PATH; then
if command -v zenity &> /dev/null
then
zenity --question --text="Do you want to install this AppImage?" --title "Bottles Installation"
if [ $? = 0 ]; then
INSTALL_DESKTOP_FILE=true
fi
elif command -v kdialog &> /dev/null
then
kdialog --yesno "Do you want to install this AppImage?" --yes-label "Install" --no-label "Just run" --title "Bottles Installation"
if [ $? = 0 ]; then
INSTALL_DESKTOP_FILE=true
fi
fi
if $INSTALL_DESKTOP_FILE
then
cp $DESKTOP_FILE_PATH $INSTALLED_DESKTOP_FILE_PATH
sed -i -e 's|Exec=bottles|Exec='$APPIMAGE' %F|g' $INSTALLED_DESKTOP_FILE_PATH
fi
fi
if ! command -v python3 &> /dev/null
then
python $APPDIR/usr/bin/bottles $1
else
python3 $APPDIR/usr/bin/bottles $1
fi