home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / base / root.15 / usr / lib / drf / conframdfs / conframdfs~
Text File  |  1998-08-19  |  5KB  |  173 lines

  1. #!/usr/bin/ksh
  2.  
  3. # Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  4. #                                                                         
  5. #        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  6. #                   SANTA CRUZ OPERATION INC.                             
  7. #                                                                         
  8. #   The copyright notice above does not evidence any actual or intended   
  9. #   publication of such source code.                                      
  10.  
  11.  
  12. #ident    "@(#)drf:cmd/conframdfs.sh    1.1"
  13.  
  14. # set -x
  15.  
  16. PATH=$PROTO/bin:$TOOLS/usr/ccs/bin:$PATH: export PATH
  17. PFX=""
  18. EDSYM="bin/edsym"
  19. NM="${PFX}nm"
  20. DUMP="${PFX}dump"
  21. STRIP="${PFX}strip"
  22. UNIXSYMS="${PFX}unixsyms"
  23. MCS="${PFX}mcs"
  24.  
  25. setflag=-u        #default is UnixWare set
  26. LANG=C
  27. special_flag=false
  28. mv2cd_flag=false
  29. while getopts ul:s c
  30. do
  31.     case $c in
  32.         u)
  33.             # make UnixWare floppy
  34.             setflag=-u
  35.             ;;
  36.         l)
  37.             LANG=$OPTARG
  38.             ;;
  39.         s)
  40.             special_flag=true
  41.             mv2cd_flag=true
  42.             ;;
  43.         \?)
  44.             print -u2 "Usage: $0 [-u] [-l locale]"
  45.             # The -s option is intentionally not listed here.
  46.             exit 1
  47.             ;;
  48.         *)
  49.             print -u2 Internal error during getopts.
  50.             exit 2
  51.             ;;
  52.     esac
  53. done
  54.  
  55. BASE=$ROOT/$LCL_MACH
  56. SOURCE_KERNEL=$BASE/stand/unix.nostrip
  57. DEST_KERNEL=$BASE/stand/unix
  58.  
  59. # Begin main processing
  60. cd $PROTO
  61. [ -d locale/$LANG/menus/help ] || mkdir -p locale/$LANG/menus/help
  62. cp /usr/lib/drf/locale/$LANG/locale_hcf.z locale/$LANG/menus/help
  63. (cd locale/$LANG/menus/help
  64.  [ -d dcu.d ] || mkdir dcu.d
  65.  cp /etc/dcu.d/locale/$LANG/help/* dcu.d
  66.  cd dcu.d
  67.  ls *.hcf | ksh /usr/lib/drf/cpioout > \
  68.  locale_hcf.z || {
  69.     print -u2 ERROR -- could not create dcu.d/locale_hcf.z.
  70.     exit 2
  71.     }
  72.  
  73. [ ! -s $SOURCE_KERNEL ] && {
  74.     print -u2 ERROR -- $SOURCE_KERNEL does not exist.
  75.     exit 1
  76. }
  77. print "\nCopying $SOURCE_KERNEL into\n$DEST_KERNEL."
  78. cp $SOURCE_KERNEL $DEST_KERNEL
  79.  
  80. cp $BASE/stand/loadmods $PROTO/stage/loadmods
  81.  
  82. # Create the bootmsg file
  83. echo "BOOTMSG1=Booting from the Emergency Recovery Floppy ..." > $PROTO/bootmsgs
  84. echo "BOOTMSG2=Bootstrap Command Processor\\" >> $PROTO/bootmsgs
  85. echo "Ready for boot commands... [? for help]\\" >> $PROTO/bootmsgs
  86. echo "" >> $PROTO/bootmsgs
  87. echo "TITLE=SCO UnixWare, based on SCO UNIX System V Release 5" >> $PROTO/bootmsgs
  88. echo "COPYRIGHT=Copyright 1997 SCO, Inc.  All Rights Reserved.\\" >> $PROTO/bootmsgs
  89. echo "U.S. Pat. No. 5,349,642" >> $PROTO/bootmsgs
  90. echo "AUTOMSG=Automatic Boot Procedure" >> $PROTO/bootmsgs
  91. echo "REBOOTMSG=Press any key to reboot..." >> $PROTO/bootmsgs
  92. echo "STARTUPMSG=The system is coming up.  Please wait." >> $PROTO/bootmsgs
  93.  
  94. # Create the boot file
  95. echo "ROOTFS=memfs" > $PROTO/boot
  96. echo "FILES=resmgr,memfs.meta,memfs.fs,kdb.rc" >> $PROTO/boot
  97. # echo "INITSTATE=1" >> $PROTO/boot
  98. grep -i "^DISABLE_CACHE=" /stand/boot >> $PROTO/boot
  99. grep -i "^DISABLE_PGE=" /stand/boot >> $PROTO/boot
  100. grep -i "^ENABLE_4GB_MEM=" /stand/boot >> $PROTO/boot
  101. grep -i "^IGNORE_MACHINE_CHECK=" /stand/boot >> $PROTO/boot
  102. grep -i "^LUNSEARCH=" /stand/boot >> $PROTO/boot
  103. grep -i "^MEMADJUST=" /stand/boot >> $PROTO/boot
  104. grep -i "^PCISCAN=" /stand/boot >> $PROTO/boot
  105. grep -i "^PDI_TIMEOUT=" /stand/boot >> $PROTO/boot
  106. grep -i "^PMAPLIMIT=" /stand/boot >> $PROTO/boot
  107.  
  108. # Copy boot help file
  109. cp /stand/help.txt $PROTO
  110.  
  111. # Create the passwd/group files, with all ids less than 100
  112. awk -F: ' NF > 0 { if ( $3 < 100 )
  113.         print $0 } ' /etc/passwd > $PROTO/passwd
  114. awk -F: ' NF > 0 { if ( $3 < 100 )
  115.         print $0 } ' /etc/group > $PROTO/group
  116.  
  117. # Create chan.ap.flop
  118. sed 's/ttcompat//g' /etc/ap/chan.ap > $PROTO/chan.ap.flop
  119.  
  120. #RAMPROTO="$ROOT/.$LCL_MACH/ramdfs.proto"
  121. LCL_TEMP=$PROTO/ramd$$ export LCL_TEMP
  122. MEMFS_META="$LCL_TEMP/memfs.meta" export MEMFS_META
  123. MEMFS_FS="$LCL_TEMP/memfs.fs" export MEMFS_FS
  124.  
  125. trap "[ ! -f $LCL_TEMP/mkfs.log ] && { rm -rf $LCL_TEMP}; exit 1" 1 2 3 15
  126. mkdir -p $LCL_TEMP
  127.  
  128. # Uncomment all locale-specific lines, if any
  129. # Delete all other comment lines
  130. sed \
  131.     -e '/^#/d' \
  132.     -e "s,\$ROOT,$ROOT," \
  133.     -e "s,\$MACH,$MACH," \
  134.     -e "s,\$WORK,$WORK," \
  135.     -e "s,\$LANG,$LANG," \
  136.     -e "s,\$PROTO,$PROTO," \
  137.     $RAMPROTOF \
  138.     > $LCL_TEMP/ramdproto
  139.  
  140. > $MEMFS_FS
  141. > $MEMFS_META
  142.  
  143. cp $LCL_TEMP/ramdproto /tmp/ramdproto.file
  144.  
  145.     #setup for NWS (if installed)
  146.     >$PROTO/nws_sys_path
  147.     $NWS_CONFIG && echo $NWS_SYS_PATH >$PROTO/nws_sys_path
  148.  
  149. print "\nMaking file system images.\n"
  150. ls /dev/dsk/c*b*t*d*s* /dev/rdsk/c*b*t*d*s* 2>/dev/null | cpio -oc > $PROTO/devs.cpio
  151. /usr/lib/drf/sbfmkfs $MEMFS_META $MEMFS_FS $LCL_TEMP/ramdproto 2>$LCL_TEMP/mkfs.log
  152. if [ -s $LCL_TEMP/mkfs.log ]
  153. then
  154.     print -u2 "\nERROR -- mkfs of ramdisk filesystem failed."
  155.     cat $LCL_TEMP/mkfs.log >&2
  156.     print -u2 "\nErrors are logged in $LCL_TEMP/mkfs.log"
  157.     rm -f $MEMFS_FS $MEMFS_META
  158.     exit 1
  159. fi
  160. cp $MEMFS_FS $MEMFS_META $PROTO/$LCL_MACH/stand
  161.  
  162. # If this isn't a KDB Bootable DRF floppy, strip the symbol table
  163. # if [ -z "$DRF_KDB" ]
  164. # then
  165. #    print "\nStripping symbol table from $DEST_KERNEL."
  166. #    $STRIP $DEST_KERNEL
  167. #fi
  168. print "\nEmptying .comment section of $DEST_KERNEL."
  169. $MCS -d $DEST_KERNEL
  170. rm -rf $LCL_TEMP
  171. exit 0
  172.