#!/bin/bash

version=3.9.3
adoptium_installer || exit 1
# install temurin-17-jre first so that when apt looks for "Provides: java11-runtime" to satisfy ipscan dependencies it will be there
install_packages temurin-17-jre libswt-cairo-gtk-4-jni libswt-gtk-4-java libswt-gtk-4-jni || exit 1
install_packages rpm fakeroot "https://github.com/angryip/ipscan/releases/download/${version}/ipscan_${version}_all.deb" || exit 1
# hack due to upstream bug: https://github.com/adoptium/temurin-build/issues/3552
sudo sed -i 's,UNNAMED -jar,UNNAMED -Djava.library.path=/usr/lib/java:/usr/lib/jni -jar,g' /usr/bin/ipscan || true
