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/rp-play-max-linux' -a -e '/usr/bin/rp-play-max-linux' -a "`readlink '/usr/bin/rp-play-max-linux'`" != '/etc/alternatives/rp-play-max-linux' ]; then
        rm -f '/usr/bin/rp-play-max-linux'
    fi
    update-alternatives --install '/usr/bin/rp-play-max-linux' 'rp-play-max-linux' '/opt/RP - Play Max/rp-play-max-linux' 100 || ln -sf '/opt/RP - Play Max/rp-play-max-linux' '/usr/bin/rp-play-max-linux'
else
    ln -sf '/opt/RP - Play Max/rp-play-max-linux' '/usr/bin/rp-play-max-linux'
fi

# Check if user namespaces are supported by the kernel and working with a quick test:
if ! { [[ -L /proc/self/ns/user ]] && unshare --user true; }; then
    # Use SUID chrome-sandbox only on systems without user namespaces:
    chmod 4755 '/opt/RP - Play Max/chrome-sandbox' || true
else
    chmod 0755 '/opt/RP - Play Max/chrome-sandbox' || true
fi

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 'rp-play-max-linux' '/usr/bin/rp-play-max-linux'
else
    rm -f '/usr/bin/rp-play-max-linux'
fi

}
