#!/usr/bin/sh
#----------------------------------------------------------------------------
# /tmp/preinstall.sh - hplip-cups preinstallation
#
# Creation   :  2026-02-25 holbru
# Last update:  $Id$
#
# Copyright (c) 2026-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------

# set package name
package_name=hplip-cups

# ---------------------------------------------------------------------------
# cleqn up
# ---------------------------------------------------------------------------
installed=$(/usr/bin/eisman check hplip 3.6.2)
if [ "${installed}" = "new" ]
then
    if [ -f /etc/filelist.d/hplip-files.txt ]
    then
        /usr/bin/sed -i '/cups\/backend\/hpfax$/d' /etc/filelist.d/hplip-files.txt
        /usr/bin/sed -i '/cups\/filter\/hpps$/d' /etc/filelist.d/hplip-files.txt
    fi
fi
installed=$(/usr/bin/eisman check hplip-hpijs)
if [ "${installed}" = "installed" ]
then
    if [ -f /etc/filelist.d/hplip-hpijs-files.txt ]
    then
        /usr/bin/sed -i '/cups\/backend\/hp$/d' /etc/filelist.d/hplip-hpijs-files.txt
        /usr/bin/sed -i '/cups\/filter\/hpcdmfax$/d' /etc/filelist.d/hplip-hpijs-files.txt
        /usr/bin/sed -i '/cups\/filter\/hpcups$/d' /etc/filelist.d/hplip-hpijs-files.txt
        /usr/bin/sed -i '/cups\/filter\/hpcupsfax$/d' /etc/filelist.d/hplip-hpijs-files.txt
        /usr/bin/sed -i '/cups\/filter\/pstotiff$/d' /etc/filelist.d/hplip-hpijs-files.txt
    fi
fi

exit 0
# ---------------------------------------------------------------------------
# end
# ---------------------------------------------------------------------------
