|
1 | 1 | #!/bin/sh |
2 | 2 |
|
3 | | -set -eux |
| 3 | +set -ex |
4 | 4 |
|
5 | | -APP=rofi |
6 | 5 | export ARCH="$(uname -m)" |
7 | 6 | export APPIMAGE_EXTRACT_AND_RUN=1 |
| 7 | +export URUNTIME_PRELOAD=1 |
8 | 8 |
|
9 | 9 | UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync" |
10 | | -LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin" |
| 10 | +SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-$ARCH-aio" |
11 | 11 | APPIMAGETOOL="https://github.com/pkgforge-dev/appimagetool-uruntime/releases/download/continuous/appimagetool-$ARCH.AppImage" |
12 | 12 |
|
13 | 13 | # CREATE DIRECTORIES |
14 | | -mkdir ./AppDir |
15 | | -cd ./AppDir |
16 | | - |
17 | | -# DOWNLOAD AND BUILD ROFI |
18 | | -git clone --depth 1 "https://github.com/davatorium/rofi.git" ./rofi && ( |
19 | | - cd ./rofi |
20 | | - meson --prefix /usr . build |
21 | | - meson compile -C build |
22 | | - meson install -C build --destdir "$(realpath ../)" |
| 14 | +mkdir ./AppDir && ( |
| 15 | + cd ./AppDir |
| 16 | + # DOWNLOAD AND BUILD ROFI |
| 17 | + git clone --depth 1 "https://github.com/davatorium/rofi.git" ./rofi && ( |
| 18 | + cd ./rofi |
| 19 | + meson --prefix /usr . build |
| 20 | + meson compile -C build |
| 21 | + meson install -C build --destdir "$(realpath ../)" |
| 22 | + ) |
| 23 | + mv -v ./usr/* ./ |
| 24 | + cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./ |
| 25 | + cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./.DirIcon |
| 26 | + cp -v ./share/applications/rofi.desktop ./ |
| 27 | + echo "Categories=Utility;" >> ./rofi.desktop |
| 28 | + |
| 29 | + # ADD LIBRARIES |
| 30 | + wget --retry-connrefused --tries=30 "$SHARUN" -O ./sharun-aio |
| 31 | + chmod +x ./sharun-aio |
| 32 | + ./sharun-aio l -p -v -k -s \ |
| 33 | + ./bin/* \ |
| 34 | + /usr/lib/gio/modules/* \ |
| 35 | + /usr/lib/gdk-pixbuf-*/*/*/* |
| 36 | + rm -f ./sharun-aio |
| 37 | + |
| 38 | + # We can't use the gdk variables here because that breaks child processes |
| 39 | + #git clone --depth 1 "https://github.com/fritzw/ld-preload-open" && ( |
| 40 | + # cd ./ld-preload-open |
| 41 | + # make all |
| 42 | + # mv ./path-mapping.so ../lib |
| 43 | + #) |
| 44 | + #mv -v ./shared/lib/gdk-pixbuf-* ./ |
| 45 | + #echo 'path-mapping.so' >./.preload |
| 46 | + #echo 'PATH_MAPPING=/usr/lib/gdk-pixbuf-2.0:${SHARUN_DIR}/gdk-pixbuf-2.0' >> ./.env |
| 47 | + rm -rf ./rofi ./usr ./ld-preload-open |
| 48 | + |
| 49 | + # AppRun |
| 50 | + cat > ./AppRun <<-'EOF' |
| 51 | + #!/bin/sh |
| 52 | + CURRENTDIR="$(dirname "$(readlink -f "$0")")" |
| 53 | + |
| 54 | + BIN="${ARGV0#./}" |
| 55 | + unset ARGV0 |
| 56 | + DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}" |
| 57 | + |
| 58 | + export XDG_DATA_DIRS="$DATADIR:$XDG_DATA_DIRS:/usr/local/share:/usr/share" |
| 59 | + export PATH="$CURRENTDIR/bin:$PATH" |
| 60 | + |
| 61 | + if [ ! -d "$DATADIR"/rofi/themes ]; then |
| 62 | + mkdir -p "$DATADIR"/rofi || exit 1 |
| 63 | + cp -rn "$CURRENTDIR"/share/rofi/themes "$DATADIR"/rofi/themes || exit 1 |
| 64 | + fi |
| 65 | + |
| 66 | + if [ "$1" = "rofi-theme-selector" ]; then |
| 67 | + shift |
| 68 | + exec "$CURRENTDIR/bin/rofi-theme-selector" "$@" |
| 69 | + elif [ -f "$CURRENTDIR/bin/$BIN" ]; then |
| 70 | + exec "$CURRENTDIR/bin/$BIN" "$@" |
| 71 | + else |
| 72 | + exec "$CURRENTDIR/bin/rofi" "$@" |
| 73 | + fi |
| 74 | + EOF |
| 75 | + |
| 76 | + chmod a+x ./AppRun |
| 77 | + ./sharun -g |
23 | 78 | ) |
24 | | -mv -v ./usr/* ./ |
25 | | -cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./ |
26 | | -cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./.DirIcon |
27 | | -cp -v ./share/applications/rofi.desktop ./ |
28 | | -echo "Categories=Utility;" >> ./rofi.desktop |
29 | | - |
30 | | -# ADD LIBRARIES |
31 | | -wget "$LIB4BN" -O ./lib4bin |
32 | | -chmod +x ./lib4bin |
33 | | -./lib4bin -p -v -k -s \ |
34 | | - ./bin/* \ |
35 | | - /usr/lib/gio/modules/* \ |
36 | | - /usr/lib/gdk-pixbuf-*/*/*/* |
37 | | - |
38 | | -# We can't use the gdk variables here because that breaks child processes |
39 | | -#git clone --depth 1 "https://github.com/fritzw/ld-preload-open" && ( |
40 | | -# cd ./ld-preload-open |
41 | | -# make all |
42 | | -# mv ./path-mapping.so ../lib |
43 | | -#) |
44 | | -#mv -v ./shared/lib/gdk-pixbuf-* ./ |
45 | | -#echo 'path-mapping.so' >./.preload |
46 | | -#echo 'PATH_MAPPING=/usr/lib/gdk-pixbuf-2.0:${SHARUN_DIR}/gdk-pixbuf-2.0' >> ./.env |
47 | | - |
48 | | -rm -rf ./rofi ./usr ./ld-preload-open |
49 | | - |
50 | | -# AppRun |
51 | | -echo '#!/bin/sh |
52 | | -CURRENTDIR="$(dirname "$(readlink -f "$0")")" |
53 | | -
|
54 | | -BIN="${ARGV0#./}" |
55 | | -unset ARGV0 |
56 | | -DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}" |
57 | 79 |
|
58 | | -export XDG_DATA_DIRS="$DATADIR:$XDG_DATA_DIRS:/usr/local/share:/usr/share" |
59 | | -export PATH="$CURRENTDIR/bin:$PATH" |
60 | | -
|
61 | | -if [ ! -d "$DATADIR"/rofi/themes ]; then |
62 | | - mkdir -p "$DATADIR"/rofi || exit 1 |
63 | | - cp -rn "$CURRENTDIR"/share/rofi/themes "$DATADIR"/rofi/themes || exit 1 |
64 | | -fi |
65 | | -
|
66 | | -if [ "$1" = "rofi-theme-selector" ]; then |
67 | | - shift |
68 | | - exec "$CURRENTDIR/bin/rofi-theme-selector" "$@" |
69 | | -elif [ -f "$CURRENTDIR/bin/$BIN" ]; then |
70 | | - exec "$CURRENTDIR/bin/$BIN" "$@" |
71 | | -else |
72 | | - exec "$CURRENTDIR/bin/rofi" "$@" |
73 | | -fi' > ./AppRun |
74 | | - |
75 | | -chmod a+x ./AppRun |
76 | | -./sharun -g |
77 | | - |
78 | | -# don't set XKB_CONFIG_ROOT since it breaks child processes |
79 | | -echo 'unset XKB_CONFIG_ROOT' >> ./.env |
80 | | - |
81 | | -export VERSION="$(./AppRun -v | awk 'FNR==1 {print $2; exit}')" |
| 80 | +export VERSION="$(./AppDir/AppRun -v | awk '{print $2; exit}')" |
82 | 81 | echo "$VERSION" > ~/version |
83 | 82 |
|
84 | 83 | # MAKE APPIMAGE WITH FUSE3 COMPATIBLE APPIMAGETOOL |
85 | | -cd .. |
86 | | -wget "$APPIMAGETOOL" -O ./appimagetool |
| 84 | +wget --retry-connrefused --tries=30 "$APPIMAGETOOL" -O ./appimagetool |
87 | 85 | chmod +x ./appimagetool |
88 | 86 |
|
89 | 87 | echo "Generating AppImage..." |
90 | | -URUNTIME_PRELOAD=1 ./appimagetool -n -u "$UPINFO" \ |
91 | | - "$PWD"/AppDir "$PWD"/"$APP"-"$VERSION"-anylinux-"$ARCH".AppImage |
| 88 | +./appimagetool -n -u "$UPINFO" \ |
| 89 | + "$PWD"/AppDir "$PWD"/rofi-"$VERSION"-anylinux-"$ARCH".AppImage |
| 90 | + |
| 91 | +mkdir -p ./dist |
| 92 | +mv -v ./*.AppImage* ./dist |
92 | 93 |
|
93 | 94 | echo "All Done!" |
0 commit comments