|
@@ -39,6 +39,7 @@ IPFS_N_VERSION='2.1.4'
|
39
|
39
|
IPFS_JS_VERSION='0.14.3'
|
40
|
40
|
IPFS_JS_RONIN_VERSION='0.3.11'
|
41
|
41
|
IPFS_KEY_LENGTH=2048
|
|
42
|
+IPFS_GO_VERSION=0.4.2
|
42
|
43
|
|
43
|
44
|
function reconfigure_ipfs {
|
44
|
45
|
echo -n ''
|
|
@@ -378,50 +379,47 @@ function install_ipfs_js {
|
378
|
379
|
}
|
379
|
380
|
|
380
|
381
|
function mesh_install_ipfs_go {
|
381
|
|
- chroot ${rootdir} apt-get -y install golang libpam0g-dev fuse
|
|
382
|
+ chroot ${rootdir} apt-get -y install libpam0g-dev fuse wget
|
382
|
383
|
|
383
|
384
|
mesh_upgrade_golang
|
384
|
385
|
|
385
|
|
- GOPATH=/home/go/go${GO_VERSION}
|
|
386
|
+ IPFS_ARCH=
|
386
|
387
|
IPFS_PATH=/usr/bin
|
387
|
388
|
|
388
|
|
- cat <<EOF > ${rootdir}/root/install_ipfs_go.sh
|
389
|
|
-export GOPATH=$GOPATH
|
390
|
|
-export GOROOT=/home/go
|
391
|
|
-
|
392
|
|
-IPFS_PATH=$IPFS_PATH
|
393
|
|
-
|
394
|
|
-echo "go get -u ${IPFS_GO_REPO_BASE}/cmd/ipfs"
|
395
|
|
-go get -u ${IPFS_GO_REPO_BASE}/cmd/ipfs
|
396
|
|
-if [ ! "$?" = "0" ]; then
|
397
|
|
- exit 8242
|
398
|
|
-fi
|
399
|
|
-
|
400
|
|
-if [ ! -d $GOPATH/src/$IPFS_GO_REPO_BASE ]; then
|
401
|
|
- echo $'go get failed to get ipfs'
|
402
|
|
- exit 63923
|
403
|
|
-fi
|
404
|
|
-
|
405
|
|
-cd \$GOPATH/src/${IPFS_GO_REPO_BASE}
|
406
|
|
-git checkout $IPFS_COMMIT -b $IPFS_COMMIT
|
407
|
|
-if [ ! "$?" = "0" ]; then
|
408
|
|
- exit 735639
|
409
|
|
-fi
|
|
389
|
+ if [ ! -d $rootdir$INSTALL_DIR/ipfs ]; then
|
|
390
|
+ mkdir -p $rootdir$INSTALL_DIR/ipfs
|
|
391
|
+ fi
|
|
392
|
+ cd $rootdir$INSTALL_DIR/ipfs
|
410
|
393
|
|
411
|
|
-make install
|
412
|
|
-if [ ! "$?" = "0" ]; then
|
413
|
|
- exit 6743895
|
414
|
|
-fi
|
|
394
|
+ if [[ $ARCHITECTURE == *"386" ]]; then
|
|
395
|
+ IPFS_ARCH=386
|
|
396
|
+ fi
|
|
397
|
+ if [[ $ARCHITECTURE == *"amd64" ]]; then
|
|
398
|
+ IPFS_ARCH=amd64
|
|
399
|
+ fi
|
|
400
|
+ if [[ $ARCHITECTURE == *"arm"* ]]; then
|
|
401
|
+ IPFS_ARCH=arm
|
|
402
|
+ fi
|
|
403
|
+ if [ ! $IPFS_ARCH ]; then
|
|
404
|
+ return
|
|
405
|
+ fi
|
415
|
406
|
|
416
|
|
-exit 0
|
417
|
|
-EOF
|
418
|
|
- chroot ${rootdir} chmod +x /root/install_ipfs_go.sh
|
419
|
|
- chroot ${rootdir} bash /root/install_ipfs_go.sh
|
420
|
|
- if [ ! -f ${rootdir}$IPFS_PATH/ipfs ]; then
|
421
|
|
- echo 'IPFS was not installed'
|
422
|
|
- exit 73529
|
|
407
|
+ IPFS_FILE=go-ipfs_v${IPFS_GO_VERSION}_linux-${IPFS_ARCH}.tar.gz
|
|
408
|
+ wget https://ipfs.io/ipns/dist.ipfs.io/go-ipfs/v${IPFS_GO_VERSION}/${IPFS_FILE}
|
|
409
|
+ if [ ! -f $rootdir$INSTALL_DIR/ipfs/${IPFS_FILE} ]; then
|
|
410
|
+ echo $'IPFS package could not be downloaded'
|
|
411
|
+ exit 63725
|
|
412
|
+ fi
|
|
413
|
+ tar -xzvf ${IPFS_FILE}
|
|
414
|
+ if [ ! -f $rootdir$INSTALL_DIR/ipfs/go-ipfs/ipfs ]; then
|
|
415
|
+ echo $"ipfs was not found in downloaded package"
|
|
416
|
+ exit 638235
|
|
417
|
+ fi
|
|
418
|
+ chroot "$rootdir" cp $INSTALL_DIR/ipfs/go-ipfs/ipfs $IPFS_PATH
|
|
419
|
+ if [ ! -f $rootdir$IPFS_PATH/ipfs ]; then
|
|
420
|
+ echo $'IPFS was not installed'
|
|
421
|
+ exit 63722
|
423
|
422
|
fi
|
424
|
|
- chroot ${rootdir} rm -f /root/install_ipfs_go.sh
|
425
|
423
|
|
426
|
424
|
echo '[Unit]' > ${rootdir}/etc/systemd/system/ipfs.service
|
427
|
425
|
echo 'Description=IPFS go daemon' >> ${rootdir}/etc/systemd/system/ipfs.service
|
|
@@ -433,9 +431,9 @@ EOF
|
433
|
431
|
echo "User=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
|
434
|
432
|
echo "Group=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
|
435
|
433
|
echo "WorkingDirectory=/home/$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
|
436
|
|
- echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> ${rootdir}/etc/systemd/system/ipfs.service
|
|
434
|
+ echo "ExecStart=$IPFS_PATH/ipfs daemon" >> ${rootdir}/etc/systemd/system/ipfs.service
|
437
|
435
|
echo 'Restart=on-failure' >> ${rootdir}/etc/systemd/system/ipfs.service
|
438
|
|
- echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=$GOPATH\"" >> ${rootdir}/etc/systemd/system/ipfs.service
|
|
436
|
+ echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=/home/go/go${GO_VERSION}\"" >> ${rootdir}/etc/systemd/system/ipfs.service
|
439
|
437
|
echo '' >> ${rootdir}/etc/systemd/system/ipfs.service
|
440
|
438
|
echo '[Install]' >> ${rootdir}/etc/systemd/system/ipfs.service
|
441
|
439
|
echo 'WantedBy=multi-user.target' >> ${rootdir}/etc/systemd/system/ipfs.service
|