|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Script to make a universal appimage for PyImageFuser |
| 4 | +# version 0.1, 2022-05-22, hvdw |
| 5 | + |
| 6 | +# Requirements: |
| 7 | +# appimagetool: Download from https://github.com/AppImage/AppImageKit/releases |
| 8 | +# Necessary python3 modules |
| 9 | + |
| 10 | +# Specify the correct path (from the root path) |
| 11 | +EA="enfuse_ais" |
| 12 | + |
| 13 | +if [ "$1" = "" ] |
| 14 | +then |
| 15 | + printf "\n\nYou have to provide the version\n\n" |
| 16 | + exit |
| 17 | +fi |
| 18 | + |
| 19 | +VER="$1" |
| 20 | +WORKDIR=$(pwd) |
| 21 | +printf "\n\nWorkdir = $WORKDIR\n\n" |
| 22 | + |
| 23 | +printf "\n\nGo back to root folder of souce code\n" |
| 24 | +cd ../.. |
| 25 | +pwd |
| 26 | + |
| 27 | +printf "\nRemove possible previous build and dist folders and recreate binary\n\n" |
| 28 | +rm -rf dist build *.spec |
| 29 | +pyinstaller PyImageFuser.py |
| 30 | + |
| 31 | +#printf "\nNow copy enfuse & align_image_stack\n" |
| 32 | +#cp -r $EA dist/enfuse_ais |
| 33 | + |
| 34 | +#printf "\nCopy resources\n" |
| 35 | +#cp -r images docs dist |
| 36 | + |
| 37 | +printf "\n\nMove back to our AppImage folder\n\n" |
| 38 | +cd $WORKDIR |
| 39 | +# |
| 40 | +printf "Remove, create and step into our AppDir\n\n" |
| 41 | +# |
| 42 | +AppDir="PyImageFuser-x86_64" |
| 43 | +rm -rf ${AppDir} |
| 44 | +mkdir -p ${AppDir} |
| 45 | +cd ${AppDir} |
| 46 | + |
| 47 | +# |
| 48 | +printf "copy the our PyImageFsuer pyinstaller binary into this AppDir folder\n\n" |
| 49 | +# |
| 50 | +cp -r ../../../dist/PyImageFuser/* . |
| 51 | + |
| 52 | +# |
| 53 | +printf "Create folders and copy program icon and desktop file\n\n" |
| 54 | +# |
| 55 | +mkdir -p usr/bin |
| 56 | +mkdir -p usr/share/pyimagefuser |
| 57 | +mkdir -p usr/share/applications |
| 58 | +mkdir -p usr/share/metainfo |
| 59 | + |
| 60 | + |
| 61 | +cp ../../../images/logo.png usr/share/pyimagefuser |
| 62 | +cp ../../../images/logo.png . |
| 63 | +#mv jExifToolGUI.jar usr/share/pyimagefuser |
| 64 | +cp ../pyimagefuser.desktop usr/share/applications |
| 65 | +cp ../pyimagefuser.desktop . |
| 66 | +cp ../pyimagefuser.appdata.xml usr/share/metainfo |
| 67 | + |
| 68 | + |
| 69 | +printf "\n\nNow copy enfuse_ais, docs and images into our AppImage\n\n" |
| 70 | +cp -r ../../../images . |
| 71 | +cp -r ../../../docs . |
| 72 | +cp -r ../../../enfuse_ais/* . |
| 73 | + |
| 74 | +# |
| 75 | +printf "Create the AppRun script\n\n" |
| 76 | +# |
| 77 | +#cd usr/bin |
| 78 | +cat > ./AppRun <<\EOF |
| 79 | +#!/bin/sh |
| 80 | +HERE=$(dirname $(readlink -f "${0}")) |
| 81 | +export PATH="$APPDIR:$APPDIR/usr/bin:${HERE}/usr/local/bin:${HERE}/usr/bin:$PATH" |
| 82 | +"${HERE}"/PyImageFuser ${1+"$@"} & |
| 83 | +EOF |
| 84 | + |
| 85 | +chmod a+x ./AppRun |
| 86 | + |
| 87 | +# |
| 88 | +# We're done in the AppDir |
| 89 | +cd .. |
| 90 | +#rm ${AppDir}/${latest_exif} |
| 91 | + |
| 92 | +# |
| 93 | +# Create the AppImage |
| 94 | +# |
| 95 | +wget -c https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage |
| 96 | +chmod +x appimagetool-x86_64.AppImage |
| 97 | +ARCH=x86_64 ./appimagetool-x86_64.AppImage -n ${AppDir} |
| 98 | + |
| 99 | +# |
| 100 | +# Rename the created app image |
| 101 | +# |
| 102 | +mv PyImageFuser-x86_64.AppImage PyImageFuser-${VER}-x86_64.AppImage |
0 commit comments