Skip to content

Commit d49355c

Browse files
committed
Resolve initrd input paths before directory changes
1 parent 735a4ba commit d49355c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

misc/AMDSEV/build-initrd.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,17 @@ if [[ $# -lt 2 ]] || [[ "${1:-}" == "-h" ]] || [[ "${1:-}" == "--help" ]]; then
8484
usage
8585
fi
8686

87-
KATANA_BINARY="$1"
88-
OUTPUT_INITRD="$2"
87+
to_abs_path() {
88+
local path="$1"
89+
if [[ "$path" = /* ]]; then
90+
printf '%s\n' "$path"
91+
else
92+
printf '%s/%s\n' "$(pwd -P)" "$path"
93+
fi
94+
}
95+
96+
KATANA_BINARY="$(to_abs_path "$1")"
97+
OUTPUT_INITRD="$(to_abs_path "$2")"
8998
KERNEL_VERSION="${3:-${KERNEL_VERSION:?KERNEL_VERSION must be set or passed as third argument}}"
9099
OUTPUT_DIR="$(dirname "$OUTPUT_INITRD")"
91100

0 commit comments

Comments
 (0)