lw-build-system/install-symlinks.sh

64 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#
# (c)2009, Laurence Withers. Released under the GNU GPL. See file
# COPYING for details.
#
[ -z "${VERBOSE}" ] && VERBOSE="0"
usage() {
echo "Installs project maintainer symlinks into a checked-out"
echo "lw-build-system project."
echo " Usage: $0 [path/to/proj/root]"
echo " uses current directory if none specified."
}
case "$#" in
0)
if [ ! -e make.sh -o ! -d scripts ]
then
usage
exit 1
fi
PROJECT_ROOT=$(pwd)
cd $(dirname $0) || exit 1
SCRIPT_ROOT=$(pwd)
;;
1)
last=$(pwd)
cd $(dirname $0) || exit 1
SCRIPT_ROOT=$(pwd)
cd ${last} || exit 1
cd $1 || exit 1
if [ ! -e make.sh -o ! -d scripts ]
then
echo "Can't find $(pwd)/make.sh or $(pwd)/scripts"
exit 1
fi
PROJECT_ROOT=$(pwd)
;;
*)
usage
exit 1
;;
esac
source "${SCRIPT_ROOT}/skel/scripts/functions.sh" || exit 1
cd ${PROJECT_ROOT}
if [ -L scripts/module-create.sh ]
then
print_failure "It looks as though symlinks are already installed."
exit 1
fi
echo "Installing symlinks"
echo " ${SCRIPT_ROOT}/scripts/ -> ${PROJECT_ROOT}/scripts/"
do_cmd ln -s ${SCRIPT_ROOT}/scripts/* scripts/ || exit 1
print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4