-
Notifications
You must be signed in to change notification settings - Fork 0
/
deadbeef-stable-appimage.sh
85 lines (66 loc) · 3 KB
/
deadbeef-stable-appimage.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
#!/bin/sh
set -eu
APP=DeaDBeeF
SITE="$(wget -q https://sourceforge.net/projects/deadbeef/files/travis/linux/ -O - \
| grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep download | grep -vE 'master|feature|bugfix' | head -1 | sed 's/download//g')"
TARGET_BIN="deadbeef"
DESKTOP="https://raw.githubusercontent.com/DeaDBeeF-Player/deadbeef/master/deadbeef.desktop.in"
ICON="https://raw.githubusercontent.com/DeaDBeeF-Player/deadbeef/master/icons/scalable/deadbeef.svg"
export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1
APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
UPINFO="gh-releases-zsync|$(echo $GITHUB_REPOSITORY | tr '/' '|')|continuous|*$ARCH.AppImage.zsync"
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
# Prepare AppDir
mkdir -p "$APP"/AppDir/usr/share/applications
cd "$APP"/AppDir
url="$(wget -q "$SITE" -O - | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | sort -u | grep "x86_64.tar.bz2")"
wget $url -O download.tar.bz2
tar fx ./*.tar*
rm -f ./*.tar*
mv ./deadbeef* ./usr/bin
mv ./usr/bin/lib ./usr/lib
wget "$DESKTOP" -O ./"$APP".desktop
wget "$ICON" -O ./deadbeef.svg
export VERSION="$(echo "$url" | awk -F"_" '{print $2}')"
cp ./"$APP".desktop ./usr/share/applications
# Deploy all libs
cp -vn /usr/lib/libgtk-* ./usr/lib
ldd ./usr/lib/* | awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./usr/lib
ldd ./usr/bin/deadbeef | awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./usr/lib
ldd ./usr/bin/plugins/* | awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./usr/lib || true
cp -vn /lib64/ld-linux-x86-64.so.2 ./usr/lib
# DEPLOY GDK
echo "Deploying gdk..."
GDK_PATH="$(find /usr/lib -type d -regex ".*/gdk-pixbuf-2.0" -print -quit)"
cp -rv "$GDK_PATH" ./usr/lib
echo "Deploying gdk deps..."
find ./usr/lib/gdk-pixbuf-2.0 -type f -name '*.so*' -exec ldd {} \; \
| awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./usr/lib
find ./usr/lib -type f -regex '.*gdk.*loaders.cache' \
-exec sed -i 's|/.*lib.*/gdk-pixbuf.*/.*/loaders/||g' {} \;
( cd ./usr/lib && ln -s ./gdk-pixbuf*/*/loaders/* ./ )
# Create AppRun
echo '#!/bin/sh
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
GDK_HERE="$(find "$CURRENTDIR" -type d -regex '.*gdk.*loaders' -print -quit)"
GDK_LOADER="$(find "$CURRENTDIR" -type f -regex '.*gdk.*loaders.cache' -print -quit)"
export GDK_PIXBUF_MODULEDIR="$GDK_HERE"
export GDK_PIXBUF_MODULE_FILE="$GDK_LOADER"
exec "$CURRENTDIR"/usr/lib/ld-linux-x86-64.so.2 \
--library-path "$CURRENTDIR"/usr/lib \
"$CURRENTDIR"/usr/bin/deadbeef "$@"' > ./AppRun
chmod +x ./AppRun
# Strip everything
find ./usr -type f -exec strip -s -R .comment --strip-unneeded {} ';'
# MAKE APPIAMGE WITH FUSE3 COMPATIBLE APPIMAGETOOL
cd ..
wget -q "$APPIMAGETOOL" -O ./appimagetool
chmod +x ./appimagetool
./appimagetool --comp zstd \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \
-n -u "$UPINFO" "$PWD"/AppDir "$PWD"/"$APP"-"$VERSION"-anylinux-"$ARCH".AppImage
mv ./*.AppImage* ../
cd ..
rm -rf ./"$APP"
echo "All Done!"