init scripts: revert environment before settings new one, on session loading#5036
Closed
rjbou wants to merge 5 commits intoocaml:masterfrom
Closed
init scripts: revert environment before settings new one, on session loading#5036rjbou wants to merge 5 commits intoocaml:masterfrom
rjbou wants to merge 5 commits intoocaml:masterfrom
Conversation
… revert it. Also some rework of writing scripts functions, factorise `if' statement writing, add precondition handling, etc.
rjbou
commented
Feb 2, 2022
rjbou
commented
Feb 2, 2022
| Printf.sprintf "%s\n%s" | ||
| (* XXX duplicated with variables.sh *) | ||
| (iif "! ${?OPAM_SWITCH_PREFIX}" {|setenv OPAM_SWITCH_PREFIX ""|}) | ||
| (iif {|"x$OPAM_SWITCH_PREFIX" != "x"|} |
Collaborator
Author
There was a problem hiding this comment.
Same than bash safeguard, needed?
rjbou
commented
Feb 2, 2022
| (iif {|"x$OPAM_SWITCH_PREFIX" != "x"|} | ||
| "eval `opam env --revert --shell=csh --readonly`") | ||
| | SH_fish -> | ||
| iif {|test -n "$OPAM_SWITCH_PREFIX"|} |
Collaborator
Author
There was a problem hiding this comment.
nox safeguard trick, is it needed?
rjbou
commented
Feb 2, 2022
AltGr
reviewed
Feb 3, 2022
| pad icond ithen (ielse_expr ielse) pad | ||
| | SH_zsh -> | ||
| Printf.sprintf "%sif [[ %s ]]; then\n %s%s%sfi" | ||
| pad icond ithen (ielse_expr ielse) pad |
Member
There was a problem hiding this comment.
Why is the bash / zsh distinction needed here ? I thought both syntaxes existed in both, with [[ allowing more specific built-ins. [ should behave the same for zsh as for bash.
Collaborator
Author
There was a problem hiding this comment.
Simply because I took if expression from if_interactive_script, and it set this sh/zsh difference
rjbou
commented
Feb 3, 2022
| # Prefix of the current opam switch | ||
| OPAM_SWITCH_PREFIX='${BASEDIR}/root/fake'; export OPAM_SWITCH_PREFIX; | ||
| # Current opam switch man dir | ||
| MANPATH="$MANPATH":'${BASEDIR}/root/fake/man'; export MANPATH; |
Collaborator
Author
There was a problem hiding this comment.
too bad, we can't keep man in test, it's not present on some os
### cat root/opam-init/variables.sh
# Prefix of the current opam switch
OPAM_SWITCH_PREFIX='${BASEDIR}/root/fake'; export OPAM_SWITCH_PREFIX;
-# Current opam switch man dir
-MANPATH="$MANPATH":'${BASEDIR}/root/fake/man'; export MANPATH;
# Binary dir for opam switch fake
PATH='${BASEDIR}/root/fake/bin':"$PATH"; export PATH;
This was referenced Feb 16, 2024
Collaborator
Author
|
Superseed by #6729 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #4649 + add a test that display init scripts