First stab at upgrade script committed.

This commit is contained in:
Laurence Withers 2006-07-26 20:18:00 +01:00
parent 939b7201dc
commit 2214851d6e
2 changed files with 83 additions and 1 deletions

View File

@ -8,6 +8,9 @@
# Creates a new source module.
# save a copy of the commandline for the upgrade script
MODULE_PARAMS="$@"
# Get the directory of the repository (needed to include functions file)
@ -87,7 +90,7 @@ echo "Instantiating module 'src/${NAME}'..."
do_cmd cp -rL ${TEMPLATE} src/${NAME} || cleanup
do_cmd cd src/${NAME} || cleanup
do_cmd rm instantiate || cleanup
do_cmd_redir .params echo "$@" || cleanup
do_cmd_redir .params echo "${MODULE_PARAMS}" || cleanup
( source ../../${TEMPLATE}/instantiate ) || cleanup

View File

@ -11,5 +11,84 @@ then
exit 1
fi
#
# Sort out directories, checking that we're looking at a real project,
# and eventually include the standard functions
#
X=$(pwd)
cd $1 || exit 1
if [ ! -e make.sh -o ! -L scripts ]
then
echo "This doesn't look like an lw-build-system project to me."
exit 1
fi
PROJECT_ROOT=$(pwd)
P=$(basename ${PROJECT_ROOT})
cd ${X}
cd $(basename $0) || exit 1
SCRIPT_ROOT=$(pwd)
source skel/scripts/functions.sh || exit 1
do_cmd cd ${PROJECT_ROOT} || exit 1
#
# Prepare a 'new' project installation
#
echo "Beginning upgrade..."
if [ -e upgrade.tmp -o -e upgrade.diff ]
then
print_failure "upgrade.tmp or upgrade.diff exist -- not overwriting"
exit 1
fi
cleanup() {
cd ${PROJECT_ROOT}
rm -rf upgrade.tmp upgrade.diff
print_failure "Removed upgrade temporary files."
exit 1
}
do_cmd mkdir upgrade.tmp || cleanup
do_cmd ${SCRIPT_ROOT}/create.sh upgrade.tmp ${P} || cleanup
for module in src/*
do
M=$(basename ${module})
echo " Upgrading ${module}"
if [ ! -e ${module}/.params ]
then
FAILED="${FAILED}
- ${module}/.params missing (custom module?)"
continue
fi
upgrade.tmp/${P}/scripts/module-create.sh $(cat ${module}/.params) > /dev/null
if [ $? -ne 0 ]
then
FAILED="${FAILED}
- ${module} could not be recreated (invalid params?)"
continue
fi
done
do_cmd_redir upgrade.diff \
diff -ru --exclude='*.c' --exclude='*.cpp' --exclude='*.h' \
./ upgrade.tmp/${P} | grep -v '^Only in' || cleanup
rm -rf upgrade.tmp
print_success "Upgrade complete. See upgrade.diff for diff."
if [ ! -z ${FAILED} ]
then
print_failure "Upgrading of these modules failed: ${FAILED}"
fi
true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4