From e6a3df70ad46113b75ee6610fc3d6ad5461e6e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 3 Apr 2022 18:08:47 +0700 Subject: [PATCH 1/3] hooks: also wrap scripts in pre-check --- common/hooks/pre-check/02-script-wrapper.sh | 1 + 1 file changed, 1 insertion(+) create mode 120000 common/hooks/pre-check/02-script-wrapper.sh diff --git a/common/hooks/pre-check/02-script-wrapper.sh b/common/hooks/pre-check/02-script-wrapper.sh new file mode 120000 index 000000000000..b637ffb30df8 --- /dev/null +++ b/common/hooks/pre-check/02-script-wrapper.sh @@ -0,0 +1 @@ +../pre-configure/02-script-wrapper.sh \ No newline at end of file From 94c9113cf882b64cc4153543e5b3ef3f9f8740c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 3 Apr 2022 18:09:59 +0700 Subject: [PATCH 2/3] script-wrappers: provide naive implementation of which --- .../hooks/pre-configure/02-script-wrapper.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/hooks/pre-configure/02-script-wrapper.sh b/common/hooks/pre-configure/02-script-wrapper.sh index 09c796001ea3..3eb7c645db1d 100644 --- a/common/hooks/pre-configure/02-script-wrapper.sh +++ b/common/hooks/pre-configure/02-script-wrapper.sh @@ -154,6 +154,23 @@ install_wrappers() { done } +install_which() { + if ! command -v which >/dev/null 2>&1; then + cat >>"${XBPS_WRAPPERDIR}/which" <<-'_EOF' + #!/bin/sh + ret=0 + while test $# != 0; do + case "$1" in + -*) ;; + *) command -v "$1" || ret=1 ;; + esac + shift + done + exit "$ret" + _EOF + fi +} + install_cross_wrappers() { local fname prefix @@ -188,6 +205,7 @@ hook() { export PATH="$XBPS_WRAPPERDIR:$PATH" install_wrappers + install_which [ -z "$CROSS_BUILD" ] && return 0 From 6d2cca7d2e08e397c6ef9662e8cec96ee74ef088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 3 Apr 2022 18:11:16 +0700 Subject: [PATCH 3/3] script-wrapper: use bsdtar as tar if tar isn't provided --- common/hooks/pre-configure/02-script-wrapper.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/hooks/pre-configure/02-script-wrapper.sh b/common/hooks/pre-configure/02-script-wrapper.sh index 3eb7c645db1d..a9767e5fa07d 100644 --- a/common/hooks/pre-configure/02-script-wrapper.sh +++ b/common/hooks/pre-configure/02-script-wrapper.sh @@ -171,6 +171,15 @@ install_which() { fi } +install_tar() { + if ! command -v tar >/dev/null 2>&1; then + cat >>"${XBPS_WRAPPERDIR}/tar" <<-'_EOF' + #!/bin/sh + bsdtar "$@" + _EOF + fi +} + install_cross_wrappers() { local fname prefix @@ -206,6 +215,7 @@ hook() { install_wrappers install_which + install_tar [ -z "$CROSS_BUILD" ] && return 0