iucode-tool: rewrite init script
authorCarlos Santos <casantos@datacom.com.br>
Sun, 4 Nov 2018 21:02:41 +0000 (19:02 -0200)
committerPeter Korsgaard <peter@korsgaard.com>
Mon, 12 Nov 2018 21:48:23 +0000 (22:48 +0100)
- Indent with tabs.
- Use a function for start.
- Pass "-q" to iucode_tool to inhibit usual output that would otherwise
  interfere with the operation status report.

Signed-off-by: Carlos Santos <casantos@datacom.com.br>
[Peter: drop dummy function with sed invocation not compatible with busybox]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/iucode-tool/S00iucode-tool

index a97b33c045643fcba3d88229680f2c633bd176f7..393c903b41ca12ec1412389107b8594fbd3cc3ef 100644 (file)
@@ -5,19 +5,24 @@
 
 MICROCODE_DIR="/lib/firmware/intel-ucode"
 
+start() {
+       printf 'Starting iucode-tool: '
+       /usr/sbin/iucode_tool -q -k "$MICROCODE_DIR"
+       status="$?"
+       if [ "$status" = 0 ]; then
+               echo "OK"
+       else
+               echo "FAIL"
+       fi
+       return "$status"
+}
+
 case "$1" in
-  start)
-       echo "Starting iucode-tool:"
-       /usr/sbin/iucode_tool -k "$MICROCODE_DIR"
-       echo "done"
-       ;;
-  stop)
-       ;;
-  restart|reload)
-       ;;
-  *)
-       echo "Usage: $0 {start|stop|restart}"
-       exit 1
+       start)
+               start;;
+       stop|restart|reload)
+               ;;
+       *)
+               echo "Usage: $0 {start|stop|restart|reload}"
+               exit 1
 esac
-
-exit $?