Refactor setting default ipxe compile options
Some checks failed
buildbot/travis_bionic Build done.
buildbot/multibuild_parent Build done.
buildbot/ipxe_x86_build_and_release Build done.

- reduce repeating code
- make parser more tolerant
This commit is contained in:
Peter Šurda 2022-09-20 18:54:44 +08:00
parent 943372ac70
commit b8b71aa1bd
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95

View File

@ -28,25 +28,23 @@ function sed_enabled_ipxe_features() {
return 1 return 1
fi fi
sed -ei 's/^\/\/\#define[[:space:]]+DOWNLOAD_PROTO_HTTPS/\#define\ DOWNLOAD_PROTO_HTTPS/g' "${ipxe_src_dir}/src/config/general.h" for OPTION in DOWNLOAD_PROTO_HTTPS \
sed -ei 's/^\/\/\#define[[:space:]]+NSLOOKUP_CMD/\#define\ NSLOOKUP_CMD/g' "${ipxe_src_dir}/src/config/general.h" NSLOOKUP_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+TIME_CMD/\#define\ TIME_CMD/g' "${ipxe_src_dir}/src/config/general.h" TIME_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+DIGEST_CMD/\#define\ DIGEST_CMD/g' "${ipxe_src_dir}/src/config/general.h" DIGEST_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+REBOOT_CMD/\#define\ REBOOT_CMD/g' "${ipxe_src_dir}/src/config/general.h" REBOOT_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+POWEROFF_CMD/\#define\ POWEROFF_CMD/g' "${ipxe_src_dir}/src/config/general.h" POWEROFF_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+IMAGE_TRUST_CMD/\#define\ IMAGE_TRUST_CMD/g' "${ipxe_src_dir}/src/config/general.h" IMAGE_TRUST_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+NTP_CMD/\#define\ NTP_CMD/g' "${ipxe_src_dir}/src/config/general.h" NTP_CMD \
sed -ei 's/^\/\/\#define[[:space:]]+CERT_CMD/\#define\ CERT_CMD/g' "${ipxe_src_dir}/src/config/general.h" CERT_CMD
do
sed -ei 's/^\#undef[[:space:]]+DOWNLOAD_PROTO_HTTPS/\#define\ DOWNLOAD_PROTO_HTTPS/g' "${ipxe_src_dir}/src/config/general.h" sed -ri \
sed -ei 's/^\#undef[[:space:]]+NSLOOKUP_CMD/\#define\ NSLOOKUP_CMD/g' "${ipxe_src_dir}/src/config/general.h" "s/^\\/+#define[[:space:]]+$OPTION[[:space:]/#define $OPTION /g" \
sed -ei 's/^\#undef[[:space:]]+TIME_CMD/\#define\ TIME_CMD/g' "${ipxe_src_dir}/src/config/general.h" "${ipxe_src_dir}/src/config/general.h"
sed -ei 's/^\#undef[[:space:]]+DIGEST_CMD/\#define\ DIGEST_CMD/g' "${ipxe_src_dir}/src/config/general.h" sed -ri
sed -ei 's/^\#undef[[:space:]]+REBOOT_CMD/\#define\ REBOOT_CMD/g' "${ipxe_src_dir}/src/config/general.h" "s/^#undef[[:space:]]+$OPTION[[:space:]/#define $OPTION /g" \
sed -ei 's/^\#undef[[:space:]]+POWEROFF_CMD/\#define\ POWEROFF_CMD/g' "${ipxe_src_dir}/src/config/general.h" "${ipxe_src_dir}/src/config/general.h"
sed -ei 's/^\#undef[[:space:]]+IMAGE_TRUST_CMD/\#define\ IMAGE_TRUST_CMD/g' "${ipxe_src_dir}/src/config/general.h" done
sed -ei 's/^\#undef[[:space:]]+NTP_CMD/\#define\ NTP_CMD/g' "${ipxe_src_dir}/src/config/general.h"
sed -ei 's/^\#undef[[:space:]]+CERT_CMD/\#define\ CERT_CMD/g' "${ipxe_src_dir}/src/config/general.h"
return 0 return 0
} }