diff --git a/xCAT-genesis-base/oe/export b/xCAT-genesis-base/oe/export index bcc3f164f..292056480 100755 --- a/xCAT-genesis-base/oe/export +++ b/xCAT-genesis-base/oe/export @@ -37,13 +37,8 @@ machine_dir=$deploy_dir/images/$machine image_name=xcat-genesis-image-$machine.rootfs license_machine=${machine//-/_} -resolve_artifact() { - local path=$1 resolved - - resolved=$(readlink -f -- "$path") - [[ -f $resolved && ! -L $resolved ]] || fail "missing artifact: $path" - printf '%s\n' "$resolved" -} +script_dir=$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +source "$script_dir/scripts/export-functions" kernel=$(resolve_artifact "$machine_dir/$kernel_name") initramfs=$(resolve_artifact "$machine_dir/$image_name.cpio.gz") diff --git a/xCAT-genesis-base/oe/export-extension b/xCAT-genesis-base/oe/export-extension index 0c36915b9..3b535cf00 100755 --- a/xCAT-genesis-base/oe/export-extension +++ b/xCAT-genesis-base/oe/export-extension @@ -40,13 +40,7 @@ machine_dir=$deploy_dir/images/$machine stem=$extension-$machine artifact_stem=$stem.sysext -resolve_artifact() { - local path=$1 resolved - - resolved=$(readlink -f -- "$path") - [[ -f $resolved && ! -L $resolved ]] || fail "missing artifact: $path" - printf '%s\n' "$resolved" -} +source "$script_dir/scripts/export-functions" image=$(resolve_artifact "$machine_dir/$artifact_stem.squashfs-zst") manifest=$(resolve_artifact "$machine_dir/$artifact_stem.manifest.json") diff --git a/xCAT-genesis-base/oe/scripts/export-functions b/xCAT-genesis-base/oe/scripts/export-functions new file mode 100644 index 000000000..80eecca59 --- /dev/null +++ b/xCAT-genesis-base/oe/scripts/export-functions @@ -0,0 +1,7 @@ +resolve_artifact() { + local path=$1 resolved + + resolved=$(readlink -f -- "$path") + [[ -f $resolved && ! -L $resolved ]] || fail "missing artifact: $path" + printf '%s\n' "$resolved" +}