source: samba/trunk/fuentes/samba-common.config @ 4744

Last change on this file since 4744 was 4744, checked in by hectorgh, 4 years ago

adding modified files

File size: 2.1 KB
Line 
1#!/bin/sh
2
3set -e
4# Source debconf library.
5. /usr/share/debconf/confmodule
6
7# LLIUREX LLX
8
9exit 0
10
11
12# Function for grabbing a parameter from an smb.conf file
13smbconf_retr() {
14        if [ -z "$1" ]; then
15                return
16        fi
17
18        if [ -n "$2" ]; then
19                local FILE="$2"
20        fi
21
22        if [ -z "$FILE" ]; then
23                return
24        fi
25
26        sed -n -e"
27                s/^[[:space:]]*\[global\]/\[global\]/i
28                /^\[global\]/,/^[[:space:]]*\[/ {
29                        s/^[[:space:]]*$1[[:space:]]*=[[:space:]]*//pi
30                }" $FILE \
31        | tail -n 1
32}
33
34FILE=/etc/samba/smb.conf
35
36db_settitle samba-common/title
37
38# We ask the question IFF the config contains complex options that could
39# cause us to break the config.
40if [ -f "$FILE" ] && grep -v dhcp.conf $FILE \
41                     | grep -qEi '\\$|^[[:space:]]*include[[:space:]]*='
42then
43        db_input high samba-common/do_debconf || true
44        db_go
45else
46        db_set samba-common/do_debconf true
47fi
48
49# If user doesn't want to use debconf to configure Samba the leave...
50db_get samba-common/do_debconf || true
51if [ "${RET}" = "false" ]; then
52        exit 0
53fi
54
55# User wants to use debconf, let's continue...
56
57# Preload any values from the existing smb.conf file
58if [ -f $FILE ]; then
59        WORKGROUP=`smbconf_retr workgroup`
60        if [ "$WORKGROUP" ]; then
61                db_set samba-common/workgroup "$WORKGROUP"
62        fi
63
64fi
65
66# Get workgroup name
67db_input medium samba-common/workgroup || true
68db_go
69
70DHCPPRIORITY=medium
71#if [ "$DEBCONF_RECONFIGURE" = 1 ] && [ -f /sbin/dhclient3 ]
72#if [ -f /sbin/dhclient3 ]
73#then
74#       DHCPPRIORITY=high
75# TODO: see if we can detect that dhcp-client is *going* to be installed,
76# even if it isn't yet.
77#elif dpkg-query -W --showformat='${Status}\n' dhcp-client | grep ???
78# unknown ok not-installed ?
79#       DHCPPRIORITY=high
80#fi
81
82FOUND=false
83if [ -f $FILE ]; then
84        if grep -q 'include[[:space:]]*=[[:space:]]*/etc/samba/dhcp.conf' $FILE
85        then
86                FOUND=true
87        fi
88        db_set samba-common/dhcp $FOUND
89fi
90
91# we only prompt in one of three cases: the file doesn't exist yet, it
92# has the context we need to add our include line, or the include line
93# is already present.
94if [ ! -f $FILE ] || grep -q -i 'wins server' $FILE || [ "$FOUND" = "true" ];
95then
96        db_input $DHCPPRIORITY samba-common/dhcp || true
97        db_go
98fi
Note: See TracBrowser for help on using the repository browser.