Skip to content

Commit 28b3451

Browse files
committed
root uses global
1 parent d76a6ac commit 28b3451

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

install

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,29 @@ EOT
7575

7676
fi
7777

78+
# Comment out /root/.bashrc
79+
BASHRC_FILE="/root/.bashrc"
80+
81+
# Lines to search for
82+
NVM_LINES=(
83+
'export NVM_DIR="$HOME/.nvm"'
84+
'[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
85+
'[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
86+
)
87+
88+
# Iterate over each line and comment it out if not already commented
89+
for line in "${NVM_LINES[@]}"; do
90+
# Escape special characters in the line for use in grep and sed
91+
escaped_line=$(printf '%s\n' "$line" | sed 's/[.[\*^$(){}?+|]/\\&/g')
92+
93+
# Check if the line exists and is not already commented
94+
if grep -q "$escaped_line" "$BASHRC_FILE" && ! grep -q "# $escaped_line" "$BASHRC_FILE"; then
95+
sed -i "s|$escaped_line|# $line|" "$BASHRC_FILE"
96+
echo "Commented out: $line"
97+
else
98+
echo "Line not found or already commented: $line"
99+
fi
100+
done
101+
78102
# Notify installation has finished
79103
/usr/local/hestia/bin/v-add-user-notification admin NodeApp "<span style=\"font-size:large;color:green;\">&#11042;</span> NodeApp plugin has finished installing."

0 commit comments

Comments
 (0)