Skip to content

Instantly share code, notes, and snippets.

@0xAungkon
Created March 11, 2025 19:06
Show Gist options
  • Select an option

  • Save 0xAungkon/62c48d5260bf8d5e8492469f42696b64 to your computer and use it in GitHub Desktop.

Select an option

Save 0xAungkon/62c48d5260bf8d5e8492469f42696b64 to your computer and use it in GitHub Desktop.
NTOPNG Installation Fixed
#!/bin/sh -e
SUB_DISTRO=`lsb_release -i|cut -f 2`
if test "$SUB_DISTRO" = "Debian"; then
REL=`/usr/bin/lsb_release -c|cut -f 2`
else
REL=`/usr/bin/lsb_release -s -r`
fi
case "$1" in
configure)
#
MACHINE=`uname -m`
if test "$MACHINE" = "x86_64"; then
EXTN="x64"
MACHINE_DIR=
else
if test "$MACHINE" = "aarch64"; then
EXTN="arm64"
else
EXTN="armhf"
fi
REL=`lsb_release -c -s`"_pi"
fi
echo "deb [signed-by=/usr/share/keyrings/ntop-archive-keyring.gpg] https://packages.ntop.org/apt-stable/bullseye x64/" > /etc/apt/sources.list.d/ntop.list
echo "deb [signed-by=/usr/share/keyrings/ntop-archive-keyring.gpg] https://packages.ntop.org/apt-stable/bullseye all/" >> /etc/apt/sources.list.d/ntop.list
#
# if test -f /usr/share/keyrings/ntop-archive-keyring.gpg; then
# echo "ntop-archive-keyring.gpg already installed in /usr/share/keyrings/: nothing to do"
# exit 0
# fi
#
if ! test -d ~/.gnupg; then
mkdir ~/.gnupg
chown -R ${USER}:${USER} ~/.gnupg
chmod -R go-rwx ~/.gnupg
fi
# Export proxies
for protocol in http https
do
eval "$(apt-config shell ${protocol}_proxy Acquire::$protocol::Proxy)"
export "${protocol}_proxy"
done
if ${http_proxy+"false"}; then
if ! ${https_proxy+"false"}; then
PROXY=$https_proxy
fi
else
PROXY=$http_proxy
fi
RETRY=0
if ${PROXY+"false"} || [ -z ${PROXY} ]; then
echo "Installing ntop GPG key [no proxy]. Please wait..."
gpg --no-default-keyring --keyring /usr/share/keyrings/ntop-archive-keyring.gpg --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys 8E07231F05757F56FECE39773D84C955924F7599 || RETRY=1
else
echo "Installing ntop GPG key [using proxy $PROXY]. Please wait..."
gpg --keyserver-options http-proxy=$PROXY --no-default-keyring --keyring /usr/share/keyrings/ntop-archive-keyring.gpg --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys 8E07231F05757F56FECE39773D84C955924F7599 || RETRY=1
fi
if [ $RETRY -eq 0 ]; then
echo "Keys installed successfully"
else
echo "Installation error. Probably you have IPv6 not properly configured"
echo "Trying again over IPv4..."
if ${PROXY+"false"} || [ -z ${PROXY} ]; then
echo "Installing ntop GPG key [no proxy]. Please wait..."
gpg --no-default-keyring --keyring /usr/share/keyrings/ntop-archive-keyring.gpg --keyserver hkps://185.125.188.26:443 --recv-keys 8E07231F05757F56FECE39773D84C955924F7599
else
echo "Installing ntop GPG key [using proxy $PROXY]. Please wait..."
gpg --keyserver-options http-proxy=$PROXY --no-default-keyring --keyring /usr/share/keyrings/ntop-archive-keyring.gpg --keyserver hkps://185.125.188.26:443 --recv-keys 8E07231F05757F56FECE39773D84C955924F7599
fi
if [ $? -eq 0 ]; then
echo "Keys installed successfully"
fi
fi
#
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
exit 0
@0xAungkon

Copy link
Copy Markdown
Author
  1. Get the NTOPNG installer .deb extract it
  2. Replace the postint file
  3. Zip it
  4. Now install the installer.deb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment