On Tue, Jan 10, 2023 at 03:50:15PM +0000, Jim Scadden wrote:
> I just noticed a minor typo in an error message produced when no value
> is given to the new --debootstrap-keyring-file parameter. Updated patch
> attached.

Trying again with the right file this time.

Cheers
Jim
diff --git a/build-openstack-debian-image b/build-openstack-debian-image
index 9b2e69a..9f97631 100755
--- a/build-openstack-debian-image
+++ b/build-openstack-debian-image
@@ -25,6 +25,8 @@ Options are:
  --debootstrap-url|-u <debootstrap-mirror> (default: http://deb.debian.org/debian)
  --sources.list-mirror|-s <source-list-mirror> (default: http://deb.debian.org/debian)
  --extra-packages|-e <package>,<package>,...
+ --debootstrap-keyring-file|-k <path-to-keyring>
+ --copy-debootstrap-keyring-file
  --rescue (implies: --permit-ssh-as-root --add-serial-getty ttyS0 --tty-autologin yes)
  --hook-script|-hs <hook-script>
  --image-size|-is <image-size> (default: 2G)
@@ -138,6 +140,20 @@ for i in $@ ; do
 		shift
 		shift
 	;;
+	"--debootstrap-keyring-file"|"-k")
+		if [ -z "${2}" ] ; then
+			echo "No parameter defining the debootstrap keyring file"
+			usage
+		fi
+		DEBOOTSTRAP_KEYRING="${2}"
+		DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --keyring=${2}"
+		shift
+		shift
+	;;
+	"--copy-debootstrap-keyring-file")
+		COPY_DEBOOTSTRAP_KEYRING=yes
+		shift
+	;;
 	"--minimal"|"-m")
 		EXTRA=no
 		shift
@@ -955,7 +971,7 @@ if [ "${BOOTTYPE}" = "uefi" ] ; then
 fi
 
 debootstrap --verbose \
-	--include=${PKG_LIST} \
+	--include=${PKG_LIST} ${DEBOOTSTRAP_OPTIONS} \
 	${RELEASE} ${MOUNT_DIR} ${DEB_MIRROR}
 
 
@@ -1244,6 +1260,11 @@ fi
 #	done
 #fi
 
+if [ "${COPY_DEBOOTSTRAP_KEYRING}" = "yes" ] && [ -n "${DEBOOTSTRAP_KEYRING}" ] ; then
+	cp "${DEBOOTSTRAP_KEYRING}" ${MOUNT_DIR}/etc/apt/trusted.gpg.d/
+	cp "${DEBOOTSTRAP_KEYRING}" ${MOUNT_DIR}/usr/share/keyrings/
+fi
+
 # We do it *after* the debootstrap, as otherwise it fails with
 # systemd-shim conflicting with systemd-sysv.
 chroot ${MOUNT_DIR} apt-get update

Reply via email to