lw-build-system/install-symlinks.sh

64 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#
# Copyright: ©20062010, Laurence Withers.
# Author: Laurence Withers <l@lwithers.me.uk>
# License: GPLv3
#
[ -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"
# vim: expandtab:ts=4:sw=4