Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163172944
D57883.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D57883.diff
View Options
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -59,7 +59,7 @@
unset VERSION
if [ -z "${SYSDIR}" ]; then
- SYSDIR=$(dirname $0)/..
+ SYSDIR=$(dirname "$0")/..
fi
# allow random overrides
@@ -74,10 +74,10 @@
RELEASE="${RELEASE:-${REVISION}-${BRANCH}}"
VERSION="${VERSION:-${TYPE} ${RELEASE}}"
-RELDATE=$(awk '/^#define[[:space:]]*__FreeBSD_version/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h})
+RELDATE=$(awk '/^#define[[:space:]]*__FreeBSD_version/ {print $3}' "${PARAMFILE:-${SYSDIR}/sys/param.h}")
if [ -r "${SYSDIR}/../COPYRIGHT" ]; then
- year=$(sed -Ee '/^Copyright .* The FreeBSD Project/!d;s/^.*1992-([0-9]*) .*$/\1/g' ${SYSDIR}/../COPYRIGHT)
+ year=$(sed -Ee '/^Copyright .* The FreeBSD Project/!d;s/^.*1992-([0-9]*) .*$/\1/g' "${SYSDIR}"/../COPYRIGHT)
else
year=$(date +%Y)
fi
@@ -91,7 +91,7 @@
-e 's/\[your name here\]\.* /The FreeBSD Project./' \
-e 's/\[your name\]\.*/The FreeBSD Project./' \
-e '/\[id for your version control system, if any\]/d' \
- $bsd_copyright)
+ "${bsd_copyright}")
break
fi
done
@@ -132,16 +132,20 @@
# Only put variables that are single lines here.
for v in TYPE REVISION BRANCH RELEASE VERSION RELDATE; do
eval val=\$${v}
- echo ${v}=\"${val}\"
+ echo ${v}=\""${val}"\"
done
exit 0
;;
V)
v=$OPTARG
- eval val=\$${v}
- echo ${v}=\"${val}\"
+ eval val=\$"${v}"
+ echo "${v}"=\""${val}"\"
VARS_ONLY_EXIT=1
;;
+ *)
+ echo "$0: invalid option '-$OPTARG'" >&2
+ exit 1
+ ;;
esac
done
shift $((OPTIND - 1))
@@ -160,20 +164,20 @@
#
findvcs()
{
+ # shellcheck disable=SC3043
local savedir
-
- savedir=$(pwd)
- cd ${SYSDIR}/..
- while [ $(pwd) != "/" ]; do
+ savedir="$(pwd)"
+ cd "${SYSDIR}/.." || exit 1
+ while [ "$(pwd)" != "/" ]; do
if [ -e "./$1" ]; then
VCSTOP=$(pwd)
VCSDIR=${VCSTOP}"/$1"
- cd ${savedir}
+ cd "${savedir}" || exit 1
return 0
fi
cd ..
done
- cd ${savedir}
+ cd "${savedir}" || exit 1
return 1
}
@@ -192,9 +196,10 @@
v=$(cat version)
u=${USER:-root}
d=$builddir
+# shellcheck disable=SC3028
h=${HOSTNAME:-$(hostname)}
if [ -n "$SOURCE_DATE_EPOCH" ]; then
- if ! t=$(date -ur $SOURCE_DATE_EPOCH 2>/dev/null); then
+ if ! t=$(date -ur "${SOURCE_DATE_EPOCH}" 2>/dev/null); then
echo "Invalid SOURCE_DATE_EPOCH" >&2
exit 1
fi
@@ -208,13 +213,11 @@
if [ ! -z "${svnversion}" ] ; then
break
fi
- if [ -x "${dir}/svnversion" ] && [ -z ${svnversion} ] ; then
+ if [ -x "${dir}/svnversion" ] && [ -z "${svnversion}" ] ; then
# Run svnversion from ${dir} on this script; if return code
# is not zero, the checkout might not be compatible with the
# svnversion being used.
- ${dir}/svnversion $(realpath ${0}) >/dev/null 2>&1
- if [ $? -eq 0 ]; then
- svnversion=${dir}/svnversion
+ if "${dir}/svnversion" "$(realpath "${0}")" >/dev/null 2>&1; then
break
fi
fi
@@ -243,7 +246,7 @@
fi
if [ -n "$svnversion" ] ; then
- svn=$(cd ${SYSDIR} && $svnversion 2>/dev/null)
+ svn=$(cd "${SYSDIR}" && $svnversion 2>/dev/null)
case "$svn" in
[0-9]*[MSP]|*:*)
svn=" r${svn}"
@@ -267,7 +270,7 @@
fi
fi
git_b=$($git_cmd rev-parse --abbrev-ref HEAD)
- if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then
+ if [ -n "$git_b" ] && [ "$git_b" != "HEAD" ] ; then
git="${git_b}-${git}"
fi
if git_tree_modified; then
@@ -278,7 +281,7 @@
fi
if [ -n "$gituprevision" ] ; then
- gitup=" $(awk -F: '{print $2}' $gituprevision)"
+ gitup=" $(awk -F: '{print $2}' "${gituprevision}")"
fi
if [ -n "$hg_cmd" ] ; then
@@ -293,7 +296,7 @@
fi
fi
-[ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes
+[ ${include_metadata} = "if-modified" ] && [ ${modified} = "yes" ] && include_metadata=yes
if [ ${include_metadata} != "yes" ]; then
VERINFO="${VERSION}${svn}${git}${gitup}${hg} ${i}"
VERSTR="${VERINFO}\\n"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 21, 5:47 PM (6 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34411224
Default Alt Text
D57883.diff (3 KB)
Attached To
Mode
D57883: sys/conf/newvers.sh: small fixes
Attached
Detach File
Event Timeline
Log In to Comment