Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dm-verity setup to initoverlayfs-install script #71

Closed
wants to merge 1 commit into from

Conversation

martinmcconnell
Copy link
Collaborator

No description provided.

Signed-off-by: Martin McConnell <mmcconne@redhat.com>
@dougsland
Copy link
Collaborator

@martinmcconnell probably you missed to setup username and email in git and use git commit -s which DCO is complaining about.

@dougsland
Copy link
Collaborator

Also, we just merged a patch, you might need a rebase as well.

@@ -37,6 +37,30 @@ exec_erofs() {
popd
rm -f "${INITRAMFS_DIR}/initoverlayfs-$kver.img"
mkfs.erofs $erofs_compression "${INITRAMFS_DIR}/initoverlayfs-$kver.img" ${INITRAMFS_DUMP_DIR}

generate_dm_verity_hash "${INITRAMFS_DIR}/initoverlayfs-$kver.img" "${INITRAMFS_DIR}/verity_table.img" $INITOVERLAYFS_CONF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering if there are extra spaces in the indentation here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that indentation is not in my file. Newline is there but can be removed if requested.
Should I close this pull request and fix the issues?

Copy link
Collaborator

@dougsland dougsland Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinmcconnell as there is a patch merged recently might be easier to you instead of rebase manually.

echo "root_hash=$verity_root_hash" >> "$conf_path"
# remove tempfile
echo "dm-verity setup complete" | systemd-cat -t initoverlayfs-setup
# rm -f verity_output.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably need to remove this comment?

echo "Confirmation: dm-verity setup completed successfully."
rm -f verity_output.txt
else
echo"Warning: dm-verity error"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a space after echo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question, should we fail here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the top of this script has:

set -ex

we automatically should fail when:

veritysetup format

has a non-zero exit code anyway.

@@ -37,6 +37,30 @@ exec_erofs() {
popd
rm -f "${INITRAMFS_DIR}/initoverlayfs-$kver.img"
mkfs.erofs $erofs_compression "${INITRAMFS_DIR}/initoverlayfs-$kver.img" ${INITRAMFS_DUMP_DIR}

generate_dm_verity_hash "${INITRAMFS_DIR}/initoverlayfs-$kver.img" "${INITRAMFS_DIR}/verity_table.img" $INITOVERLAYFS_CONF
if journalctl -b -o short-monotonic | grep -qi "dm-verity setup for initoverlayfs complete"; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: can we use long options instead of -b (--boot) and -o (--output), it makes easy to review.

local conf_path="$3"

# Generate dm-verity hash for the EROFS image
veritysetup format "$image_path" "$hash_table_path" &> verity_output.log
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use /tmp/verity_output.log? Probably TMPDIR is not set at this stage to use it. Also, I would suggest create a constant for /tmp/verity_output.log as it's used in more than place.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets just not create a logging system and leave the processes dump to stdout/stderr like all the other processes in this file...

else
CAT="cat"
fi
mkdir -p "${INITRAMFS_DUMP_DIR}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems indentation.


echo " - File path: ${file_path}"
echo " - Decompressor: $CAT"
file_path="${INITRAMFS_DIR}/initramfs-$kver.img"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be indentation too?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all has to be reverted in fact detect_initramfs should not change

Copy link
Collaborator

@dougsland dougsland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general looks good to me, just few comments.

@martinmcconnell
Copy link
Collaborator Author

Thanks Doug, I'll get to it. will close this shortly.

@@ -27,8 +27,8 @@ detect_path_initramfs() {

done

# on first build, like in osbuild, there will be no prior initrd to detect
INITRAMFS_DIR="/boot"
echo "Cannot detect initramfs path, aborting..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be changed back

@ericcurtin
Copy link
Collaborator

This whole PR, should be just one line:

veritysetup format ...

Many of these changes were brought in accidentally I believe from working off an older version of the code, that's ok, we can fix it :)

@martinmcconnell martinmcconnell deleted the VROOM-16770 branch February 20, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants