head	1.4;
access;
symbols
	VER_0_3:1.4
	VER_0_2:1.3;
locks; strict;
comment	@# @;


1.4
date	95.03.24.11.43.35;	author coulter;	state Exp;
branches;
next	1.3;

1.3
date	95.03.10.02.42.22;	author coulter;	state Exp;
branches;
next	1.2;

1.2
date	95.02.19.16.06.41;	author coulter;	state Exp;
branches;
next	1.1;

1.1
date	95.02.19.09.10.40;	author coulter;	state Exp;
branches;
next	;


desc
@Script to initialize the mirror directory with top-level symbolic links.
@


1.4
log
@Checkin version for 0.3 distribution.
@
text
@#! /bin/bash
USAGE='USAGE: logiso_init [ -d config_prefix ]
   Initialize MAP_TO_PATH to mirror the top level of MOUNT_PATH
'
# (C) Copyright 1995 by Michael Coulter.  All rights reserved.

# Process parameters

   CONFIG_PREFIX=""
   if [ $# -ge 2 -a "$1" = "-d" ]
   then
      shift  # done with -d
      CONFIG_PREFIX="$1"; shift
   fi
   if [ $# -ne 0 ]
   then
      echo "$USAGE" >&2
      echo "Too many arguments." >&2
      exit 1
   fi

# Set variables

   ISOFS_UTIL_DIR="${ISOFS_UTIL_DIR:-/usr/src/linux/fs/isofs/Utils}"

# Source in user definitions
# MOUNT_PATH
# MAP_TO_PATH
# CD_FILE

   . "${ISOFS_UTIL_DIR}/${CONFIG_PREFIX}config"
   export ISOFS_UTIL_DIR

# Define standard functions

   . "$ISOFS_UTIL_DIR/ksh_fns"

# Check for root

   if [ "$EUID" -ne 0 ]
   then
      echo "$USAGE" >&2
      echo "You are not root. Do you want to continue (type y for yes)?" >&2
      read RESPONSE
      if [ "$RESPONSE" != "y" ]
      then
	 exit 1
      fi
   fi

# do it

   if [ "${MAP_TO_PATH}" != "/" ]
   then
      echo "About to replace $MAP_TO_PATH and everything below it." >&2
      echo "Type y for yes to confirm:" >&2
      read RESPONSE
      if [ "$RESPONSE" != "y" ]
      then
	 exit 1
      fi
      check_cmd 10 rm -rf "$MAP_TO_PATH"
      check_cmd 12 mkdir "$MAP_TO_PATH"
   fi
   check_cmd 14 cd "$MOUNT_PATH"     
   for FILE in * .??* .[^.]
   do
      if [ -e "$FILE" ]
      then
         if [ "$MAP_TO_PATH" = "/" ]
         then
	    ln -s "$MOUNT_PATH/$FILE" "/$FILE"
         else
	    ln -s "$MOUNT_PATH/$FILE" "$MAP_TO_PATH/$FILE"
         fi
      fi
   done
   check_links -d "$CONFIG_PREFIX" "$MAP_TO_PATH"  > /dev/null
   exit 0
@


1.3
log
@Checkin files modified to make version 0.2
@
text
@d5 1
@


1.2
log
@Checkpoint version 0.1
@
text
@d2 1
a2 1
USAGE='USAGE: logiso_init
d8 6
d30 1
a30 1
   . "${ISOFS_UTIL_DIR}/config"
d77 1
a77 1
   check_links "$MAP_TO_PATH"  > /dev/null
@


1.1
log
@Initial revision
@
text
@d46 1
a46 1
   if [ "$(dirname "$MAP_TO_PATH")" != "/" ]
d50 1
d71 1
@
