cloney revision 61
0N/A#!/bin/ksh
157N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License (the "License").
157N/A# You may not use this file except in compliance with the License.
0N/A#
157N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0N/A# or http://www.opensolaris.org/os/licensing.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0N/A# If applicable, add the following below this CDDL HEADER, with the
0N/A# fields enclosed by brackets "[]" replaced with your own identifying
0N/A# information: Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
157N/A#
157N/A# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
157N/A#
0N/A# clone a directory to another using symlinks, in a very clunky way
0N/A
0N/Aif [ $# != 2 ]; then
0N/A echo "usage $0 srcdir destdir"
0N/A exit 1
0N/Afi
0N/A
0N/Asrcdir=$1
0N/Adestdir=$2
0N/A
0N/APATH=/usr/bin
0N/A
0N/Aecho symlink cloning $srcdir to $destdir
0N/A
0N/Acd ${srcdir}
0N/Afor i in `gfind . -type d | \
0N/A grep -v '^.$' | \
0N/A gsed -e 's,^./,,'`
0N/Ado
0N/A mkdir -p ${destdir}/$i
0N/Adone
for i in `gfind . -type f | \
gsed -e 's,^./,,'`
do
rm -f ${destdir}/$i
ln -s ${srcdir}/$i ${destdir}/$i
done