[LEDE-DEV] [PATCH v2 2/3] base-files: put board_name into separate file

John Crispin john at phrozen.org
Tue May 16 03:26:32 PDT 2017


Hi Roman,

what is the reasoning behind moving this function to its own file ?

     John


On 09/05/17 11:17, Roman Yeryomin wrote:
> Signed-off-by: Roman Yeryomin <roman at advem.lv>
> ---
>   package/base-files/files/lib/functions.sh       | 4 +---
>   package/base-files/files/lib/functions/board.sh | 6 ++++++
>   2 files changed, 7 insertions(+), 3 deletions(-)
>   create mode 100644 package/base-files/files/lib/functions/board.sh
>
> diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
> index 2b6415a..2aaafcf 100755
> --- a/package/base-files/files/lib/functions.sh
> +++ b/package/base-files/files/lib/functions.sh
> @@ -353,8 +353,6 @@ user_exists() {
>   	grep -qs "^${1}:" ${IPKG_INSTROOT}/etc/passwd
>   }
>   
> -board_name() {
> -	[ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic"
> -}
> +. /lib/functions/board.sh
>   
>   [ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh
> diff --git a/package/base-files/files/lib/functions/board.sh b/package/base-files/files/lib/functions/board.sh
> new file mode 100644
> index 0000000..d33edc8
> --- /dev/null
> +++ b/package/base-files/files/lib/functions/board.sh
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +board_name()
> +{
> +	[ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic"
> +}




More information about the Lede-dev mailing list