On Thu, Jan 14, 2021 at 11:51:48PM +0100, Roland Hieber wrote:
> For debugging purposes it might be useful to run ptxdist inside a
> 'ptxdist bash' session, but under normal conditions this will not work
> out of the box. Mention the fact to prevent confusion and useless
> debugging sessions:
> 
>     $ ptxdist
>     FATAL didn't find /scripts/ptxdist_vars.sh
>     Note: PTXdist was called inside 'ptxdist bash' – things may be broken.

I think we should just fail. So 'ptxd_bailout' instead of echo. Calling
ptxdist here is just not supported.

Michael

> 
> Signed-off-by: Roland Hieber <[email protected]>
> ---
>  bin/ptxdist | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 0a252e4ab22e..da3adb134962 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -1695,6 +1695,7 @@ parse_second()
>  . ~/.bashrc
>  PS1="[ptx] \${PS1}"
>  PATH="${PATH}"
> +export INSIDE_PTXDIST_BASH=1
>  alias ptxsudo='sudo env PATH=$PATH'
>  EOF
>                               "${BASH}" --init-file "${bashrc}"
> @@ -2111,7 +2112,7 @@ setup_env() {
>       unset $({
>               export -p  | sed -n 's/^declare -x \([^=]*\).*$/\1/p'
>               export -fp | sed -n 's/^declare -fx \([^=]*\).*$/\1/p'
> -             } | egrep -v 
> "^(PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
> +             } | egrep -v 
> "^(INSIDE_PTXDIST_BASH|PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
>  
>       ######## the environment is clean now ########
>  
> @@ -2134,6 +2135,10 @@ ptxdist_trap_exit_handler() {
>       local retval="${?}"
>       local file
>  
> +     if [ -n "${INSIDE_PTXDIST_BASH}" ]; then
> +             echo "Note: PTXdist was called inside 'ptxdist bash' – things 
> may be broken." >/dev/tty
> +     fi
> +
>       if [ -n "${PTXDIST_TEMPDIR}" -a -d "${PTXDIST_TEMPDIR}" ]; then
>               rm -fr -- "${PTXDIST_TEMPDIR}"
>       fi
> -- 
> 2.30.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> [email protected]
> To unsubscribe, send a mail with subject "unsubscribe" to 
> [email protected]

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to