rc.subr (119170) | rc.subr (123344) |
---|---|
1# $NetBSD: rc.subr,v 1.49 2002/05/21 12:31:01 lukem Exp $ | 1# $NetBSD: rc.subr,v 1.49 2002/05/21 12:31:01 lukem Exp $ |
2# $FreeBSD: head/etc/rc.subr 119170 2003-08-20 06:50:34Z mtm $ | 2# $FreeBSD: head/etc/rc.subr 123344 2003-12-09 08:51:11Z mtm $ |
3# 4# Copyright (c) 1997-2002 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 1022 unchanged lines hidden (view full) --- 1033 ;; 1034 remove) 1035 mv -f $_cur $_back 1036 ;; 1037 esac 1038 fi 1039} 1040 | 3# 4# Copyright (c) 1997-2002 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Luke Mewburn. 9# 10# Redistribution and use in source and binary forms, with or without --- 1022 unchanged lines hidden (view full) --- 1033 ;; 1034 remove) 1035 mv -f $_cur $_back 1036 ;; 1037 esac 1038 fi 1039} 1040 |
1041# devfs_link dir src link 1042# Make a symbolic link 'link' to src in chroot/dev. 1043# Returns 0 on sucess. | 1041# make_symlink src link 1042# Make a symbolic link 'link' to src from basedir. If the 1043# directory in which link is to be created does not exist 1044# a warning will be displayed and an error will be returned. 1045# Returns 0 on sucess, 1 otherwise. |
1044# | 1046# |
1045devfs_link() | 1047make_symlink() |
1046{ | 1048{ |
1047 local dir src link _me 1048 dir="$1" 1049 src="$2" 1050 link="$3" 1051 _me="devfs_link" | 1049 local src link linkdir _me 1050 src="$1" 1051 link="$2" 1052 linkdir="`dirname $link`" 1053 _me="make_symlink()" |
1052 | 1054 |
1053 if [ -z "$dir" -o -z "$src" -o -z "$link" ]; then 1054 warn "devfs_link(): requires three arguments." | 1055 if [ -z "$src" -o -z "$link" ]; then 1056 warn "$_me: requires two arguments." |
1055 return 1 1056 fi | 1057 return 1 1058 fi |
1057 if [ -z "$dir" ]; then 1058 warn "$_me: the directory ($dir) does not exist" | 1059 if [ ! -d "$linkdir" ]; then 1060 warn "$_me: the directory $linkdir does not exist" |
1059 return 1 1060 fi | 1061 return 1 1062 fi |
1061 cd ${chroot}/dev | |
1062 if ! ln -sf $src $link ; then | 1063 if ! ln -sf $src $link ; then |
1063 warn "$_me: unable to link $link --> $src in $dir" | 1064 warn "$_me: unable to make a symbolic link from $link to $src" |
1064 return 1 1065 fi 1066 return 0 1067} 1068 1069# devfs_rulesets_from_file file 1070# Reads a set of devfs commands from file, and creates 1071# the specified rulesets with their rules. Returns non-zero --- 186 unchanged lines hidden --- | 1065 return 1 1066 fi 1067 return 0 1068} 1069 1070# devfs_rulesets_from_file file 1071# Reads a set of devfs commands from file, and creates 1072# the specified rulesets with their rules. Returns non-zero --- 186 unchanged lines hidden --- |