HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux sci 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: tpdc (1002)
PHP: 7.4.3-4ubuntu2.29
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/samba-common.config
#!/bin/sh

set -e
# Source debconf library.
. /usr/share/debconf/confmodule

# Function for grabbing a parameter from an smb.conf file
smbconf_retr() {
	if [ -z "$1" ]; then
		return
	fi

	if [ -n "$2" ]; then
		local FILE="$2"
	fi

	if [ -z "$FILE" ]; then
		return
	fi

	sed -n -e"
		s/^[[:space:]]*\[global\]/\[global\]/i
		/^\[global\]/,/^[[:space:]]*\[/ {
			s/^[[:space:]]*$1[[:space:]]*=[[:space:]]*//pi
		}" $FILE \
	| tail -n 1
}

FILE=/etc/samba/smb.conf

db_settitle samba-common/title

# We ask the question IFF the config contains complex options that could
# cause us to break the config.
if [ -f "$FILE" ] && grep -v dhcp.conf $FILE \
                     | grep -qEi '\\$|^[[:space:]]*include[[:space:]]*='
then
	db_input high samba-common/do_debconf || true
	db_go
else
	db_set samba-common/do_debconf true
fi

# If user doesn't want to use debconf to configure Samba the leave...
db_get samba-common/do_debconf || true
if [ "${RET}" = "false" ]; then
	exit 0
fi

# User wants to use debconf, let's continue...

# Preload any values from the existing smb.conf file
if [ -f $FILE ]; then
	WORKGROUP=`smbconf_retr workgroup`
	if [ "$WORKGROUP" ]; then
		db_set samba-common/workgroup "$WORKGROUP"
	fi

fi

# Get workgroup name
db_input medium samba-common/workgroup || true
db_go

DHCPPRIORITY=medium
#if [ "$DEBCONF_RECONFIGURE" = 1 ] && [ -f /sbin/dhclient ]
#if [ -f /sbin/dhclient ]
#then
#	DHCPPRIORITY=high
# TODO: see if we can detect that dhcp-client is *going* to be installed,
# even if it isn't yet.
#elif dpkg-query -W --showformat='${Status}\n' dhcp-client | grep ???
# unknown ok not-installed ? 
#	DHCPPRIORITY=high
#fi

FOUND=false
if [ -f $FILE ]; then
	if grep -q 'include[[:space:]]*=[[:space:]]*/etc/samba/dhcp.conf' $FILE
	then
		FOUND=true
	fi
	if grep -q 'include[[:space:]]*=[[:space:]]*/var/lib/samba/dhcp.conf' $FILE
	then
		FOUND=true
	fi
	db_set samba-common/dhcp $FOUND
fi

# we only prompt in one of three cases: the file doesn't exist yet, it
# has the context we need to add our include line, or the include line
# is already present.
if [ ! -f $FILE ] || grep -q -i 'wins server' $FILE || [ "$FOUND" = "true" ];
then
	db_input $DHCPPRIORITY samba-common/dhcp || true
	db_go
fi