From 498b199fa5240c8aa27a2704708d1eb098bf3105 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 16 Dec 2013 20:26:12 +0100 Subject: Some docs about coding --- doc/coding/shell-scripts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 doc/coding/shell-scripts (limited to 'doc/coding/shell-scripts') diff --git a/doc/coding/shell-scripts b/doc/coding/shell-scripts new file mode 100644 index 00000000..14e69c6e --- /dev/null +++ b/doc/coding/shell-scripts @@ -0,0 +1,32 @@ +Since this framework is supposed to work on several +distributions, we cannot rely on a certain shell +always being available in one specific version. +Care should be taken which shebang a script uses. +As the only shell we know for sure will be there +is the ash that comes with busybox it is advised +that you write scripts that are compatible to ash +whenever possible. +So pretty much all scripts should start with +#!/bin/ash +It is guaranteed by the framework that /bin/ash +will link to mltk's busybox binary. + +In case you have a fancy script that uses some bash +features it is reasonably safe to assume that the +distribution in use supplies a halfway up to date +bash version, so if you don't use any bleeding edge +features you might use +#!/bin/bash +for that script. Keep in mind that bash takes a +little while to start up (even if loaded from ram), +so don't use it if you don't have to. + +You should NEVER USE /bin/sh as the shebang, as the +results are undefined. /bin/sh links to something +distribution specific, so just because it works on +one system doesn't mean it works on another +(debian/ubuntu's dash is great in breaking bash +scripts for example). +We do not modify /bin/sh so we don't accidentally +break any scripts that come with the distro (stage4). + -- cgit v1.2.3-55-g7522