home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 10.ddi / usr / lib / uucp / SetUp
Encoding:
Text File  |  1990-12-08  |  2.1 KB  |  97 lines

  1. #!/bin/sh
  2. #ident    "@(#)/usr/lib/uucp/SetUp.sl 1.1 4.0 12/08/90 48763 AT&T-USL"
  3.  
  4. #    a function to do the dirty work
  5. #    SYNTAX:
  6. #        needit OWNER GROUP MODE name oldname
  7.  
  8. needit() {
  9. if [ ! -f $ETC/$4 ]; then
  10.     if [ -f $LIB/$4 ]; then
  11.     cp $LIB/$4 $ETC/$4
  12.     else
  13.     if [ -n "$5" -a -f $LIB/$5 ]; then
  14.             cp $LIB/$5 $ETC/$4
  15.     else
  16.             cp $4 $ETC/$4
  17.     fi
  18.     fi
  19. fi
  20. chown $1 $ETC/$4
  21. chgrp $2 $ETC/$4
  22. chmod $3 $ETC/$4
  23. rm -rf $LIB/$4
  24. $SYMLINK $ETC/$4 $LIB/$4
  25. }
  26.  
  27. export IFS PATH
  28. IFS="     
  29. "
  30. PATH="/usr/bin"
  31.  
  32. # This shell tries to set up all needed uucp database files.
  33. # Since the names changed from previous versions, it copies those.
  34. # For the Permissions, it will generate one if none exists
  35.  
  36. LIB=$ROOT/usr/lib/uucp
  37. ETC=$ROOT/etc/uucp
  38.  
  39. OWNER=uucp
  40. GROUP=uucp
  41.  
  42. DBFILES="Config Devconfig Devices Dialcodes Dialers Grades Limits Permissions Poll Sysfiles Systems"
  43.  
  44. SYMLINK=${1:-":"};
  45.  
  46. # For cross environment, just take default files, and exit.
  47.  
  48. if [ -n "$CH" ]; then
  49.     PATH="/bin:/usr/bin"
  50.     for i in $DBFILES
  51.     do
  52.     cp $i $ETC
  53.     rm -rf $LIB/$i
  54.     $SYMLINK $ETC/$i $LIB/$i
  55.     done
  56.     exit
  57. fi
  58.  
  59. # For real environment, try to preserve user's database files
  60.  
  61. needit $OWNER $GROUP 644 Config
  62. needit $OWNER $GROUP 644 Devconfig
  63. needit $OWNER $GROUP 644 Devices L-devices
  64. needit $OWNER $GROUP 644 Dialcodes L-dialcodes
  65. needit $OWNER $GROUP 644 Dialers L-dialers
  66. needit $OWNER $GROUP 644 Grades
  67. needit $OWNER $GROUP 644 Limits
  68. needit $OWNER $GROUP 644 Poll
  69. needit $OWNER $GROUP 644 Sysfiles
  70. needit $OWNER $GROUP 600 Systems L.sys
  71.  
  72. # Permissions is handles differently
  73. if [ ! -f $ETC/Permissions ]; then
  74.     if [ -f $LIB/Permissions ]; then
  75.     cp $LIB/Permissions $ETC/Permissions
  76.     else
  77.     if [ -f $ETC/PERMISSIONS ]; then
  78.             cp $ETC/PERMISSIONS $ETC/Permissions
  79.     else
  80.         # Try to generate a Permissions file
  81.         # using uucp entries in /etc/passwd
  82.         > $ETC/Permissions
  83.         set - `sed -n "/uucico/s/:.*//p" /etc/passwd`
  84.         for i
  85.         do
  86.         echo "\tLOGNAME=$i\n"
  87.         done > $ETC/Permissions
  88.     fi
  89.     fi
  90. fi
  91. chown $OWNER $ETC/Permissions
  92. chgrp $GROUP $ETC/Permissions
  93. chmod 600 $ETC/Permissions
  94. rm -rf $LIB/Permissions
  95. $SYMLINK $ETC/Permissions $LIB/Permissions
  96.  
  97.