diff options
author | mtm <mtm@FreeBSD.org> | 2003-12-09 08:51:11 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-12-09 08:51:11 +0000 |
commit | fa2ae436faa592a9e37a39039777e89b2ca0a440 (patch) | |
tree | 5965010731763f7ee049a9bb86e35b1e7d3b12eb /etc/rc.subr | |
parent | bca6895fb7ecfdd1516259f4d870cc110799e5e5 (diff) | |
download | FreeBSD-src-fa2ae436faa592a9e37a39039777e89b2ca0a440.zip FreeBSD-src-fa2ae436faa592a9e37a39039777e89b2ca0a440.tar.gz |
o Rename devfs_link() to make_symlink() and turn it into a generic
symlinking routine.
o Modify rc.d/jail to create its own symlink relative to the jail's
filesystem
Diffstat (limited to 'etc/rc.subr')
-rw-r--r-- | etc/rc.subr | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index 34c4816..1699bb3 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -1038,29 +1038,30 @@ backup_file() fi } -# devfs_link dir src link -# Make a symbolic link 'link' to src in chroot/dev. -# Returns 0 on sucess. +# make_symlink src link +# Make a symbolic link 'link' to src from basedir. If the +# directory in which link is to be created does not exist +# a warning will be displayed and an error will be returned. +# Returns 0 on sucess, 1 otherwise. # -devfs_link() +make_symlink() { - local dir src link _me - dir="$1" - src="$2" - link="$3" - _me="devfs_link" - - if [ -z "$dir" -o -z "$src" -o -z "$link" ]; then - warn "devfs_link(): requires three arguments." + local src link linkdir _me + src="$1" + link="$2" + linkdir="`dirname $link`" + _me="make_symlink()" + + if [ -z "$src" -o -z "$link" ]; then + warn "$_me: requires two arguments." return 1 fi - if [ -z "$dir" ]; then - warn "$_me: the directory ($dir) does not exist" + if [ ! -d "$linkdir" ]; then + warn "$_me: the directory $linkdir does not exist" return 1 fi - cd ${chroot}/dev if ! ln -sf $src $link ; then - warn "$_me: unable to link $link --> $src in $dir" + warn "$_me: unable to make a symbolic link from $link to $src" return 1 fi return 0 |