#!/bin/bash

## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

if [ -f /usr/libexec/helper-scripts/pre.bsh ]; then
   source /usr/libexec/helper-scripts/pre.bsh
fi

set -e

true "
#####################################################################
## INFO: BEGIN: $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME $@
#####################################################################
"

## https://api.travis-ci.org/v3/job/669906596/log.txt
# Setting up kicksecure-network-conf (3:4.0-1) ...
# Adding 'diversion of /etc/resolv.conf to /etc/resolv.conf.kicksecure-orig by kicksecure-network-conf'
# dpkg-divert: error: unable to remove copied source file '/etc/resolv.conf': Device or resource busy
# dpkg: error processing package kicksecure-network-conf (--configure):
#  installed kicksecure-network-conf package post-installation script subprocess returned error exit status 2

## config-package-dev displace of /etc/resolv.conf broken on Travis CI.
## Therefore disabling errexit and ERR trap.
## https://api.travis-ci.org/v3/job/662802873/log.txt
## Adding 'diversion of /etc/resolv.conf to /etc/resolv.conf.kicksecure-orig by kicksecure-network-conf'
## dpkg-divert: error: unable to remove copied source file '/etc/resolv.conf': Device or resource busy
set +e
trap "" ERR

## Debugging.
ls -la /etc/resolv.conf || true
mount | grep /etc/resolv.conf || true
cat /etc/resolv.conf || true

true "INFO: debhelper beginning here."

#DEBHELPER#

true "INFO: Done with debhelper."

true "
#####################################################################
## INFO: END  : $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME $@
#####################################################################
"

## Explicitly "exit 0", so eventually trapped errors can be ignored.
exit 0
