Skip to content

Instantly share code, notes, and snippets.

@simoniz0r
Created September 28, 2017 05:47
Show Gist options
  • Save simoniz0r/b74668c8b925118aa23a6eef1c6fdac0 to your computer and use it in GitHub Desktop.
Save simoniz0r/b74668c8b925118aa23a6eef1c6fdac0 to your computer and use it in GitHub Desktop.
Bash script for building AppImage release of lftp
#!/bin/bash -e
# Script for building AppImage release of lftp
BUILD_DIR="$HOME/AppImages/lftp"
VERSION="4.8.1-1"
mkdir -p "$BUILD_DIR"/deps/extracted
mkdir "$BUILD_DIR"/lftp.AppDir
wget --no-verbose --read-timeout=30 "http://ftp.us.debian.org/debian/pool/main/l/lftp/lftp_4.8.1-1_amd64.deb" -O "$BUILD_DIR"/deps/lftp.deb
wget --no-verbose --read-timeout=30 "http://ftp.us.debian.org/debian/pool/main/g/gnutls28/libgnutls30_3.5.8-5+deb9u2_amd64.deb" -O "$BUILD_DIR"/deps/libgnutls30.deb
wget --no-verbose --read-timeout=30 "http://ftp.us.debian.org/debian/pool/main/libi/libidn2-0/libidn2-0_2.0.2-5_amd64.deb" -O "$BUILD_DIR"/deps/libidn2.deb
wget --no-verbose --read-timeout=30 "http://ftp.us.debian.org/debian/pool/main/r/readline/libreadline7_7.0-3_amd64.deb" -O "$BUILD_DIR"/deps/libreadline7.deb
wget --no-verbose --read-timeout=30 "http://ftp.us.debian.org/debian/pool/main/libu/libunistring/libunistring2_0.9.7-2_amd64.deb" -O "$BUILD_DIR"/deps/libunistring2.deb
cd "$BUILD_DIR"/deps/extracted
debextractfunc () {
ar x "$BUILD_DIR"/deps/"$1"
rm -f "$BUILD_DIR"/deps/extracted/control.tar.gz
rm -f "$BUILD_DIR"/deps/extracted/debian-binary
tar -xf "$BUILD_DIR"/deps/extracted/data.tar.* -C "$BUILD_DIR"/deps/extracted/
rm -f "$BUILD_DIR"/deps/extracted/data.tar.*
cp -r "$BUILD_DIR"/deps/extracted/* "$BUILD_DIR"/lftp.AppDir/
rm -rf "$BUILD_DIR"/deps/extracted/*
}
debextractfunc "lftp.deb"
debextractfunc "libgnutls30.deb"
debextractfunc "libidn2.deb"
debextractfunc "libreadline7.deb"
debextractfunc "libunistring2.deb"
rm -rf "$BUILD_DIR"/deps
cp "$BUILD_DIR"/lftp.AppDir/usr/share/applications/lftp.desktop "$BUILD_DIR"/lftp.AppDir/
cp "$BUILD_DIR"/lftp.AppDir/usr/share/icons/hicolor/48x48/apps/lftp-icon.png "$BUILD_DIR"/lftp.AppDir/
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64" -O "$BUILD_DIR"/lftp.AppDir/AppRun
chmod a+x "$BUILD_DIR"/lftp.AppDir/AppRun
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O "$BUILD_DIR"/appimagetool
chmod a+x "$BUILD_DIR"/appimagetool
"$BUILD_DIR"/appimagetool "$BUILD_DIR"/lftp.AppDir "$BUILD_DIR"/lftp-"$VERSION"-x86_64.AppImage || exit 1
rm -rf "$BUILD_DIR"/lftp.AppDir
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment