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
This commit is contained in:
Lionel Sambuc 2013-10-03 22:39:47 +02:00
parent bbb8908c16
commit 11bab4dff7
25 changed files with 97 additions and 25 deletions

View file

@ -34,7 +34,9 @@ SUBDIR= add_route arp ash at backup btrace \
worldstone updateboot update_bootcfg \ worldstone updateboot update_bootcfg \
atnormalize dosread fdisk loadfont \ atnormalize dosread fdisk loadfont \
autopart part partition playwave \ autopart part partition playwave \
recwave repartition screendump recwave repartition screendump \
command echo expr false getopts read test true \
umask wait
.if ${MACHINE_ARCH} == "earm" .if ${MACHINE_ARCH} == "earm"
SUBDIR+= eepromread SUBDIR+= eepromread

View file

@ -2,17 +2,4 @@ SCRIPTS= cd.sh
BINDIR= /bin BINDIR= /bin
MAN= 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> .include <bsd.prog.mk>

View file

@ -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" "$@"

1
commands/cd/cd.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

View file

@ -0,0 +1,5 @@
SCRIPTS= command.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/command/command.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/echo/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= echo.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/echo/echo.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/expr/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= expr.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/expr/expr.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/false/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= false.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/false/false.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

View file

@ -0,0 +1,5 @@
SCRIPTS= getopts.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/getopts/getopts.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/read/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= read.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/read/read.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

22
commands/shared/README Normal file
View file

@ -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.

View file

@ -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" "$@"

5
commands/test/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= test.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/test/test.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/true/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= true.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/true/true.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/umask/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= umask.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/umask/umask.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh

5
commands/wait/Makefile Normal file
View file

@ -0,0 +1,5 @@
SCRIPTS= wait.sh
BINDIR= /bin
MAN=
.include <bsd.prog.mk>

1
commands/wait/wait.sh Symbolic link
View file

@ -0,0 +1 @@
../shared/builtin.sh