2011/1/24 Harald Jenny <har...@a-little-linux-box.at>: > On Mon, Jan 24, 2011 at 06:37:37PM +0200, Teodor MICU wrote: >> 1) usually you should enclose with "" the full path here: >> +PIDFILE=/var/run/amavis/"$NAME".pid >> +[ -r /etc/default/"$NAME" ] && . /etc/default/"$NAME" > > You mean like this? > > PIDFILE="/var/run/amavis/$NAME.pid" > [ -r "/etc/default/$NAME" ] && . "/etc/default/$NAME"
Yes. >> Also, $NAME is not usually quoted with "" in any init script. > > Well that's true but you may set it to a value with blanks in it too so maybe > the defaults should also be changed here? If you think it's not necessary I > may > also drop in but I wanted to be on the safe side here. I don't think this is a supported configuration. I mean $NAME should probably not be changed in config from /etc/default but as you say it is good to be on the safe side. >> 2) You should make sure that you don't get it this situation: >> +if [ -n "$PIDFILE" ]; then >> ... >> +else >> + log_failure_msg "Error: PIDFILE variable must be defined for >> correct functionality" >> + exit 1 >> +fi >> >> This is usually done by setting the default values (for example for >> PIDFILE) after you have sourced the config from /etc/default/$NAME. >> This is done on a test like this: >> test -z "$VAR" || VAR="<your default value>" >> (I don't recommend "test -n $VAR && .. not that good with "set -e") > > You mean not alerting when PIDFILE is set to "" in the config file but rather > changing it to my default value, correct? Yes. It should be a valid config if /etc/default/$NAME that doesn't contain anything. Actually it should be the default to have only comments with the default values that the SysAdmin should be able to change with custom values. I don't know what you have now in the default config. One more important issue I think we missed so far is to have MILTERSOCKET empty in the config file. I think you covered only to skip "chmod+chown" but in fact it should abort execution. So this construction: +if [ -n "$MILTERSOCKET" ]; then should be change to: | if [ -z "$MILTERSOCKET" ]; then | echo ".. abort" | exit 1 | else [..] Thanks -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org