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