HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/lib/dpkg/info/sane-utils.postinst
#!/bin/sh
set -e
. /usr/share/debconf/confmodule

SANED_DEFAULT=/etc/default/saned

#
# POSIX-compliant shell function
# to check for the existence of a command
# Return 0 if found
#
pathfind() {
    OLDIFS="$IFS"
    IFS=:
    for p in $PATH; do
        if [ -x "$p/$*" ]; then
            IFS="$OLDIFS"
            return 0
        fi
    done
    IFS="$OLDIFS"
    return 1
}



if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then
    db_get sane-utils/saned_run
    RUN_SANED="$RET"

    db_get sane-utils/saned_scanner_group
    SANED_IN_SCANNER="$RET"

    # Add saned service, disabled by default
    pathfind update-inetd
    if [ $? = 0 ]; then
	update-inetd --add "#<off># sane-port\tstream\ttcp\tnowait\tsaned:saned\t/usr/sbin/saned saned"
    fi

    # Stop debconf; output to stdout after this point. update-inetd needs debconf.
    db_stop

    # Create saned user/group if they do not exist
    if ! getent passwd | grep -q "^saned:"; then
	echo "Adding saned group and user..."
	adduser --home /var/lib/saned  --quiet --system --no-create-home --group saned || true
    fi

    # Move home from /home/saned to /var/lib/saned (since 1.0.24-6)
    if getent passwd | grep "^saned:" | grep -q "/home/saned"; then
	echo "Test for running scanbd"
	if ps -Af | grep "saned" | grep -q "scanbd"; then
	    echo "Stop scanbd"
	    invoke-rc.d --quiet scanbd stop
	    echo "Move homedir from /home/saned to /var/lib/saned"
	    usermod -d /var/lib/saned saned
	    echo "Start scanbd"
	    invoke-rc.d --quiet scanbd start
	else
	    echo "Move homedir from /home/saned to /var/lib/saned"
	    usermod -d /var/lib/saned saned
	fi
    fi
    if [ "$SANED_IN_SCANNER" = "true" ]; then
	adduser --quiet saned scanner
    else
	if id saned | grep -q "groups=.*\(scanner\)"; then
	    deluser --quiet saned scanner
	fi
    fi

    if [ -e $SANED_DEFAULT ]; then
	if [ "$RUN_SANED" = "true" ]; then
	    RUN_SANED=yes
	else
	    RUN_SANED=no
	fi

	sed -e "s/^ *RUN=.*/RUN=$RUN_SANED/" < $SANED_DEFAULT > $SANED_DEFAULT.tmp
	mv -f $SANED_DEFAULT.tmp $SANED_DEFAULT
    fi
fi

# Automatically added by dh_installinit/12.10ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/saned" ]; then
		update-rc.d saned defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d saned $_dh_action || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/12.10ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if deb-systemd-helper debian-installed 'saned.socket'; then
		# This will only remove masks created by d-s-h on package removal.
		deb-systemd-helper unmask 'saned.socket' >/dev/null || true

		if deb-systemd-helper --quiet was-enabled 'saned.socket'; then
			# Create new symlinks, if any.
			deb-systemd-helper enable 'saned.socket' >/dev/null || true
		fi
	fi

	# Update the statefile to add new symlinks (if any), which need to be cleaned
	# up on purge. Also remove old symlinks.
	deb-systemd-helper update-state 'saned.socket' >/dev/null || true
fi
# End automatically added section