Skip to content

Commit

Permalink
Merge pull request #145 from azubieta/pack_as_appimage
Browse files Browse the repository at this point in the history
Pack Moolticute as an AppImage
  • Loading branch information
raoulh authored Nov 10, 2017
2 parents e8d5a0f + 99a8f65 commit 8acef5b
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: '2'
services:
ubuntu:
cap_add:
- SYS_ADMIN
devices:
- "/dev/fuse:/dev/fuse"
environment:
- GITHUB_LOGIN=${GITHUB_LOGIN}
- GITHUB_TOKEN=${GITHUB_TOKEN}
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function create_github_release_linux()
local DEB_VERSION=$(echo $VERSION | tr 'v' ' ' | xargs)
local DEB_NAME="${PROJECT_NAME}_${DEB_VERSION}_amd64.deb"
local DEB_FILE="build-linux/deb/${DEB_NAME}"
local APPIMAGE_FILE=$(find build-appimage -iname '*.AppImage')
local EXE_FILE="$(ls win/build/*.exe 2> /dev/null | head -n 1)"

if [ -z "$VERSION" ]; then
Expand All @@ -241,6 +242,7 @@ function create_github_release_linux()
>&2 echo -e "Creating (Linux) GitHub release (tag: $VERSION)"

create_release_and_upload_asset $VERSION $DEB_FILE
create_release_and_upload_asset $VERSION $APPIMAGE_FILE
create_release_and_upload_asset $VERSION $EXE_FILE
}

Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/linux/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ echo "Building .deb package..."
$DOCKER_EXEC "cp -f README.md debian/README"
$DOCKER_EXEC "dpkg-buildpackage -b -us -uc && mkdir -p build-linux/deb && cp ../*.deb build-linux/deb"

echo "Building AppImage"
$DOCKER_EXEC "scripts/ci/linux/appimage.sh"

# GitHub release
$DOCKER_EXEC \
"export TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG} PROJECT_NAME=${PROJECT_NAME} TRAVIS_OS_NAME=${TRAVIS_OS_NAME} \
Expand Down
155 changes: 155 additions & 0 deletions scripts/ci/linux/appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#!/bin/bash

########################################################################
# Package the binaries built on Travis-CI as an AppImage
# By Simon Peter 2016
# Modified for Moolticute by Alexis López 2017
# For more information, see http://appimage.org/
########################################################################


export ARCH=$(arch)

APP=moolticute
LOWERAPP=${APP,,}

BASE_PATH=$PWD/build-appimage/
APPDIR=$BASE_PATH/$APP/$APP.AppDir/
TARGET_DIR=$APPDIR/usr/

mkdir -p $TARGET_DIR

SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPTDIR/appimage_functions.sh
source $SCRIPTDIR/../funcs.sh

########################################################################
# Install application binaries to the AppDir
########################################################################
cp ./debian/moolticute/usr/* $TARGET_DIR -r

########################################################################
# Generate .desketop file and icon
########################################################################

echo "[Desktop Entry]
Version=1.0
Type=Application
Name=Moolticute
Comment=Moolticute allows your browser extensions to talk with the Mooltipass.
TryExec=moolticute
Exec=moolticute %F
Icon=moolticute" > $BASE_PATH/$APP/$APP.AppDir/moolticute.desktop

cp ./img/AppIcon.svg $BASE_PATH/$APP/$APP.AppDir/moolticute.svg

########################################################################
# Copy desktop and icon file to AppDir for AppRun to pick them up
########################################################################
cd $BASE_PATH/$APP/$APP.AppDir

get_apprun
# get_desktop
# get_icon

cd ..
########################################################################
# Other appliaction-specific finishing touches
########################################################################

# Bundle Qt and all the plugins needed

generate_status

echo "deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse" > sources.list
apt-get $OPTIONS update

cd ./$APP.AppDir/


apt-get install -y \
fuse \
libfuse-dev \
libfuse2 \
libc6 \
libgcc1 \
libqt5core5a \
libqt5gui5 \
libqt5network5 \
libqt5websockets5 \
libqt5widgets5 \
libstdc++6 \
libusb-1.0-0

apt-get install -f -y

########################################################################
# Copy in the dependencies that cannot be assumed to be available
# on all target systems
########################################################################

# copy all qt platform plugins
mkdir -p $TARGET_DIR/lib/x86_64-linux-gnu/qt5/plugins/platforms/
cp -r /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/* $TARGET_DIR/lib/x86_64-linux-gnu/qt5/plugins/platforms/

list=$(find $TARGET_DIR -type f)
for bynary in $list; do
if [ -f $bynary ]; then
deps=$(ldd $bynary | cut -d ' ' -f 3)
for file in $deps; do
if [ -f $file ]; then
DIR=$(dirname "${file}")
mkdir -p ${APPDIR}${DIR}
cp $file ${APPDIR}${file}
fi
done
fi;
done

copy_deps

########################################################################
# Delete stuff that should not go into the AppImage
########################################################################

# Delete dangerous libraries; see
# https://github.com/probonopd/AppImages/blob/master/excludelist
delete_blacklisted
find . -name *harfbuzz* -delete

########################################################################
# desktopintegration asks the user on first run to install a menu item
########################################################################

get_desktopintegration $LOWERAPP

########################################################################
# Determine the version of the app; also include needed glibc version
########################################################################

echo "OLD VERSION $VERSION"
VERSION=$(get_version .)
echo "new version $VERSION"

########################################################################
# Patch away absolute paths; it would be nice if they were relative
########################################################################

find usr/ -type f -exec sed -i -e 's|/usr|././|g' {} \;
find usr/ -type f -exec sed -i -e 's@././/bin/env@/usr/bin/env@g' {} \;

########################################################################
# AppDir complete
# Now packaging it as an AppImage
########################################################################

cd .. # Go out of AppImage

generate_type2_appimage

########################################################################
# Upload the AppDir
########################################################################

# curl --upload-file *.AppImage https://transfer.sh/Moolticute.AppImage
# echo "AppImage has been uploaded to the URL above; use something like GitHub Releases for permanent storage"
Loading

0 comments on commit 8acef5b

Please sign in to comment.