Refactor the nvs installation

This commit is contained in:
Manuel Thalmann 2023-04-06 17:45:48 +02:00
parent 6e67b188c2
commit 7283846d26

View file

@ -2,13 +2,19 @@
NVS_HOME="${NVS_HOME:-'$HOME/.nvs'}"; NVS_HOME="${NVS_HOME:-'$HOME/.nvs'}";
NVS_PATH="${NVS_PATH}"; NVS_PATH="${NVS_PATH}";
profilePath="/etc/profile.d/nvs-home.sh"; bashProfile="/etc/bash.bashrc";
{ for profile in "$bashProfile" "/etc/fish/conf.d/nvs.fish" "/etc/zsh/zprofile"
echo "export NVS_HOME=\"$NVS_HOME\""; do
echo "source \"$NVS_PATH/nvs.sh\""; if ! grep "\bNVS_HOME\b" "$profile"
} | sudo tee "$profilePath" > /dev/null; then
{
echo "export NVS_HOME=\"$NVS_HOME\"";
echo 'source "'"$NVS_PATH"'/nvs.sh"';
} | sudo tee "$profile";
fi;
done;
source "$profilePath"; source "$bashProfile";
nvs add latest; nvs add latest;
nvs link latest; nvs link latest;