base-files: rc.common: fix enable() return code and logic
authorRoman Yeryomin <roman@advem.lv>
Fri, 22 Dec 2017 11:04:46 +0000 (13:04 +0200)
committerJohn Crispin <john@phrozen.org>
Tue, 2 Jan 2018 06:14:08 +0000 (07:14 +0100)
commit0b1fa809d0e974398503a24e408c1209969711f7
tree9599b1c58819bfacdd7b6e4242459c2c05c8cb7f
parentb153745bfbefc6617db0f63e6c80fde7e1e96e7e
base-files: rc.common: fix enable() return code and logic

In current state, if there is START but no STOP, enbale()
will return 1 (failure), which is wrong.
Moreover there is no need to check for START/STOP twice.
Instead, add err variable to save success state and
and return it's value.
Also eliminate the need to disable() by using 'ln -sf',
which will first delete the old symlink if one exists.

Changes from v1:
- fixed description

Signed-off-by: Roman Yeryomin <roman@advem.lv>
package/base-files/files/etc/rc.common