-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set YADM_ env variables in boostrap #291
Comments
This has worked for me: export YADM_TEST=1
local nounset=${-//[^u]/}
[ -n "${nounset}" ] && set +o nounset
# shellcheck disable=1090 source=~/bin/yadm
source yadm
process_global_args
set_operating_system
set_awk
set_yadm_dirs
configure_paths
set_local_alt_values
[ -n "${nounset}" ] && set -o nounset
unset YADM_TEST
YADM_CLASS="$local_class"
YADM_OS="$local_system"
YADM_HOSTNAME="$local_host"
YADM_USER="$local_user"
YADM_DISTRO="$local_distro"
YADM_SOURCE="${BASH_SOURCE[0]}"
export YADM_CLASS YADM_OS YADM_HOSTNAME YADM_USER YADM_DISTRO YADM_SOURCE This will introduce other variables into the namespace. If you are concerned about that you can wrap everything in an # shellcheck disable=2046
eval $(
export YADM_TEST=1
set +o nounset
# shellcheck disable=1090 source=~/bin/yadm
source yadm
process_global_args
set_operating_system
set_awk
set_yadm_dirs
configure_paths
set_local_alt_values
# shellcheck disable=2154
printf 'export YADM_CLASS="%s" YADM_OS="%s" YADM_HOSTNAME="%s" YADM_USER="%s" YADM_DISTRO="%s"' \
"$local_class" "$local_system" "$local_host" "$local_user" "$local_distro"
) |
@jankatins I don't see any issues with making these available to bootstraps. I think this change will also expose similar data to hooks. Ideally, the data exposed to hooks and bootstrap should be handled in one bit of unified code. |
Upstream issue: TheLocehiliosan#291 Upstream PR: TheLocehiliosan#312
Upstream issue: TheLocehiliosan#291 Upstream PR: TheLocehiliosan#312
Upstream issue: TheLocehiliosan#291 Upstream PR: TheLocehiliosan#312
This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Upstream issue: TheLocehiliosan#291 Upstream PR: TheLocehiliosan#312
Upstream issue: TheLocehiliosan#291 Upstream PR: TheLocehiliosan#312
Is your feature request related to a problem? Please describe.
It would be nice to be able to run boostrap and rely on the YADM_* env variables (as in the template system) being set. I imagine I can work around that by using the template system for the boostrap file, but just exporting the env variables would be easier.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
I would like to use these to make OS/distro/hostname specific commands in the bootstrap file.
The text was updated successfully, but these errors were encountered: