[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: use of "invoke-rc.d $PACKAGE stop || exit $?" in prerm scripts

* Bernd Schubert <bernd.schubert@pci.uni-heidelberg.de> wrote:
> Michael Prokop wrote:

>> How do you achieve that? For example symlinking invoke-rc.d to
>> /bin/true is a workaround, but I'm searching for a general solution
>> to avoid that daemons are started when upgrading even though they
>> did not run before the upgrade (or don't start any service at all,
>> e.g. in chroots - as you mentioned).

> Via /usr/sbin/policy-rc.d, e.g.:

> #!/bin/sh

> # are we on hamilton?
> WHERE=$(hostname -s|cut -b 1-8) # cut to remove {1,2} from hamilton{1,2}
> if [ "$WHERE" = "hamilton" ]; then
>     # notify invoke-rc.d that nothing should be done -- we are in a chroot
>     exit 101
> else
>     # allow it
>     exit 0
> fi

> (This chroot is used on the clients as their root environment)


>> The init script would be broken then.
>> Anyway, I don't see the difference between "stop || exit $?" and
>> "stop || true" in this case.

> What I mean is that the call of 

> invoke-rc.d $PACKAGE stop || true

> is fine, but the second call

> /etc/init.d/$PACKAGE stop || true

> will not using policy-rc.d and therefore might be a possible problem. Given
> the fact that we have a sid chroot on a high availibilty system and a sid
> package always might cause some trouble, I don't like the idea that a
> malformed script is able to stop programs outside its chroot. 

But /etc/init.d/$PACKAGE is executed only, if "[ -x "`which
invoke-rc.d 2>/dev/null`" ]" fails. And I still don't see what's the
relation to "stop || true". ;) I don't insist on the "stop || true"
way of life, I'd just like to make sure that removing packages
always works.


Reply to: