Refactor the nvs installation

This commit is contained in:
Manuel Thalmann 2023-04-06 17:45:48 +02:00
parent 8a4635fcc9
commit 53255a88f9

View file

@ -2,13 +2,19 @@
NVS_HOME="${NVS_HOME:-'$HOME/.nvs'}";
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"
do
if ! grep "\bNVS_HOME\b" "$profile"
then
{
echo "export NVS_HOME=\"$NVS_HOME\"";
echo "source \"$NVS_PATH/nvs.sh\"";
} | sudo tee "$profilePath" > /dev/null;
echo 'source "'"$NVS_PATH"'/nvs.sh"';
} | sudo tee "$profile";
fi;
done;
source "$profilePath";
source "$bashProfile";
nvs add latest;
nvs link latest;