-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhypnotix-deb.sh
137 lines (115 loc) · 6.08 KB
/
hypnotix-deb.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
#!/usr/bin/env bash
APP=hypnotix
VERSION=$(wget -q "http://packages.linuxmint.com/search.php?release=any§ion=any&keyword=hypnotix" -O - | grep -Po '(?<=href=")[^"]*' | grep "_all.deb" | sort | tail -1 | grep -o -P '(?<=hypnotix_).*(?=_all.deb)')
# CREATE A TEMPORARY DIRECTORY
mkdir -p tmp
cd tmp
# DOWNLOADING THE DEPENDENCIES
if test -f ./appimagetool; then
echo " appimagetool already exists" 1> /dev/null
else
echo " Downloading appimagetool..."
wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
fi
if test -f ./pkg2appimage; then
echo " pkg2appimage already exists" 1> /dev/null
else
echo " Downloading pkg2appimage..."
wget -q https://raw.githubusercontent.com/ivan-hc/AM-application-manager/main/tools/pkg2appimage
fi
chmod a+x ./appimagetool ./pkg2appimage
rm -f ./recipe.yml
# CREATING THE HEAD OF THE RECIPE
echo "app: $APP
binpatch: true
ingredients:
dist: stable
script:
- wget http://packages.linuxmint.com/$(wget -q "http://packages.linuxmint.com/search.php?release=any§ion=any&keyword=hypnotix" -O - | grep -Po '(?<=href=")[^"]*' | grep "_all.deb" | sort | tail -1)
- wget http://packages.linuxmint.com/$(wget -q "http://packages.linuxmint.com/search.php?release=any§ion=any&keyword=imdb" -O - | grep -Po '(?<=href=")[^"]*' | grep "python" | grep "_all.deb" | sort | tail -1)
- wget http://packages.linuxmint.com/$(wget -q "http://packages.linuxmint.com/search.php?release=any§ion=any&keyword=circle-flags-svg" -O - | grep -Po '(?<=href=")[^"]*' | grep "_all.deb" | sort | tail -1)
sources:
- deb http://ftp.debian.org/debian/ stable main contrib non-free
- deb http://security.debian.org/debian-security/ stable-security main contrib non-free
- deb http://ftp.debian.org/debian/ stable-updates main contrib non-free
packages:
- $APP
- circle-flags-svg
- dconf-gsettings-backend
- gir1.2-xapp-1.0
- gsettings-backend
- libmpv-dev
- python3
- python3-gi
- python3-gi-cairo
- python3-imdbpy
- python3-requests
- python3-setproctitle
- python3-unidecode
- xapps-common" >> recipe.yml
# DOWNLOAD ALL THE NEEDED PACKAGES AND COMPILE THE APPDIR
./pkg2appimage ./recipe.yml
# LIBUNIONPRELOAD
wget https://github.com/project-portable/libunionpreload/releases/download/amd64/libunionpreload.so
chmod a+x libunionpreload.so
mv ./libunionpreload.so ./$APP/$APP.AppDir/
# COMPILE SCHEMAS
glib-compile-schemas ./$APP/$APP.AppDir/usr/share/glib-2.0/schemas/ || echo "No ./usr/share/glib-2.0/schemas/"
# CUSTOMIZE THE APPRUN
rm -R -f ./$APP/$APP.AppDir/AppRun
cat >> ./$APP/$APP.AppDir/AppRun << 'EOF'
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
export UNION_PRELOAD="${HERE}"
export LD_PRELOAD="${HERE}"/libunionpreload.so
export LD_LIBRARY_PATH=/lib/:/lib64/:/lib/x86_64-linux-gnu/:/usr/lib/:"${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${LD_LIBRARY_PATH}"
#export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${LD_LIBRARY_PATH}"
export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${PATH}"
PYTHON_VERSION=$(find "${HERE}"/usr/lib -name *python* -type d | head -1 | sed 's:.*/::')
export PYTHONPATH="${HERE}/usr/lib/$PYTHON_VERSION":$"${PYTHONPATH}"
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
export PERLLIB="${HERE}"/usr/share/perl5/:"${HERE}"/usr/lib/perl5/:"${PERLLIB}"
mkdir -p ~/.cache/hypnotix/favorites
touch ~/.cache/hypnotix/favorites/list
mkdir -p ~/.cache/hypnotix/yt-dlp
if [ $(gsettings get org.x.hypnotix use-local-ytdlp) = true ]
then
echo "Local version of yt-dlp selected."
export PATH="${HOME}/.cache/hypnotix/yt-dlp":${PATH}
else
echo "System version of yt-dlp selected."
fi
"${HERE}"/usr/lib/hypnotix/hypnotix.py
EOF
# MADE THE APPRUN EXECUTABLE
chmod a+x ./$APP/$APP.AppDir/AppRun
# END OF THE PART RELATED TO THE APPRUN, NOW WE WELL SEE IF EVERYTHING WORKS ----------------------------------------------------------------------
# IMPORT THE LAUNCHER AND THE ICON TO THE APPDIR IF THEY NOT EXIST
if test -f ./$APP/$APP.AppDir/*.desktop; then
echo "The desktop file exists"
else
echo "Trying to get the .desktop file"
cp ./$APP/$APP.AppDir/usr/share/applications/*$(ls . | grep -i $APP | cut -c -4)*desktop ./$APP/$APP.AppDir/ 2>/dev/null
fi
ICONNAME=$(cat ./$APP/$APP.AppDir/*desktop | grep "Icon=" | head -1 | cut -c 6-)
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/22x22/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/24x24/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/32x32/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/48x48/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/64x64/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/128x128/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/256x256/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/512x512/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/scalable/apps/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
cp ./$APP/$APP.AppDir/usr/share/applications/*$ICONNAME* ./$APP/$APP.AppDir/ 2>/dev/null
# PATCH
sed -i 's/self.dark_mode_manager/#self.dark_mode_manager/g' ./$APP/$APP.AppDir/usr/lib/hypnotix/hypnotix.py
# REMOVE UNNEEDED FILES
find ./$APP/$APP.AppDir/usr/share/doc/* -not -iname "*$APP*" -a -not -name "." -delete
find ./$APP/$APP.AppDir/usr/share/locale/* -not -iname "*$APP*" -a -not -name "." -delete
rm -R -f ./$APP/$APP.AppDir/usr/include
# EXPORT THE APP TO AN APPIMAGE
ARCH=x86_64 ./appimagetool -n ./$APP/$APP.AppDir
cd ..
mv ./tmp/*.AppImage ./Hypnotix-$VERSION-x86_64.AppImage
chmod a+x *.AppImage