|
@@ -201,7 +201,74 @@ function configure_firewall_for_ipfs {
|
201
|
201
|
echo 'configure_firewall_for_ipfs' >> $COMPLETION_FILE
|
202
|
202
|
}
|
203
|
203
|
|
|
204
|
+function mesh_install_ipfs_js {
|
|
205
|
+ if grep -Fxq "mesh_install_ipfs_js" $COMPLETION_FILE; then
|
|
206
|
+ return
|
|
207
|
+ fi
|
|
208
|
+
|
|
209
|
+ chroot ${rootdir} apt-get -y install npm
|
|
210
|
+ chroot ${rootdir} apt-get -y install libpam0g-dev fuse
|
|
211
|
+
|
|
212
|
+ chroot ${rootdir} npm cache clean -f
|
|
213
|
+ chroot ${rootdir} npm install -g n
|
|
214
|
+ chroot ${rootdir} n ${IPFS_NODE_VERSION}
|
|
215
|
+ chroot ${rootdir} npm install ronin@${IPFS_JS_RONIN_VERSION} --global
|
|
216
|
+ chroot ${rootdir} npm install ipfs@${IPFS_JS_VERSION} --global
|
|
217
|
+
|
|
218
|
+ IPFS_PATH=/usr/local/bin
|
|
219
|
+
|
|
220
|
+ if [ ! -f ${rootdir}$IPFS_PATH/jsipfs ]; then
|
|
221
|
+ exit 637292
|
|
222
|
+ fi
|
|
223
|
+
|
|
224
|
+ # directories to mount to
|
|
225
|
+ if [ ! -d ${rootdir}/ipfs ]; then
|
|
226
|
+ chroot ${rootdir} mkdir /ipfs
|
|
227
|
+ chroot ${rootdir} mkdir /ipns
|
|
228
|
+ chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /ipfs
|
|
229
|
+ chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /ipns
|
|
230
|
+ fi
|
|
231
|
+
|
|
232
|
+ if [ -f ${rootdir}/etc/fuse.conf ]; then
|
|
233
|
+ chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /etc/fuse.conf
|
|
234
|
+ fi
|
|
235
|
+ if [ -f ${rootdir}/dev/fuse ]; then
|
|
236
|
+ chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /dev/fuse
|
|
237
|
+ fi
|
|
238
|
+
|
|
239
|
+ IPFS_DAEMON_NAME=ipfs
|
|
240
|
+ IPFS_DAEMON_FILE=${rootdir}/etc/systemd/system/${IPFS_DAEMON_NAME}.service
|
|
241
|
+ echo '[Unit]' > $IPFS_DAEMON_FILE
|
|
242
|
+ echo 'Description=IPFS javascript daemon' >> $IPFS_DAEMON_FILE
|
|
243
|
+ echo 'After=syslog.target' >> $IPFS_DAEMON_FILE
|
|
244
|
+ echo 'After=network.target' >> $IPFS_DAEMON_FILE
|
|
245
|
+ echo '' >> $IPFS_DAEMON_FILE
|
|
246
|
+ echo '[Service]' >> $IPFS_DAEMON_FILE
|
|
247
|
+ echo 'Type=simple' >> $IPFS_DAEMON_FILE
|
|
248
|
+ echo "User=$MY_USERNAME" >> $IPFS_DAEMON_FILE
|
|
249
|
+ echo "Group=$MY_USERNAME" >> $IPFS_DAEMON_FILE
|
|
250
|
+ echo "WorkingDirectory=/home/$MY_USERNAME" >> $IPFS_DAEMON_FILE
|
|
251
|
+ echo "ExecStart=${IPFS_PATH}/jsipfs daemon --mount" >> $IPFS_DAEMON_FILE
|
|
252
|
+ echo 'Restart=on-failure' >> $IPFS_DAEMON_FILE
|
|
253
|
+ echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\"" >> $IPFS_DAEMON_FILE
|
|
254
|
+ echo '' >> $IPFS_DAEMON_FILE
|
|
255
|
+ echo '[Install]' >> $IPFS_DAEMON_FILE
|
|
256
|
+ echo 'WantedBy=multi-user.target' >> $IPFS_DAEMON_FILE
|
|
257
|
+
|
|
258
|
+ chroot ${rootdir} systemctl enable ${IPFS_DAEMON_NAME}
|
|
259
|
+ chroot ${rootdir} systemctl daemon-reload
|
|
260
|
+
|
|
261
|
+ function_check create_avahi_service
|
|
262
|
+ create_avahi_service ipfs "ipfs" udp $IPFS_PORT "IPFS_PEER_ID"
|
|
263
|
+
|
|
264
|
+ echo 'mesh install_ipfs_js' >> $COMPLETION_FILE
|
|
265
|
+}
|
|
266
|
+
|
204
|
267
|
function install_ipfs_js {
|
|
268
|
+ if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
|
269
|
+ mesh_install_ipfs_js
|
|
270
|
+ return
|
|
271
|
+ fi
|
205
|
272
|
if grep -Fxq "install_ipfs_js" $COMPLETION_FILE; then
|
206
|
273
|
return
|
207
|
274
|
fi
|