From 11bab4dff7ce9810c95ee6da71d7ef5a534778d3 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Thu, 3 Oct 2013 22:39:47 +0200 Subject: [PATCH] Splitting commands/cd/cd.sh As the situation is right now, importing one of the commands the script replaces, requires a doc/UPDATING step. By moving the script to a shared folder, and symlinking it once per command, this allows for separatly installed files on the system, instead of one file being symlinked multiple times. Change-Id: I0dae96982bca5168b852ed70fff61442441b929f --- commands/Makefile | 4 +++- commands/cd/Makefile | 13 ------------- commands/cd/cd.sh | 12 +----------- commands/command/Makefile | 5 +++++ commands/command/command.sh | 1 + commands/echo/Makefile | 5 +++++ commands/echo/echo.sh | 1 + commands/expr/Makefile | 5 +++++ commands/expr/expr.sh | 1 + commands/false/Makefile | 5 +++++ commands/false/false.sh | 1 + commands/getopts/Makefile | 5 +++++ commands/getopts/getopts.sh | 1 + commands/read/Makefile | 5 +++++ commands/read/read.sh | 1 + commands/shared/README | 22 ++++++++++++++++++++++ commands/shared/builtin.sh | 11 +++++++++++ commands/test/Makefile | 5 +++++ commands/test/test.sh | 1 + commands/true/Makefile | 5 +++++ commands/true/true.sh | 1 + commands/umask/Makefile | 5 +++++ commands/umask/umask.sh | 1 + commands/wait/Makefile | 5 +++++ commands/wait/wait.sh | 1 + 25 files changed, 97 insertions(+), 25 deletions(-) mode change 100644 => 120000 commands/cd/cd.sh create mode 100644 commands/command/Makefile create mode 120000 commands/command/command.sh create mode 100644 commands/echo/Makefile create mode 120000 commands/echo/echo.sh create mode 100644 commands/expr/Makefile create mode 120000 commands/expr/expr.sh create mode 100644 commands/false/Makefile create mode 120000 commands/false/false.sh create mode 100644 commands/getopts/Makefile create mode 120000 commands/getopts/getopts.sh create mode 100644 commands/read/Makefile create mode 120000 commands/read/read.sh create mode 100644 commands/shared/README create mode 100644 commands/shared/builtin.sh create mode 100644 commands/test/Makefile create mode 120000 commands/test/test.sh create mode 100644 commands/true/Makefile create mode 120000 commands/true/true.sh create mode 100644 commands/umask/Makefile create mode 120000 commands/umask/umask.sh create mode 100644 commands/wait/Makefile create mode 120000 commands/wait/wait.sh diff --git a/commands/Makefile b/commands/Makefile index 53fad8f6d..d4e0e36af 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -34,7 +34,9 @@ SUBDIR= add_route arp ash at backup btrace \ worldstone updateboot update_bootcfg \ atnormalize dosread fdisk loadfont \ autopart part partition playwave \ - recwave repartition screendump + recwave repartition screendump \ + command echo expr false getopts read test true \ + umask wait .if ${MACHINE_ARCH} == "earm" SUBDIR+= eepromread diff --git a/commands/cd/Makefile b/commands/cd/Makefile index 35a04b028..34d874c00 100644 --- a/commands/cd/Makefile +++ b/commands/cd/Makefile @@ -2,17 +2,4 @@ SCRIPTS= cd.sh BINDIR= /bin MAN= -LINKS+= ${BINDIR}/cd ${BINDIR}/[ -LINKS+= ${BINDIR}/cd ${BINDIR}/command -LINKS+= ${BINDIR}/cd ${BINDIR}/echo -LINKS+= ${BINDIR}/cd ${BINDIR}/expr -LINKS+= ${BINDIR}/cd ${BINDIR}/false -LINKS+= ${BINDIR}/cd ${BINDIR}/getopts -LINKS+= ${BINDIR}/cd ${BINDIR}/read -LINKS+= ${BINDIR}/cd ${BINDIR}/test -LINKS+= ${BINDIR}/cd ${BINDIR}/true -LINKS+= ${BINDIR}/cd ${BINDIR}/umask -LINKS+= ${BINDIR}/cd ${BINDIR}/wait - - .include diff --git a/commands/cd/cd.sh b/commands/cd/cd.sh deleted file mode 100644 index e1f28e46a..000000000 --- a/commands/cd/cd.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# cd 1.3 - equivalents for normally builtin commands. Author: Kees J. Bot - -case $0 in -*/*) command="`expr "$0" : '.*/\(.*\)'`" - ;; -*) command="$0" -esac - -"$command" "$@" diff --git a/commands/cd/cd.sh b/commands/cd/cd.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/cd/cd.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/command/Makefile b/commands/command/Makefile new file mode 100644 index 000000000..4d4f28bde --- /dev/null +++ b/commands/command/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= command.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/command/command.sh b/commands/command/command.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/command/command.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/echo/Makefile b/commands/echo/Makefile new file mode 100644 index 000000000..a72d62028 --- /dev/null +++ b/commands/echo/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= echo.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/echo/echo.sh b/commands/echo/echo.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/echo/echo.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/expr/Makefile b/commands/expr/Makefile new file mode 100644 index 000000000..76307486d --- /dev/null +++ b/commands/expr/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= expr.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/expr/expr.sh b/commands/expr/expr.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/expr/expr.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/false/Makefile b/commands/false/Makefile new file mode 100644 index 000000000..a109e84d3 --- /dev/null +++ b/commands/false/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= false.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/false/false.sh b/commands/false/false.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/false/false.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/getopts/Makefile b/commands/getopts/Makefile new file mode 100644 index 000000000..1a630c1dd --- /dev/null +++ b/commands/getopts/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= getopts.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/getopts/getopts.sh b/commands/getopts/getopts.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/getopts/getopts.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/read/Makefile b/commands/read/Makefile new file mode 100644 index 000000000..399a45461 --- /dev/null +++ b/commands/read/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= read.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/read/read.sh b/commands/read/read.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/read/read.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/shared/README b/commands/shared/README new file mode 100644 index 000000000..246c4f7ff --- /dev/null +++ b/commands/shared/README @@ -0,0 +1,22 @@ +builtin.sh is installed as a set of tools to stand in for specific +filesystem call to builtin commands. + +for example if /bin/test is used, then builtin.sh will be loaded +and simply call the builtin function of the same name. + +At this moment it is installed as the following commands: +/bin/[ +/bin/command +/bin/echo +/bin/expr +/bin/false +/bin/getopts +/bin/read +/bin/test +/bin/true +/bin/umask +/bin/wait + +If one of the following is replaced by the NetBSD equivalent, please +update the list, and remove this completly when it is not anymore +required. diff --git a/commands/shared/builtin.sh b/commands/shared/builtin.sh new file mode 100644 index 000000000..e1f28e46a --- /dev/null +++ b/commands/shared/builtin.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# cd 1.3 - equivalents for normally builtin commands. Author: Kees J. Bot + +case $0 in +*/*) command="`expr "$0" : '.*/\(.*\)'`" + ;; +*) command="$0" +esac + +"$command" "$@" diff --git a/commands/test/Makefile b/commands/test/Makefile new file mode 100644 index 000000000..5b4a03b8a --- /dev/null +++ b/commands/test/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= test.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/test/test.sh b/commands/test/test.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/test/test.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/true/Makefile b/commands/true/Makefile new file mode 100644 index 000000000..6c3b4da8d --- /dev/null +++ b/commands/true/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= true.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/true/true.sh b/commands/true/true.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/true/true.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/umask/Makefile b/commands/umask/Makefile new file mode 100644 index 000000000..e5f0ad16a --- /dev/null +++ b/commands/umask/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= umask.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/umask/umask.sh b/commands/umask/umask.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/umask/umask.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file diff --git a/commands/wait/Makefile b/commands/wait/Makefile new file mode 100644 index 000000000..41fc7d1d7 --- /dev/null +++ b/commands/wait/Makefile @@ -0,0 +1,5 @@ +SCRIPTS= wait.sh +BINDIR= /bin +MAN= + +.include diff --git a/commands/wait/wait.sh b/commands/wait/wait.sh new file mode 120000 index 000000000..f9350d4b6 --- /dev/null +++ b/commands/wait/wait.sh @@ -0,0 +1 @@ +../shared/builtin.sh \ No newline at end of file -- 2.44.0