base-files: fix prerm return value, align with postinst code
authorTony Ambardar <itugrok@yahoo.com>
Sat, 3 Mar 2018 04:04:36 +0000 (20:04 -0800)
committerJo-Philipp Wich <jo@mein.io>
Thu, 29 Nov 2018 10:54:46 +0000 (11:54 +0100)
commite42415723bbc49b1d0bd3659915bb463bae066f0
treeff5a440105c4050b4b98a6d1d3ce3a908894edac
parentecf104c023b82a364e8e41b4e26312a8601cffc6
base-files: fix prerm return value, align with postinst code

The return value of a package prerm script is discarded and not returned
correctly by default_prerm(). This allows other operations like service
shutdown to "leak" their return value, prompting workarounds like commit
48cfc826 which do not address the root cause.

Preserve a package prerm script return value for use by default_prerm(),
sharing the corresponding code from default_postinst() for consistency.
Also use consistent code for handling of /etc/init.d/ scripts.

Run Tested on: LEDE 17.01.4 running ar71xx.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
(cherry picked from commit 8806da86f5da3b1b1e4d24259d168e2219c01a26)
package/base-files/files/lib/functions.sh