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_PATH="${NVS_PATH}";
profilePath="/etc/profile.d/nvs-home.sh";
bashProfile="/etc/bash.bashrc";
{
echo "export NVS_HOME=\"$NVS_HOME\"";
echo "source \"$NVS_PATH/nvs.sh\"";
} | sudo tee "$profilePath" > /dev/null;
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 "$profile";
fi;
done;
source "$profilePath";
source "$bashProfile";
nvs add latest;
nvs link latest;