Skip to content

Commit

Permalink
debian: Use a different way to avoid failing install without kernel m…
Browse files Browse the repository at this point in the history
…odule.

The dh_installinit --error-handler option makes a lot of sense, but after
playing with it for a while I could not figure out a nice way to use it
only for openvswitch-switch without either duplicating the dh_installinit
fragments in postinst and prerm (the actual bug that was reported) or
omitting them for some package.

Also, we forgot to write the error handler function for the prerm.

This commit switches to a different way to avoid failing the install when
the kernel module is not available, without using --error-handler.

CC: [email protected]
Reported-by: Thomas Goirand <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Mar 16, 2012
1 parent d2b9f5b commit 8a5b3cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
7 changes: 7 additions & 0 deletions debian/openvswitch-switch.init
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ start () {
echo "For instructions, read"
fi
echo "/usr/share/doc/openvswitch-datapath-source/README.Debian"

if test X"$OVS_MISSING_KMOD_OK" = Xyes; then
# We're being invoked by the package postinst. Do not
# fail package installation just because the kernel module
# is not available.
exit 0
fi
fi
set ovs_ctl ${1-start} --system-id=random
if test X"$FORCE_COREFILES" != X; then
Expand Down
18 changes: 2 additions & 16 deletions debian/openvswitch-switch.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,11 @@ case "$1" in
;;
esac

HAVE_KMOD="no"

init_script_error () {
if test X"$HAVE_KMOD" = Xno; then
exit 0
fi
exit 1
}

# Do not fail package installation just because the kernel module
# is not available.
if test -x /etc/init.d/openvswitch-switch; then
if invoke-rc.d openvswitch-switch load-kmod; then
HAVE_KMOD="yes"
fi
fi
OVS_MISSING_KMOD_OK=yes
export OVS_MISSING_KMOD_OK

#DEBHELPER#

exit 0


3 changes: 1 addition & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ binary-common:
dh_installexamples
dh_installdebconf
dh_installlogrotate
dh_installinit -R -Nopenvswitch-switch
dh_installinit -R -popenvswitch-switch --error-handler=init_script_error
dh_installinit -R
dh_installcron
dh_installman --language=C
dh_link
Expand Down

0 comments on commit 8a5b3cf

Please sign in to comment.