diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in index 5667144..beadd53 100644 --- a/templates/lxc-alpine.in +++ b/templates/lxc-alpine.in @@ -222,10 +222,11 @@ fetch_apk_static() { local apk=$dest/sbin/apk.static [ -s "$apk" ] || die 2 'apk.static not found' - local keyname=$(echo "$apk".*.pub | sed 's/.*\.SIGN\.RSA\.//') + local sigprefix=$apk.SIGN.RSA. + local keyfile=$(ls -1 "$sigprefix"alpine-*.pub 2>/dev/null | head -n 1) openssl dgst -sha1 \ - -verify "$APK_KEYS_DIR/$keyname" \ - -signature "$dest/sbin/apk.static.SIGN.RSA.$keyname" \ + -verify "$APK_KEYS_DIR/${keyfile#$sigprefix}" \ + -signature "$keyfile" \ "$apk" \ || die 2 'Signature verification for apk.static failed'