Merge branch 'less_closed'
[unleashed.git] / usr / src / cmd / bnu / SetUp
blobd2923470d396f92ac1923c75d4cd3cf2de4fd424
1 #!/bin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
8 # with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # CDDL HEADER END
23 #ident "%Z%%M% %I% %E% SMI" /* from SVR4 bnu:SetUp 2.3.1.9 */
25 # a function to do the dirty work
26 # SYNTAX:
27 # needit OWNER GROUP MODE name oldname
29 needit() {
30 if [ ! -f $ETC/$4 ]; then
31 if [ -f $LIB/$4 ]; then
32 cp $LIB/$4 $ETC/$4
33 else
34 if [ -n "$5" -a -f $LIB/$5 ]; then
35 cp $LIB/$5 $ETC/$4
36 else
37 cp $4 $ETC/$4
41 chown $1 $ETC/$4
42 chgrp $2 $ETC/$4
43 chmod $3 $ETC/$4
44 rm -rf $LIB/$4
45 $SYMLINK $ETC/$4 $LIB/$4
48 export IFS PATH
49 IFS="
51 PATH="/usr/bin"
53 # This shell tries to set up all needed uucp database files.
54 # Since the names changed from previous versions, it copies those.
55 # For the Permissions, it will generate one if none exists
57 LIB=$ROOT/usr/lib/uucp
58 ETC=$ROOT/etc/uucp
60 OWNER=uucp
61 GROUP=uucp
63 DBFILES="Config Devconfig Devices Dialcodes Dialers Grades Limits Permissions Poll Sysfiles Systems"
65 SYMLINK=${1:-":"};
67 # For cross environment, just take default files, and exit.
69 if [ -n "$CH" ]; then
70 PATH="/bin:/usr/bin"
71 for i in $DBFILES
73 cp $i $ETC
74 rm -rf $LIB/$i
75 $SYMLINK $ETC/$i $LIB/$i
76 done
77 exit
80 # For real environment, try to preserve user's database files
82 needit $OWNER $GROUP 644 Config
83 needit $OWNER $GROUP 644 Devconfig
84 needit $OWNER $GROUP 644 Devices L-devices
85 needit $OWNER $GROUP 644 Dialcodes L-dialcodes
86 needit $OWNER $GROUP 644 Dialers L-dialers
87 needit $OWNER $GROUP 644 Grades
88 needit $OWNER $GROUP 644 Limits
89 needit $OWNER $GROUP 644 Poll
90 needit $OWNER $GROUP 644 Sysfiles
91 needit $OWNER $GROUP 600 Systems L.sys
93 # Permissions is handles differently
94 if [ ! -f $ETC/Permissions ]; then
95 if [ -f $LIB/Permissions ]; then
96 cp $LIB/Permissions $ETC/Permissions
97 else
98 if [ -f $ETC/PERMISSIONS ]; then
99 cp $ETC/PERMISSIONS $ETC/Permissions
100 else
101 # Try to generate a Permissions file
102 # using uucp entries in /etc/passwd
103 > $ETC/Permissions
104 set - `sed -n "/uucico/s/:.*//p" /etc/passwd`
105 for i
107 echo "\tLOGNAME=$i\n"
108 done > $ETC/Permissions
112 chown $OWNER $ETC/Permissions
113 chgrp $GROUP $ETC/Permissions
114 chmod 600 $ETC/Permissions
115 rm -rf $LIB/Permissions
116 $SYMLINK $ETC/Permissions $LIB/Permissions