-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbottles-conty-builder.sh
74 lines (63 loc) · 2.11 KB
/
bottles-conty-builder.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
#!/bin/sh
set -u
APP=bottles
# CREATE A TEMPORARY DIRECTORY
mkdir -p tmp && cd tmp || exit 1
# DOWNLOADING APPIMAGETOOL
if test -f ./appimagetool; then
echo " appimagetool already exists" 1> /dev/null
else
echo " Downloading appimagetool..."
wget -q "$(wget -q https://api.github.com/repos/probonopd/go-appimage/releases -O - | sed 's/"/ /g; s/ /\n/g' | grep -o 'https.*continuous.*tool.*86_64.*mage$')" -O appimagetool
fi
chmod a+x ./appimagetool
# CREATE AND ENTER THE APPDIR
mkdir -p "$APP".AppDir && cd "$APP".AppDir || exit 1
# ICON
if ! test -f ./*.svg; then
wget -q https://raw.githubusercontent.com/bottlesdevs/Bottles/main/data/icons/hicolor/48/apps/com.usebottles.bottles.svg
fi
# LAUNCHER
echo "[Desktop Entry]
Name=Bottles
Comment=Run Windows Software
Icon=com.usebottles.bottles
Exec=AppRun
TryExec=bottles
Terminal=false
Type=Application
Categories=Utility;GNOME;GTK;
StartupNotify=true
StartupWMClass=bottles
MimeType=x-scheme-handler/bottles;application/x-ms-dos-executable;application/x-msi;application/x-ms-shortcut;application/x-wine-extension-msp;
Keywords=wine;windows;
X-GNOME-UsesNotifications=true" > com.usebottles.bottles.desktop
# APPRUN
rm -f ./AppRun
cat >> ./AppRun << 'EOF'
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
export UNION_PRELOAD="${HERE}"
case "$1" in
'') "${HERE}"/conty.sh bottles;;
*) "${HERE}"/conty.sh bottles-cli "$@";;
esac
EOF
chmod a+x ./AppRun
# DOWNLOAD CONTY
if ! test -f ./*.sh; then
conty_download_url=$(curl -Ls https://api.github.com/repos/ivan-hc/Conty/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*bottles.*sh$" | head -1)
echo " Downloading Conty..."
if wget --version | head -1 | grep -q ' 1.'; then
wget -q --no-verbose --show-progress --progress=bar "$conty_download_url"
else
wget "$conty_download_url"
fi
chmod a+x ./conty.sh
fi
# EXIT THE APPDIR
cd .. || exit 1
# EXPORT THE APPDIR TO AN APPIMAGE
VERSION=$(curl -Ls https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=bottles | grep "^pkgver=" | cut -c 8-)
ARCH=x86_64 VERSION="$VERSION" ./appimagetool -s ./"$APP".AppDir
cd .. && mv ./tmp/*.AppImage ./Bottles-"$VERSION"-4-x86_64.AppImage || exit 1