Module Name: src
Committed By: uki
Date: Sat Feb 11 04:16:57 UTC 2023
Modified Files:
src/distrib/sets: regpkg
Log Message:
Fix annotation checksum in +CONTENTS of syspkg
- Fix bug that file in DESTDIR is not referenced correctly.
- Change checksum algorithm to SHA256 from MD5.
- Remove invalid option of cksum(1) in regpkg.
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/distrib/sets/regpkg
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/regpkg
diff -u src/distrib/sets/regpkg:1.25 src/distrib/sets/regpkg:1.26
--- src/distrib/sets/regpkg:1.25 Mon Oct 18 10:47:44 2021
+++ src/distrib/sets/regpkg Sat Feb 11 04:16:57 2023
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# $NetBSD: regpkg,v 1.25 2021/10/18 10:47:44 uki Exp $
+# $NetBSD: regpkg,v 1.26 2023/02/11 04:16:57 uki Exp $
#
# Copyright (c) 2003,2009 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -628,7 +628,7 @@ EOF
# "@name" line and a lot of "@comment MD5:" lines.
#
{
- rcsid='$NetBSD: regpkg,v 1.25 2021/10/18 10:47:44 uki Exp $'
+ rcsid='$NetBSD: regpkg,v 1.26 2023/02/11 04:16:57 uki Exp $'
utcdate="$(${ENV_CMD} TZ=UTC LOCALE=C \
${DATE} '+%Y-%m-%d %H:%M')"
user="${USER:-root}"
@@ -665,16 +665,15 @@ EOF
;;
*)
# This should be a file name. Pass it
- # through, and append "@comment MD5:".
- # XXX why not SHA256 ?
+ # through, and append "@comment SHA256:".
echo "${line}"
- file="${DESTDIR}${line}"
- if [ -f "${file}" -a -r "${file}" ];
+ file="${DESTDIR}/${line}"
+ if [ -f "${file}" ] && [ -r "${file}" ];
then
- md5sum="$(${CKSUM} -n -m "${file}" \
+ sha256sum="$(${CKSUM} -a sha256 -n "${file}" \
| ${AWK} '{print $1}'
)"
- echo "@comment MD5:${md5sum}"
+ echo "@comment SHA256:${sha256sum}"
fi
;;
esac