#!/bin/sh set -e . /usr/share/debconf/confmodule db_title "Samba Server" SERVER_ROLE=`samba-tool testparm --parameter-name="server role" 2>/dev/null | tail -1` if [ ! -z "$SERVER_ROLE" ]; then db_set samba4/server-role "$SERVER_ROLE" fi REALM=`samba-tool testparm --parameter-name=realm 2>/dev/null | tail -1` if [ -z "$REALM" ]; then REALM=`hostname -d | tr 'a-z' 'A-Z'` fi if [ -z "$REALM" ]; then # Default to localdomain if there are no good alternatives. REALM=localdomain fi db_set samba4/realm "$REALM" # # Are we upgrading from Samba 3, and already have a configuration file? # If so, the user might want to try the automatic upgrading. # if [ -n "$2" ] && dpkg --compare-versions "$2" lt "3.9.0"; then if [ -f /etc/samba/smb.conf ]; then db_input medium samba4/upgrade-from-v3 || true fi fi db_input high samba4/server-role || true db_go db_get samba4/server-role if [ "$RET" != "none" ]; then db_input medium samba4/realm || true db_go || true fi # only ask this question on installs that require provisioning if [ "$1" = "configure" ] && ([ -z "$2" ] && [ ! -e "/var/lib/samba/private/sam.ldb" ] ) || [ "$1" = "reconfigure" ]; then while :; do RET="" db_input high samba4/admin_password || true db_go db_get samba4/admin_password # if password isn't empty we ask for password verification if [ -z "$RET" ]; then db_fset samba4/admin_password seen false db_fset samba4/admin_password_again seen false break fi ADMIN_PW="$RET" db_input high samba4/admin_password_again || true db_go db_get samba4/admin_password_again if [ "$RET" = "$ADMIN_PW" ]; then ADMIN_PW='' break fi db_fset samba4/password_mismatch seen false db_input critical samba4/password_mismatch db_set samba4/admin_password "" db_set samba4/admin_password_again "" db_go done fi