#!/bin/bash
#
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# ROCK Linux: rock-src/scripts/Create-Links
# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
# 
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
# 
# --- ROCK-COPYRIGHT-NOTE-END ---

linkconfig=""
linkbuild=""

while [ "$1" ] ; do
    case "$1" in
        -config)
		linkconfig=config ; shift ;;
        -build)
		linkbuild=build   ; shift ;;
        -*)
echo
echo "Usage: ./scripts/Create-Links [ -config ] [ -build ] target-dir"
echo
echo " Create symlinks from your ROCK Linux base directory to another directory."
echo " This can be useful if you have the ROCK sources on one harddisk (NFS Share,"
echo " etc) and want to build somewhere else."
echo " Type './scripts/Help Create-Links' for details."
echo
                exit 1 ;;
	*)
		break ;;
    esac
done

if [ -z "$1" -o "$#" != 1 -o ! -d "$1" ] ; then
	exec $0 --help
fi

for x in README COPYING ; do
	[ -e $1/$x ] || ln -vs Documentation/$x $1/$x
done

for x in architecture target misc scripts Documentation \
         download package $linkconfig $linkbuild
do
	[ -e $x ] || mkdir $x
	[ -e $1/$x ] || ln -vs `pwd`/$x $1/$x
done

if [ ! -e $1/backup -a -e `pwd`/backup ] ; then
	ln -vs `pwd`/backup $1/backup
fi