post_install() {
    :
#!/bin/bash

if type update-alternatives 2>/dev/null >&1; then
    # Remove previous link if it doesn't use update-alternatives
    if [ -L '/usr/bin/jointhisgame-desktop' -a -e '/usr/bin/jointhisgame-desktop' -a "`readlink '/usr/bin/jointhisgame-desktop'`" != '/etc/alternatives/jointhisgame-desktop' ]; then
        rm -f '/usr/bin/jointhisgame-desktop'
    fi
    update-alternatives --install '/usr/bin/jointhisgame-desktop' 'jointhisgame-desktop' '/opt/JoinThisGame/jointhisgame-desktop' 100 || ln -sf '/opt/JoinThisGame/jointhisgame-desktop' '/usr/bin/jointhisgame-desktop'
else
    ln -sf '/opt/JoinThisGame/jointhisgame-desktop' '/usr/bin/jointhisgame-desktop'
fi

# SUID chrome-sandbox for Electron 5+
chmod 4755 '/opt/JoinThisGame/chrome-sandbox' || true

if hash update-mime-database 2>/dev/null; then
    update-mime-database /usr/share/mime || true
fi

if hash update-desktop-database 2>/dev/null; then
    update-desktop-database /usr/share/applications || true
fi

}
post_remove() {
    :
#!/bin/bash

# Delete the link to the binary
if type update-alternatives >/dev/null 2>&1; then
    update-alternatives --remove 'jointhisgame-desktop' '/usr/bin/jointhisgame-desktop'
else
    rm -f '/usr/bin/jointhisgame-desktop'
fi

}
