Skip to content

Commit cceaa4b

Browse files
authored
package-diff: Make random sig key paths uniform (#173)
They tend to be something like /tmp/tmp.BhoxyXwykk/certs/modules.pem, so turn them into /tmp/tmp.XXX/certs/modules.pem, so they won't show up unnecessarily in the image changes reports. Tested locally with ``` CUTSIGKEYPATH=1 FROM_A=bincache FROM_B=bincache BOARD_A=amd64 BOARD_B=amd64 FILE=flatcar_production_image_kernel_config.txt ./package-diff 4426.1.0 4459.0.0 ```
2 parents d6663c2 + 4d7e42e commit cceaa4b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

package-diff

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
1818
echo "Alternatively, set CALCSIZE=1 to sum up the file sizes from flatcar_production_image_contents.txt (/boot and /usr, excluding symlinks and directories)"
1919
echo " If WITHNEWSTUFF is set to 1 (the default), this will try fetching the disk usage reports from the server instead"
2020
echo " If this fails, falls back to the old method."
21+
echo "Set CUTSIGKEYPATH=1 to avoid producing diffs on /tmp/tmp.XXXXXXX paths in kernel config."
2122
exit 1
2223
fi
2324

@@ -36,6 +37,7 @@ VERSION_A="$1"
3637
VERSION_B="$2"
3738
FILESONLY="${FILESONLY-0}"
3839
CUTKERNEL="${CUTKERNEL-0}"
40+
CUTSIGKEYPATH=${CUTSIGKEYPATH-0}
3941
CALCSIZE="${CALCSIZE-0}"
4042
WITHNEWSTUFF="${WITHNEWSTUFF-1}"
4143
WTD=0
@@ -227,6 +229,10 @@ elif [[ "$FILE" = *_contents.txt ]]; then
227229
echo "Usr: $((${B_USR}/1024/1024)) MiB (inc. sparse files)" >> "$B"
228230
echo "Rootfs: $((${B_ROOT}/1024/1024)) MiB" >> "$B"
229231
fi
232+
elif [[ ${FILE} = flatcar_production_image_kernel_config.txt ]]; then
233+
if [ "${CUTSIGKEYPATH}" = 1 ]; then
234+
sed -i -E 's#(CONFIG_MODULE_SIG_KEY="/tmp/).*(/certs/modules\.pem")#\1tmp.XXX\2#' "${A}" "${B}"
235+
fi
230236
fi
231237

232238
git diff --no-index -- "$A" "$B"

0 commit comments

Comments
 (0)