]> Zhao Yanbai Git Server - minix.git/commitdiff
Splitting commands/cd/cd.sh
authorLionel Sambuc <lionel@minix3.org>
Thu, 3 Oct 2013 20:39:47 +0000 (22:39 +0200)
committerLionel Sambuc <lionel@minix3.org>
Sat, 1 Mar 2014 08:04:56 +0000 (09:04 +0100)
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

25 files changed:
commands/Makefile
commands/cd/Makefile
commands/cd/cd.sh [changed from file to symlink]
commands/command/Makefile [new file with mode: 0644]
commands/command/command.sh [new symlink]
commands/echo/Makefile [new file with mode: 0644]
commands/echo/echo.sh [new symlink]
commands/expr/Makefile [new file with mode: 0644]
commands/expr/expr.sh [new symlink]
commands/false/Makefile [new file with mode: 0644]
commands/false/false.sh [new symlink]
commands/getopts/Makefile [new file with mode: 0644]
commands/getopts/getopts.sh [new symlink]
commands/read/Makefile [new file with mode: 0644]
commands/read/read.sh [new symlink]
commands/shared/README [new file with mode: 0644]
commands/shared/builtin.sh [new file with mode: 0644]
commands/test/Makefile [new file with mode: 0644]
commands/test/test.sh [new symlink]
commands/true/Makefile [new file with mode: 0644]
commands/true/true.sh [new symlink]
commands/umask/Makefile [new file with mode: 0644]
commands/umask/umask.sh [new symlink]
commands/wait/Makefile [new file with mode: 0644]
commands/wait/wait.sh [new symlink]

index 53fad8f6dd61b16f3da447f3baf1d0dff594777e..d4e0e36af8aa4330a2bbbb304c48884c6a36a8f8 100644 (file)
@@ -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
index 35a04b02841bb5da526bad39e5f6df0346172e89..34d874c002809324982d48178fce94d917f47d30 100644 (file)
@@ -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 <bsd.prog.mk>
deleted file mode 100644 (file)
index e1f28e46a379211c576f4aa8552d0b42a07232c8..0000000000000000000000000000000000000000
+++ /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" "$@"
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..f9350d4b6fbeef73d5a348e97dc0cfde54b75ff7
--- /dev/null
@@ -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 (file)
index 0000000..4d4f28b
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= command.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/command/command.sh b/commands/command/command.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..a72d620
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= echo.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/echo/echo.sh b/commands/echo/echo.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..7630748
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= expr.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/expr/expr.sh b/commands/expr/expr.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..a109e84
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= false.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/false/false.sh b/commands/false/false.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..1a630c1
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= getopts.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/getopts/getopts.sh b/commands/getopts/getopts.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..399a454
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= read.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/read/read.sh b/commands/read/read.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..246c4f7
--- /dev/null
@@ -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 (file)
index 0000000..e1f28e4
--- /dev/null
@@ -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 (file)
index 0000000..5b4a03b
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= test.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/test/test.sh b/commands/test/test.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..6c3b4da
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= true.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/true/true.sh b/commands/true/true.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..e5f0ad1
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= umask.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/umask/umask.sh b/commands/umask/umask.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -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 (file)
index 0000000..41fc7d1
--- /dev/null
@@ -0,0 +1,5 @@
+SCRIPTS= wait.sh
+BINDIR=        /bin
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/commands/wait/wait.sh b/commands/wait/wait.sh
new file mode 120000 (symlink)
index 0000000..f9350d4
--- /dev/null
@@ -0,0 +1 @@
+../shared/builtin.sh
\ No newline at end of file