#!/bin/sh
if [ "$SNAP_ARCH" = "amd64" ]; then
    ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" = "armhf" ]; then
    ARCH="arm-linux-gnueabihf"
else
    ARCH="$SNAP_ARCH-linux-gnu"
fi
export PATH="$SNAP/bin:$SNAP/usr/bin:$PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH"
export LD_LIBRARY_PATH="$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH"

LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH

export QT_PLUGIN_PATH=$SNAP/usr/lib/$ARCH/qt5/plugins

export XDG_CONFIG_HOME=$HOME/.config
CERT=$XDG_CONFIG_HOME/quassel-irc.org/quasselCert.pem
test ! -f $CERT && openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout $CERT -out $CERT -batch

exec $@
