Skip to content

Commit 8447c09

Browse files
authored
Update htop-appimage.sh
1 parent 4ec35cf commit 8447c09

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

htop-appimage.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
#!/bin/sh
22

33
APP=htop
4+
APPDIR="$APP".AppDir
45
SITE="htop-dev/htop"
56

67
# CREATE DIRECTORIES
78
if [ -z "$APP" ]; then exit 1; fi
8-
mkdir -p "./$APP/tmp" "./$APP/src" "./$APP/$APP.AppDir/usr/bin" && cd "./$APP/tmp" || exit 1
9+
mkdir -p ./"$APP/$APPDIR" && cd ./"$APP/$APPDIR" || exit 1
910

1011
# DOWNLOAD AND BUILD HTOP
11-
version=$(wget -q https://api.github.com/repos/$SITE/releases -O - | grep browser_download_url | grep -i tar.xz | cut -d '"' -f 4 | head -1)
12-
wget "$version" && tar fx ./*tar* && cd .. && mv --backup=t ./tmp/*/* ./src
13-
cd ./src && ./autogen.sh && ./configure && make || exit 1
12+
CURRENTDIR="$(readlink -f "$(dirname "$0")")" # DO NOT MOVE THIS
13+
version=$(wget -q https://api.github.com/repos/$SITE/releases -O - | sed 's/[()",{}]/ /g; s/ /\n/g' | grep -o 'https.*releases.*htop.*tar.xz' | head -1)
14+
wget "$version" && tar fx ./*tar* && cd ./htop* && ./autogen.sh && ./configure --prefix="$CURRENTDIR" && make && make install && cd .. && rm -rf ./htop* ./*tar* || exit 1
1415

1516
# PREPARE APPIMAGE
16-
cd .. && mv ./src/htop "./$APP.AppDir/usr/bin" && mv ./src/*.png "./$APP.AppDir/$APP.png" && mv ./src/*.desktop "./$APP.AppDir/$APP.desktop"
17-
cd "./$APP.AppDir" && ln -s "./$APP.png" ./.DirIcon || exit 1
17+
cp ./share/applications/*.desktop ./ && cp ./share/icons/*/*/*/* ./htop.svg && ln -s ./htop.svg ./.DirIcon || exit 1
1818

1919
# AppRun
2020
cat >> ./AppRun << 'EOF'
2121
#!/bin/sh
2222
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
23-
exec "$CURRENTDIR/usr/bin/htop" "$@"
23+
"$CURRENTDIR/bin/htop" "$@"
2424
EOF
2525
chmod a+x ./AppRun
2626

27+
APPVERSION=$(./AppRun -V)
28+
if [ -z "$APPVERSION" ]; then echo "Failed to get version from zenity"; exit 1; fi
29+
2730
# MAKE APPIMAGE
2831
cd ..
2932
APPIMAGETOOL=$(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$')
3033
wget -q "$APPIMAGETOOL" -O ./appimagetool && chmod a+x ./appimagetool
3134

3235
# Do the thing!
33-
ARCH=x86_64 VERSION=$(./appimagetool -v | grep -o '[[:digit:]]*') ./appimagetool -s ./$APP.AppDir
36+
ARCH=x86_64 VERSION="$APPVERSION" ./appimagetool -s ./"$APPDIR"
3437
ls ./*.AppImage || { echo "appimagetool failed to make the appimage"; exit 1; }
35-
36-
APPNAME=$(ls *AppImage)
37-
APPVERSION=$(echo $version | awk -F / '{print $(NF-1)}')
38-
mv ./*AppImage ./"$APPVERSION"-"$APPNAME"
3938
if [ -z "$APP" ]; then exit 1; fi # Being extra safe lol
4039
mv ./*.AppImage .. && cd .. && rm -rf "./$APP"
4140
echo "All Done!"

0 commit comments

Comments
 (0)