2017-01-22 12:42:56 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# KeePassXC AppImage Recipe
|
|
|
|
# Copyright (C) 2017 KeePassXC team <https://keepassxc.org/>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 or (at your option)
|
|
|
|
# version 3 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
if [ "$1" == "" ] || [ "$2" == "" ]; then
|
|
|
|
echo "Usage: $(basename $0) APP_NAME RELEASE_VERSION" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f CHANGELOG ]; then
|
|
|
|
echo "This recipe must not be run from the sources root." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d ../bin-release ]; then
|
|
|
|
echo "../bin-release does not exist." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
APP="$1"
|
|
|
|
LOWERAPP="$(echo "$APP" | tr '[:upper:]' '[:lower:]')"
|
|
|
|
VERSION="$2"
|
2017-10-21 11:02:46 -04:00
|
|
|
export ARCH=x86_64
|
2017-01-22 12:42:56 -05:00
|
|
|
|
|
|
|
mkdir -p $APP.AppDir
|
2017-07-02 19:33:59 -04:00
|
|
|
wget -q https://github.com/AppImage/AppImages/raw/master/functions.sh -O ./functions.sh
|
2017-01-22 12:42:56 -05:00
|
|
|
. ./functions.sh
|
|
|
|
|
2017-02-06 13:52:21 -05:00
|
|
|
LIB_DIR=./usr/lib
|
|
|
|
if [ -d ./usr/lib/x86_64-linux-gnu ]; then
|
|
|
|
LIB_DIR=./usr/lib/x86_64-linux-gnu
|
2017-07-02 21:22:18 -04:00
|
|
|
elif [ -d ./usr/lib/i386-linux-gnu ]; then
|
|
|
|
LIB_DIR=./usr/lib/i386-linux-gnu
|
2017-10-21 11:02:46 -04:00
|
|
|
elif [ -d ./usr/lib64 ]; then
|
|
|
|
LIB_DIR=./usr/lib64
|
2017-02-06 13:52:21 -05:00
|
|
|
fi
|
|
|
|
|
2017-01-22 12:42:56 -05:00
|
|
|
cd $APP.AppDir
|
|
|
|
cp -a ../../bin-release/* .
|
2017-01-22 16:39:05 -05:00
|
|
|
cp -a ./usr/local/* ./usr
|
|
|
|
rm -R ./usr/local
|
2017-02-06 13:52:21 -05:00
|
|
|
rmdir ./opt 2> /dev/null
|
2017-01-22 12:42:56 -05:00
|
|
|
|
2017-01-28 20:24:12 -05:00
|
|
|
# bundle Qt platform plugins and themes
|
2017-10-21 11:02:46 -04:00
|
|
|
QXCB_PLUGIN="$(find /usr/lib* -name 'libqxcb.so' 2> /dev/null)"
|
2017-02-06 13:52:21 -05:00
|
|
|
if [ "$QXCB_PLUGIN" == "" ]; then
|
|
|
|
QXCB_PLUGIN="$(find /opt/qt*/plugins -name 'libqxcb.so' 2> /dev/null)"
|
|
|
|
fi
|
2017-01-22 19:06:31 -05:00
|
|
|
QT_PLUGIN_PATH="$(dirname $(dirname $QXCB_PLUGIN))"
|
2017-02-06 13:52:21 -05:00
|
|
|
mkdir -p ".${QT_PLUGIN_PATH}/platforms"
|
|
|
|
cp "$QXCB_PLUGIN" ".${QT_PLUGIN_PATH}/platforms/"
|
2017-01-22 19:06:31 -05:00
|
|
|
|
2017-01-22 12:42:56 -05:00
|
|
|
get_apprun
|
|
|
|
copy_deps
|
|
|
|
delete_blacklisted
|
|
|
|
|
2017-01-22 19:06:31 -05:00
|
|
|
# remove dbus and systemd libs as they are not blacklisted
|
|
|
|
find . -name libdbus-1.so.3 -exec rm {} \;
|
|
|
|
find . -name libsystemd.so.0 -exec rm {} \;
|
|
|
|
|
2017-01-22 12:42:56 -05:00
|
|
|
get_desktop
|
|
|
|
get_icon
|
2017-01-28 20:24:12 -05:00
|
|
|
cat << EOF > ./usr/bin/keepassxc_env
|
2017-01-30 12:36:11 -05:00
|
|
|
#!/usr/bin/env bash
|
2017-06-26 10:47:37 -04:00
|
|
|
export LD_LIBRARY_PATH="..$(dirname ${QT_PLUGIN_PATH})/lib:\${LD_LIBRARY_PATH}"
|
2017-10-16 11:01:37 -04:00
|
|
|
export QT_PLUGIN_PATH="..${QT_PLUGIN_PATH}:\${KPXC_QT_PLUGIN_PATH}"
|
2017-02-09 15:35:17 -05:00
|
|
|
|
|
|
|
# unset XDG_DATA_DIRS to make tray icon work in Ubuntu Unity
|
2017-10-21 14:32:41 -04:00
|
|
|
# see https://github.com/AppImage/AppImageKit/issues/351
|
2017-02-09 15:35:17 -05:00
|
|
|
unset XDG_DATA_DIRS
|
|
|
|
|
2017-10-21 14:32:41 -04:00
|
|
|
if [ "\${1}" == "cli" ]; then
|
|
|
|
shift
|
|
|
|
exec keepassxc-cli "\$@"
|
|
|
|
else
|
|
|
|
exec keepassxc "\$@"
|
|
|
|
fi
|
2017-01-28 20:24:12 -05:00
|
|
|
EOF
|
|
|
|
chmod +x ./usr/bin/keepassxc_env
|
2017-10-21 14:24:39 -04:00
|
|
|
sed -i 's/Exec=keepassxc/Exec=keepassxc_env/' org.keepassxc.desktop
|
2017-01-22 12:42:56 -05:00
|
|
|
get_desktopintegration $LOWERAPP
|
|
|
|
|
|
|
|
GLIBC_NEEDED=$(glibc_needed)
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2017-01-22 19:06:31 -05:00
|
|
|
generate_type2_appimage
|
2017-01-22 12:42:56 -05:00
|
|
|
|
2017-10-21 14:24:39 -04:00
|
|
|
mv ../out/*.AppImage ../KeePassXC-${VERSION}-${ARCH}.AppImage
|
2017-01-22 12:42:56 -05:00
|
|
|
rmdir ../out > /dev/null 2>&1
|