Bug#751368: cups-daemon: preinst exits prematurely
On Thu 12 Jun 2014 at 10:53:08 +0200, Didier 'OdyX' Raboud wrote:
> Control: tags -1 +moreinfo
>
> Le jeudi, 12 juin 2014, 09.02:05 Brian Potkin a écrit :
> > The preinst script has a misplaced 'fi' after
> >
> > ListenStream=[::1]:$localport
> > EOF
> >
> > Shouldn't the statement read
> >
> > if .... elif ... else ... fi ?
>
> The preinst code without the lengthy heredocs is as follows:
>
> # If file doesn't exist or if it has two conflicting stanzas
> if [ ! -f /etc/cups/cupsd-systemd-listen.conf ] || (…) ;\
> then
> mkdir -p /etc/cups
> # cat header
> if [ -e /etc/cups/cupsd.conf ]; then
> if grep -q '^\s*Port' /etc/cups/cupsd.conf 2>/dev/null; then
> # get Port port
> # cat Port
> elif grep -q '^\s*Listen localhost:' /etc/cups/cupsd.conf 2>/dev/null; then
> # get ListenStream port
> # cat ListenStream
> fi <--------------<-----------------------------<--------------|
> else |
> # cat Default |
> fi |
> fi |
> |
> Where do you see a problem? |
|
I am assuming that the purpose of "cat default" is to ensure the writing |
of ListenStream lines to cupsd-systemd-listen.conf when cupsd.conf does |
not contain them. However, with "Listen localhost:631" and "Port 631" |
both commented out cupsd-systemd-listen.conf has only the content of the |
heredoc. |
|
I see the problem as this --------->----------------------------->--------------|
Moving "fi" to after "cat default" solves the problem for me.
# If file doesn't exist or if it has two conflicting stanzas
if [ ! -f /etc/cups/cupsd-systemd-listen.conf ] || (…) ;\
then
mkdir -p /etc/cups
# cat header
if [ -e /etc/cups/cupsd.conf ]; then
if grep -q '^\s*Port' /etc/cups/cupsd.conf 2>/dev/null; then
# get Port port
# cat Port
elif grep -q '^\s*Listen localhost:' /etc/cups/cupsd.conf 2>/dev/null; then
# get ListenStream port
# cat ListenStream
else
# cat Default
fi
fi
fi
Regards,
Brian.
Reply to: