mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
Merge pull request #779 from MrChromebox/pwd_fix
Encapsulate changes to working directory inside subshells
This commit is contained in:
commit
b9f487aa36
@ -42,7 +42,7 @@ verify_global_hashes()
|
||||
TMP_PACKAGE_TRIGGER_PRE="/tmp/kexec/kexec_package_trigger_pre.txt"
|
||||
TMP_PACKAGE_TRIGGER_POST="/tmp/kexec/kexec_package_trigger_post.txt"
|
||||
|
||||
if cd /boot && sha256sum -c "$TMP_HASH_FILE" > /tmp/hash_output ; then
|
||||
if ( cd /boot && sha256sum -c "$TMP_HASH_FILE" > /tmp/hash_output ) then
|
||||
return 0
|
||||
elif [ ! -f $TMP_HASH_FILE ]; then
|
||||
if (whiptail $CONFIG_ERROR_BG_COLOR --clear --title 'ERROR: Missing Hash File!' \
|
||||
|
@ -217,8 +217,8 @@ set_default_boot_option()
|
||||
echo "$entry" > /boot/kexec_default.1.txt
|
||||
|
||||
# validate boot option
|
||||
cd /boot && /bin/kexec-boot -b "/boot" -e "$entry" -f \
|
||||
| xargs sha256sum > $hash_file 2>/dev/null \
|
||||
( cd /boot && /bin/kexec-boot -b "/boot" -e "$entry" -f \
|
||||
| xargs sha256sum > $hash_file 2>/dev/null ) \
|
||||
|| whiptail_error_die "Failed to create hashes of boot files"
|
||||
}
|
||||
|
||||
|
@ -272,12 +272,14 @@ update_checksums()
|
||||
fi
|
||||
# remount RW
|
||||
mount -o rw,remount /boot
|
||||
(
|
||||
cd /boot
|
||||
find ./ -type f ! -name '*kexec*' | xargs sha256sum > /boot/kexec_hashes.txt
|
||||
if [ -e /boot/kexec_default_hashes.txt ]; then
|
||||
DEFAULT_FILES=$(cat /boot/kexec_default_hashes.txt | cut -f3 -d ' ')
|
||||
echo $DEFAULT_FILES | xargs sha256sum > /boot/kexec_default_hashes.txt
|
||||
fi
|
||||
)
|
||||
# Remove any package trigger log files
|
||||
# We don't need them after the user decides to sign
|
||||
rm -f /boot/kexec_package_trigger*
|
||||
@ -301,7 +303,7 @@ update_checksums()
|
||||
detect_boot_device()
|
||||
{
|
||||
# unmount /boot to be safe
|
||||
umount /boot 2>/dev/null
|
||||
cd / && umount /boot 2>/dev/null
|
||||
|
||||
# check $CONFIG_BOOT_DEV if set/valid
|
||||
if [ -e "$CONFIG_BOOT_DEV" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user