[Pkg-samba-maint] r795 - trunk
Steve Langasek
vorlon at debian.org
Sun Dec 11 09:04:18 UTC 2005
Thanks for doing this. :)
Suggested simplification:
-DEFAULTRUNMODE="daemons"
read_rcfile() {
# Default values
if [ -f "$RCFILE" ]; then
. $RCFILE || true
fi
}
set_debconf() {
if [ -n "$RUN_MODE" ]; then
db_set samba/run_mode "$RUN_MODE" || true
fi
}
Explanation of changes:
- If we're going to check whether $RUN_MODE is set before setting it in
debconf, then there's no reason to set an initial value here as this merely
duplicates the default in the debconf template.
- If $RUN_MODE is a pathological value, such as "-lt", then "if [ -lt ]"
will give a syntax error; prefix the variable test with -n always.
I was also going to take out the || true on sourcing the RCFILE with the
reasoning that if it failed here it would fail later with the init scripts;
then I realized that the postinst will rewrite that file from scratch, so
having the extra check *is* worthwhile.
Cheers,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
vorlon at debian.org http://www.debian.org/
On Sun, Dec 11, 2005 at 08:49:08AM +0000, Christian Perrier wrote:
> Modified: trunk/samba.config
> ===================================================================
> --- trunk/samba.config 2005-12-05 08:05:14 UTC (rev 794)
> +++ trunk/samba.config 2005-12-11 08:49:07 UTC (rev 795)
> @@ -5,6 +5,9 @@
> # Source debconf library.
> . /usr/share/debconf/confmodule
>
> +DEFAULTRUNMODE="daemons"
> +RCFILE=/etc/default/samba
> +
> # Function for grabbing a parameter from an smb.conf file
> smbconf_retr() {
> if [ -z "$1" ]; then
> @@ -27,6 +30,20 @@
> | tail -n 1
> }
>
> +read_rcfile() {
> + # Default values
> + if [ -f $RCFILE ]; then
> + RUN_MODE="$DEFAULTRUNMODE"
> + . $RCFILE || true
> + fi
> +}
> +
> +set_debconf() {
> + if [ "$RUN_MODE" ]; then
> + db_set samba/run_mode "$RUN_MODE" || true
> + fi
> +}
> +
> FILE=/etc/samba/smb.conf
>
> db_title "Samba Server"
> @@ -38,6 +55,12 @@
> db_go
> fi
>
> +
> +# We first read the settings file
> +# in order to get admin-modified settings
> +read_rcfile
> +# Debconf-stored values are updated accordingly
> +set_debconf
> db_input medium samba/run_mode || true
> db_go
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20051211/0455267b/attachment.pgp
More information about the Pkg-samba-maint
mailing list