Further WIP on upgrade script.

This commit is contained in:
Laurence Withers 2006-07-26 20:31:20 +01:00
parent 2214851d6e
commit baeb18a03e
1 changed files with 36 additions and 8 deletions

View File

@ -11,6 +11,8 @@ then
exit 1 exit 1
fi fi
[ -z "${VERBOSE}" ] && VERBOSE="0"
# #
@ -19,7 +21,7 @@ fi
# #
X=$(pwd) X=$(pwd)
cd $1 || exit 1 cd $1 || exit 1
if [ ! -e make.sh -o ! -L scripts ] if [ ! -e make.sh -o ! -L scripts/module-create.sh ]
then then
echo "This doesn't look like an lw-build-system project to me." echo "This doesn't look like an lw-build-system project to me."
exit 1 exit 1
@ -28,7 +30,7 @@ fi
PROJECT_ROOT=$(pwd) PROJECT_ROOT=$(pwd)
P=$(basename ${PROJECT_ROOT}) P=$(basename ${PROJECT_ROOT})
cd ${X} cd ${X}
cd $(basename $0) || exit 1 cd $(dirname $0) || exit 1
SCRIPT_ROOT=$(pwd) SCRIPT_ROOT=$(pwd)
source skel/scripts/functions.sh || exit 1 source skel/scripts/functions.sh || exit 1
@ -55,7 +57,11 @@ cleanup() {
} }
do_cmd mkdir upgrade.tmp || cleanup do_cmd mkdir upgrade.tmp || cleanup
do_cmd ${SCRIPT_ROOT}/create.sh upgrade.tmp ${P} || cleanup echo "DEBUG START"
ls
ls upgrade.tmp
echo "DEBUG END"
do_cmd_redir /dev/null ${SCRIPT_ROOT}/create.sh ${PROJECT_ROOT}/upgrade.tmp ${P} || cleanup
for module in src/* for module in src/*
do do
M=$(basename ${module}) M=$(basename ${module})
@ -77,13 +83,35 @@ do
fi fi
done done
do_cmd_redir upgrade.diff \ diff -ru --exclude='*.c' --exclude='*.cpp' --exclude='*.h' \
diff -ru --exclude='*.c' --exclude='*.cpp' --exclude='*.h' \ ./ upgrade.tmp/${P} \
./ upgrade.tmp/${P} | grep -v '^Only in' || cleanup | grep -v '^Only in' \
> upgrade.diff
if [ $? -eq 2 ]
then
print_failure "diff failed."
cleanup
fi
case $? in
0)
print_success "Already up to date."
rm upgrade.diff
;;
1)
print_success "Upgrade complete. See upgrade.diff for diff."
;;
2)
print_failure "Diff failed."
cleanup
;;
esac
rm -rf upgrade.tmp rm -rf upgrade.tmp
print_success "Upgrade complete. See upgrade.diff for diff."
if [ ! -z ${FAILED} ] if [ ! -z "${FAILED}" ]
then then
print_failure "Upgrading of these modules failed: ${FAILED}" print_failure "Upgrading of these modules failed: ${FAILED}"
fi fi