From: Lionel Sambuc Date: Thu, 3 Oct 2013 20:39:47 +0000 (+0200) Subject: Splitting commands/cd/cd.sh X-Git-Tag: v3.3.0~548 X-Git-Url: http://zhaoyanbai.com/repos/%22../static/icons/zlib_tech.html?a=commitdiff_plain;h=11bab4dff7ce9810c95ee6da71d7ef5a534778d3;p=minix.git 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 --- 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