Update shell files to use /bin/bash and POSIX .
bash's earlier problems with subshells running scripts starting #!/bin/bash seem to be solved, so explicitly mark all scripts as requiring bash. Furthermore, change all source built-ins to prefix the path with "./" as required by POSIX. Together these changes should stop further problems with changes of source built-in semantics in future.
This commit is contained in:
parent
13efab326f
commit
dcee211388
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# (c)2009, Laurence Withers. Released under the GNU GPL. See file
|
# (c)2009, Laurence Withers. Released under the GNU GPL. See file
|
||||||
# COPYING for details.
|
# COPYING for details.
|
||||||
|
@ -52,7 +52,7 @@ then
|
||||||
echo "Edit this file, and then re-run the build process."
|
echo "Edit this file, and then re-run the build process."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
do_cmd source ${LWBUILDRC} || exit 1
|
do_cmd source "${LWBUILDRC}" || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ case "$#" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
source ${SCRIPT_ROOT}/skel/scripts/functions.sh || exit 1
|
source "${SCRIPT_ROOT}/skel/scripts/functions.sh" || exit 1
|
||||||
|
|
||||||
cd ${PROJECT_ROOT}
|
cd ${PROJECT_ROOT}
|
||||||
if [ -L scripts/module-create.sh ]
|
if [ -L scripts/module-create.sh ]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# lw-build-system/scripts/config-printflags.sh
|
# lw-build-system/scripts/config-printflags.sh
|
||||||
#
|
#
|
||||||
# (c)2009, Laurence Withers <l@lwithers.me.uk>.
|
# (c)2009, Laurence Withers <l@lwithers.me.uk>.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# lw-build-system/scripts/module-create.sh
|
# lw-build-system/scripts/module-create.sh
|
||||||
#
|
#
|
||||||
# (c)2009, Laurence Withers, <l@lwithers.me.uk>.
|
# (c)2009, Laurence Withers, <l@lwithers.me.uk>.
|
||||||
|
@ -19,7 +19,7 @@ cd $(dirname $(pwd))
|
||||||
P=$(basename $(pwd))
|
P=$(basename $(pwd))
|
||||||
TOP=$(pwd)
|
TOP=$(pwd)
|
||||||
[ -z "${VERBOSE}" ] && VERBOSE="0"
|
[ -z "${VERBOSE}" ] && VERBOSE="0"
|
||||||
source scripts/functions.sh || exit 1
|
source "./scripts/functions.sh" || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ get_cname() {
|
||||||
# for each argument X, it will replace @X@ with ${X}
|
# for each argument X, it will replace @X@ with ${X}
|
||||||
do_parameter_subst() {
|
do_parameter_subst() {
|
||||||
CNAME=$(get_cname ${NAME})
|
CNAME=$(get_cname ${NAME})
|
||||||
do_cmd source ~/.lwbuildrc || exit 1
|
do_cmd source "~/.lwbuildrc" || exit 1
|
||||||
for param in P NAME CNAME AUTHOR EMAIL VIM_MODELINE KATE_MODELINE $@
|
for param in P NAME CNAME AUTHOR EMAIL VIM_MODELINE KATE_MODELINE $@
|
||||||
do
|
do
|
||||||
do_cmd_redir sedscript echo "s,@${param}@,${!param},g" || exit 1
|
do_cmd_redir sedscript echo "s,@${param}@,${!param},g" || exit 1
|
||||||
|
@ -113,7 +113,7 @@ do_cmd cd src/${NAME} || cleanup
|
||||||
do_cmd rm instantiate || cleanup
|
do_cmd rm instantiate || cleanup
|
||||||
do_cmd_redir .params echo "${MODULE_PARAMS}" || cleanup
|
do_cmd_redir .params echo "${MODULE_PARAMS}" || cleanup
|
||||||
|
|
||||||
( source ../../${TEMPLATE}/instantiate ) || cleanup
|
( source "../../${TEMPLATE}/instantiate" ) || cleanup
|
||||||
|
|
||||||
print_success "Module instantiated"
|
print_success "Module instantiated"
|
||||||
grep -r "@TODO@" .
|
grep -r "@TODO@" .
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# lw-build-system/scripts/release.sh
|
# lw-build-system/scripts/release.sh
|
||||||
#
|
#
|
||||||
# (c)2009, Laurence Withers, <l@lwithers.me.uk>.
|
# (c)2009, Laurence Withers, <l@lwithers.me.uk>.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# lw-build-system/scripts/version.sh
|
# lw-build-system/scripts/version.sh
|
||||||
#
|
#
|
||||||
# (c)2009, Laurence Withers <l@lwithers.me.uk>.
|
# (c)2009, Laurence Withers <l@lwithers.me.uk>.
|
||||||
|
@ -43,32 +43,32 @@ edit_versions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bump_major() {
|
bump_major() {
|
||||||
source version
|
source "./version"
|
||||||
edit_versions "version" "VERMAJOR" "$[${VERMAJOR} + 1]" "VERMINOR" "0" "VERMICRO" "0"
|
edit_versions "version" "VERMAJOR" "$[${VERMAJOR} + 1]" "VERMINOR" "0" "VERMICRO" "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
bump_minor() {
|
bump_minor() {
|
||||||
source version
|
source "./version"
|
||||||
edit_versions "version" "VERMINOR" "$[${VERMINOR} + 1]" "VERMICRO" "0"
|
edit_versions "version" "VERMINOR" "$[${VERMINOR} + 1]" "VERMICRO" "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
bump_micro() {
|
bump_micro() {
|
||||||
source version
|
source "./version"
|
||||||
edit_versions "version" "VERMICRO" "$[${VERMICRO} + 1]"
|
edit_versions "version" "VERMICRO" "$[${VERMICRO} + 1]"
|
||||||
}
|
}
|
||||||
|
|
||||||
bump_somajor() {
|
bump_somajor() {
|
||||||
source src/$1/soversion
|
source "./src/$1/soversion"
|
||||||
edit_versions "src/$1/soversion" "SOMAJOR" "$[${SOMAJOR} + 1]" "SOMINOR" "0" "SOMICRO" "0"
|
edit_versions "src/$1/soversion" "SOMAJOR" "$[${SOMAJOR} + 1]" "SOMINOR" "0" "SOMICRO" "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
bump_somicro() {
|
bump_somicro() {
|
||||||
source src/$1/soversion
|
source "./src/$1/soversion"
|
||||||
edit_versions "src/$1/soversion" "SOMICRO" "$[${SOMICRO} + 1]"
|
edit_versions "src/$1/soversion" "SOMICRO" "$[${SOMICRO} + 1]"
|
||||||
}
|
}
|
||||||
|
|
||||||
do_tag() {
|
do_tag() {
|
||||||
source version
|
source "./version"
|
||||||
git tag "${VERMAJOR}.${VERMINOR}.${VERMICRO}"
|
git tag "${VERMAJOR}.${VERMINOR}.${VERMICRO}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# @P@/make.sh
|
# @P@/make.sh
|
||||||
#
|
#
|
||||||
# (c)2009, @AUTHOR@, <@EMAIL@>.
|
# (c)2009, @AUTHOR@, <@EMAIL@>.
|
||||||
|
@ -15,19 +15,19 @@ then
|
||||||
echo "Configuration file not found???"
|
echo "Configuration file not found???"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
source "config" # don't fail on error, since last command in config might return false
|
source "./config" # don't fail on error, since last command in config might return false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get version information
|
# Get version information
|
||||||
source version || exit 1
|
source "./version" || exit 1
|
||||||
VERSION="${VERMAJOR}.${VERMINOR}.${VERMICRO}"
|
VERSION="${VERMAJOR}.${VERMINOR}.${VERMICRO}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get standard functions
|
# Get standard functions
|
||||||
[ -z "${VERBOSE}" ] && VERBOSE="0"
|
[ -z "${VERBOSE}" ] && VERBOSE="0"
|
||||||
source scripts/functions.sh || exit 1
|
source "./scripts/functions.sh" || exit 1
|
||||||
|
|
||||||
|
|
||||||
# List of directories which will be emptied by clean.
|
# List of directories which will be emptied by clean.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# @P@/test.sh
|
# @P@/test.sh
|
||||||
#
|
#
|
||||||
# (c)2009, @AUTHOR@, <@EMAIL@>.
|
# (c)2009, @AUTHOR@, <@EMAIL@>.
|
||||||
|
@ -33,10 +33,10 @@ print_tests() {
|
||||||
echo "---------------------------------------------------------------------"
|
echo "---------------------------------------------------------------------"
|
||||||
for EXE in obj/tests/*
|
for EXE in obj/tests/*
|
||||||
do
|
do
|
||||||
[ -x ${EXE} ] || continue
|
[ -x "${EXE}" ] || continue
|
||||||
NAME=$(echo ${EXE} | sed 's,obj/tests/,,')
|
NAME="$(echo "${EXE}" | sed 's,obj/tests/,,')"
|
||||||
echo -ne "${NAME}\t"
|
echo -ne "${NAME}\t"
|
||||||
LD_LIBRARY_PATH="obj" ${EXE} --print-summary
|
LD_LIBRARY_PATH="obj" "${EXE}" --print-summary
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ cd ${X}
|
||||||
cd $(dirname $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
|
||||||
do_cmd cd ${PROJECT_ROOT} || exit 1
|
do_cmd cd ${PROJECT_ROOT} || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue