|
@@ -36,6 +36,10 @@ VARIANTS='mesh'
|
36
|
36
|
NODEJS_VERSION='6.2.2'
|
37
|
37
|
NODEJS_N_VERSION='2.1.4'
|
38
|
38
|
|
|
39
|
+# This file keeps track of the apps needing nodejs
|
|
40
|
+# so that it can be removed if tere are no apps which need it
|
|
41
|
+NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
|
|
42
|
+
|
39
|
43
|
function mesh_install_nodejs {
|
40
|
44
|
chroot "${rootdir}" apt-get -yq install nodejs
|
41
|
45
|
chroot "${rootdir}" apt-get -yq install npm curl
|
|
@@ -65,6 +69,31 @@ EOF
|
65
|
69
|
chroot "${rootdir}" rm -f /root/install-nodejs.sh
|
66
|
70
|
}
|
67
|
71
|
|
|
72
|
+function remove_nodejs {
|
|
73
|
+ if [ ! $1 ]; then
|
|
74
|
+ return
|
|
75
|
+ fi
|
|
76
|
+ if [ ! -f $NODEJS_INSTALLED_APPS_FILE ]; then
|
|
77
|
+ return
|
|
78
|
+ fi
|
|
79
|
+ sed -i "/install_${1}/d" $NODEJS_INSTALLED_APPS_FILE
|
|
80
|
+ if ! grep "install_" $NODEJS_INSTALLED_APPS_FILE; then
|
|
81
|
+ apt-get -yq remove --purge nodejs
|
|
82
|
+
|
|
83
|
+ if [ -f /usr/bin/nodejs ]; then
|
|
84
|
+ rm /usr/bin/nodejs
|
|
85
|
+ fi
|
|
86
|
+ if [ -f /usr/local/bin/node ]; then
|
|
87
|
+ rm /usr/local/bin/node
|
|
88
|
+ fi
|
|
89
|
+ if [ -f /usr/bin/node ]; then
|
|
90
|
+ rm /usr/bin/node
|
|
91
|
+ fi
|
|
92
|
+
|
|
93
|
+ rm $NODEJS_INSTALLED_APPS_FILE
|
|
94
|
+ fi
|
|
95
|
+}
|
|
96
|
+
|
68
|
97
|
function install_nodejs {
|
69
|
98
|
if [ $INSTALLING_MESH ]; then
|
70
|
99
|
mesh_install_nodejs
|
|
@@ -101,6 +130,12 @@ EOF
|
101
|
130
|
fi
|
102
|
131
|
rm -f /root/install-nodejs.sh
|
103
|
132
|
|
|
133
|
+ if [ $1 ]; then
|
|
134
|
+ if ! grep "install_${1}" $NODEJS_INSTALLED_APPS_FILE; then
|
|
135
|
+ echo "install_${1}" >> $NODEJS_INSTALLED_APPS_FILE
|
|
136
|
+ fi
|
|
137
|
+ fi
|
|
138
|
+
|
104
|
139
|
mark_completed $FUNCNAME
|
105
|
140
|
}
|
106
|
141
|
|