File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 75
75
76
76
fi
77
77
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
+
78
102
# Notify installation has finished
79
103
/usr/local/hestia/bin/v-add-user-notification admin NodeApp " <span style=\" font-size:large;color:green;\" >⬢</span> NodeApp plugin has finished installing."
You can’t perform that action at this time.
0 commit comments