From 5ec40daaf37e78535cbc467e9eb9dcc5324ca5d7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 14 Aug 2016 22:04:34 +0100 Subject: [PATCH] Move back to go implementation of ipfs --- README.md | 8 +- doc/EN/homeserver.org | 3 +- doc/EN/mesh.org | 3 +- man/freedombone-image.1.gz | Bin 3498 -> 3526 bytes src/freedombone-app-ipfs | 95 +++++++++++- src/freedombone-image-mesh | 5 +- src/freedombone-utils-go | 306 ++++++++++++++++++++++++++----------- src/zeronetavahi | 3 +- website/EN/homeserver.html | 5 +- website/EN/mesh.html | 5 +- 10 files changed, 329 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index 49eb69d4..230bf75e 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,11 @@ Install the freedombone commands onto your laptop/desktop: Then install packages needed for building images: - sudo apt-get -y install python-docutils mktorrent vmdebootstrap xz-utils - sudo apt-get -y install dosfstools btrfs-tools extlinux python-distro-info mbr - sudo apt-get -y install qemu-user-static binfmt-support u-boot-tools qemu + + sudo apt-get -y install build-essential git python-docutils mktorrent + sudo apt-get -y install vmdebootstrap xz-utils dosfstools btrfs-tools extlinux + sudo apt-get -y install python-distro-info mbr qemu-user-static binfmt-support + sudo apt-get -y install u-boot-tools qemu A typical use case to build an 8GB image for a Beaglebone Black is as follows. You can change the size depending upon the capacity of your microSD card. diff --git a/doc/EN/homeserver.org b/doc/EN/homeserver.org index 2d8b6646..a2e0b0ad 100644 --- a/doc/EN/homeserver.org +++ b/doc/EN/homeserver.org @@ -21,7 +21,8 @@ First you will need to create an image. #+begin_src bash sudo su -apt-get -y install build-essential git python-docutils mktorrent \ +apt-get -y install build-essential libc6-dev-i386 \ +gcc-multilib g++-multilib git python-docutils mktorrent \ vmdebootstrap xz-utils dosfstools btrfs-tools extlinux \ python-distro-info mbr qemu-user-static binfmt-support \ u-boot-tools qemu diff --git a/doc/EN/mesh.org b/doc/EN/mesh.org index a99c46b9..2ddf64ca 100644 --- a/doc/EN/mesh.org +++ b/doc/EN/mesh.org @@ -24,7 +24,8 @@ First you will need to create an image. #+begin_src bash sudo su -apt-get -y install build-essential git python-docutils mktorrent \ +apt-get -y install build-essential libc6-dev-i386 \ +gcc-multilib g++-multilib git python-docutils mktorrent \ vmdebootstrap xz-utils dosfstools btrfs-tools extlinux \ python-distro-info mbr qemu-user-static binfmt-support \ u-boot-tools qemu diff --git a/man/freedombone-image.1.gz b/man/freedombone-image.1.gz index 0ed01bb2b2bce5ea6d8c58efca4fd28c68a84648..4c75a87a3819ef688a4f949b7a850e6f82ad29e1 100644 GIT binary patch literal 3526 zcmV;%4LR~3iwFP-VX#*K1GQOgZ`(K${_bBv_)BlGk<(^(i*9i}tdpjxam@>2XM4Te z;Xp~W&9y|TqGZ>_{`h-lNJ?_D?R7s~P!u*r@nzvEt$)jl~%M-t@D?om2G_CoZLFWicL&CiAyqd^Np1ACDd{_OC>o)k-$X z2`O@wYH5Uj;#%Fvv`}JcYoU#6WKn3d64o?UxV>vs>B8dk4_DVW^V$55Hb@$A-^hBU zntzL=756PpXJo1HtrGW@bZ%$s9N!X+@2UMHuv4QmF}o2m&uitJe^}eLQMI`5$Aw+u zU>G#25&khvHSU?Xf1_*Hh}Tzhf&I34Z+7FKorwFn%B;yBJqeNiO!;VAale%{OiZ>&YE@ax zsO@hmYs5<94m8r%1)i4TK6srVLRNxPq3!g4@cP|OPMKgzbmA9daRnvpGW87 z9;Sl5H#D%*OWo`%%!}X18{Q|?x|WVFD@&u?;IhHxug~Xax3inY?D}dvTCBAb**Cyw zSL=o_1O!Q3EUWGOwa8?hPr|aZtNCL3?%mX{`&w1XtfiJ`TE17L@f(Vtxhnv~i^qshyPcJ}iQv-v^vcl$| z1wK6?jbP?O)5CGM*4a8@sjUhtbANE!tRoXTN@W|58ibck8>tN@rh8FJvlnDqC$tOr z`$O7Gm0T5yDH$B{;sPdaU?Ra*x@&<&=_n+|=R5)!8mrZ22hgDnAvZ*Gyn)tmYwq70kk0Yc6)kR*+ zm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l zo`Mztbqs$C>bvD0A+!PNgLE?%_hqh`Aiceus9>>Ln60vI1K4Fr%>jv7C2AUZaHzGU zhCj=bKJAuK(G9Au!;#EQ`WV1Z>^@M+JbQuiA)3_|i6{uCvK}dhXg5ps|a~v*~0e zsFyM7exBk~8CbmQPPtw;vlCz4CzX&pjtME$iXfh8sH$<1ckC;ugI*ixTl+G7NP_T5 zTOCrm4`b(|{&&=n*c(Gn_Jix)UxAVD6gP5{c7@Y4G=-Y!_SMPB3gpx#W7zH_k#=3D zCj+0IXlvV!@hA6-w>NjA=*%SI+BD$TLi{x`$*-u<44B!D+s(K!e~ZRR9o=5to?P8t zy%Lv`UtXSG{`itd&vXN?Thg-P>^eS8-?!`HZ2McbtlzHRnSU-aTb*zIuJppx_sY)S Y@mudz@+x%y5BG}x3+n=leQ6*7035%+V*mgE diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs index d708f93e..60b4eb8e 100755 --- a/src/freedombone-app-ipfs +++ b/src/freedombone-app-ipfs @@ -227,6 +227,7 @@ npm install -g n@${IPFS_N_VERSION} --save n ${IPFS_NODE_VERSION} npm install -g ronin@${IPFS_JS_RONIN_VERSION} --save npm install -g ipfs@${IPFS_JS_VERSION} --save +exit 0 EOF chroot ${rootdir} chmod +x /root/install-ipfs.sh chroot ${rootdir} /root/install-ipfs.sh @@ -375,8 +376,98 @@ function install_ipfs_js { echo 'install_ipfs_js' >> $COMPLETION_FILE } +function mesh_install_ipfs_go { + chroot ${rootdir} apt-get -y install golang libpam0g-dev fuse + + mesh_upgrade_golang + + GOPATH=/home/git/gvm/pkgsets/go${GO_VERSION}/global + + cat < ${rootdir}/root/install_ipfs_go.sh +#!/bin/bash + +if [ ! -d /home/git ]; then + adduser --disabled-login --gecos 'Gogs' git + + # install Go + if ! grep -q "export GOPATH=" ~/.bashrc; then + echo "export GOPATH=\$GOPATH" >> ~/.bashrc + else + sed -i "s|export GOPATH=.*|export GOPATH=\$GOPATH|g" ~/.bashrc + fi + systemctl set-environment GOPATH=\$GOPATH + if ! grep -q "systemctl set-environment GOPATH=" ~/.bashrc; then + echo "systemctl set-environment GOPATH=\$GOPATH" >> ~/.bashrc + else + sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=\$GOPATH|g" ~/.bashrc + fi + if [ ! -d \$GOPATH ]; then + mkdir -p \$GOPATH + fi +fi + +IPFS_PATH=\$GOPATH/bin +export PATH="\$GOPATH/bin:\$PATH:" +if ! grep -q 'GOPATH/bin' ~/.bashrc; then + echo 'export PATH="\$GOPATH/bin:\$PATH:";' >> ~/.bashrc +else + sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=\$GOPATH|g" ~/.bashrc +fi + +# set gopath for the user +if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then + echo "export GOPATH=$GOPATH" >> /home/$MY_USERNAME/.bashrc + echo 'export PATH="\$GOPATH/bin:\$PATH:";' >> /home/$MY_USERNAME/.bashrc +else + sed -i "s|export GOPATH=.*|export GOPATH=\$GOPATH|g" /home/$MY_USERNAME/.bashrc +fi +chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc + +IPFS_GO_REPO2=$(echo "$IPFS_GO_REPO" | sed 's|https://||g') +go get -u ${IPFS_GO_REPO2}/cmd/ipfs +if [ ! "$?" = "0" ]; then + exit 8242 +fi + +cd \$GOPATH/src/$IPFS_GO_REPO2 +git checkout $IPFS_COMMIT -b $IPFS_COMMIT +exit 0 +EOF + chroot ${rootdir} chmod +x /root/install_ipfs_go.sh + chroot ${rootdir} /root/install_ipfs_go.sh + if [ ! "$?" = "0" ]; then + echo $'Failed to install ipfs go' + cat ${rootdir}/root/install_ipfs_go.sh + rm -f ${rootdir}/root/install_ipfs_go.sh + exit 365728 + fi + chroot ${rootdir} rm -f /root/install_ipfs_go.sh + + echo '[Unit]' > ${rootdir}/etc/systemd/system/ipfs.service + echo 'Description=IPFS go daemon' >> ${rootdir}/etc/systemd/system/ipfs.service + echo 'After=syslog.target' >> ${rootdir}/etc/systemd/system/ipfs.service + echo 'After=network.target' >> ${rootdir}/etc/systemd/system/ipfs.service + echo '' >> ${rootdir}/etc/systemd/system/ipfs.service + echo '[Service]' >> ${rootdir}/etc/systemd/system/ipfs.service + echo 'Type=simple' >> ${rootdir}/etc/systemd/system/ipfs.service + echo "User=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service + echo "Group=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service + echo "WorkingDirectory=/home/$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service + echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> ${rootdir}/etc/systemd/system/ipfs.service + echo 'Restart=on-failure' >> ${rootdir}/etc/systemd/system/ipfs.service + echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=$GOPATH\" \"GVM_ROOT=$GVM_HOME\"" >> ${rootdir}/etc/systemd/system/ipfs.service + echo '' >> ${rootdir}/etc/systemd/system/ipfs.service + echo '[Install]' >> ${rootdir}/etc/systemd/system/ipfs.service + echo 'WantedBy=multi-user.target' >> ${rootdir}/etc/systemd/system/ipfs.service + + chroot ${rootdir} systemctl enable ipfs +} function install_ipfs_go { + if [ $INSTALLING_MESH ]; then + mesh_install_ipfs_go + return + fi if grep -Fxq "install_ipfs_go" $COMPLETION_FILE; then return fi @@ -506,6 +597,6 @@ function install_ipfs_go { } function install_ipfs { - install_ipfs_js - #install_ipfs_go + #install_ipfs_js + install_ipfs_go } diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index 9e43cba2..4ed110ae 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -726,15 +726,16 @@ function setup_amnesic_data { function setup_ipfs { IPFS_PATH=/usr/bin IPFS_KEY_LENGTH=2048 + IPFS_COMMAND=$IPFS_PATH/ipfs - su -c "$IPFS_PATH/jsipfs init -b $IPFS_KEY_LENGTH" - $MY_USERNAME + su -c "$IPFS_COMMAND init -b $IPFS_KEY_LENGTH" - $MY_USERNAME if [ ! -d /home/$MY_USERNAME/.ipfs ]; then echo "IPFS could not be initialised for user $MY_USERNAME" >> $INSTALL_LOG exit 7358 fi MY_IPFS_ID=/home/$MY_USERNAME/.ipfs-id - su -c "echo $($IPFS_PATH/jsipfs id | grep '\"ID\":' | awk -F '\"' '{print $4}') > $MY_IPFS_ID" - $MY_USERNAME + su -c "echo $($IPFS_COMMAND id | grep '\"ID\":' | awk -F '\"' '{print $4}') > $MY_IPFS_ID" - $MY_USERNAME if [ ! -f $MY_IPFS_ID ]; then echo 'No IPFS identity was created' >> $INSTALL_LOG exit 37895 diff --git a/src/freedombone-utils-go b/src/freedombone-utils-go index 264da4c9..1f3adcf5 100755 --- a/src/freedombone-utils-go +++ b/src/freedombone-utils-go @@ -28,7 +28,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -GO_VERSION=1.5 +# For reasons unknown we initially have to upgrade to an intermediate version +# before getting to the version we want +GO_INTERMEDIATE_VERSION=1.4.2 + +GO_VERSION=1.6.3 GO_PACKAGE_MANAGER_REPO="https://github.com/gpmgo/gopm" GVM_HOME=/home/git/gvm @@ -36,113 +40,235 @@ GVM_REPO="https://github.com/moovweb/gvm" GVM_COMMIT='25ea8ae158e2861c92e2b22c458e60840157832f' function select_go_version { - if [ ! -d $GVM_HOME/bin ]; then - echo $'GVM was not installed' - exit 629532 - fi - export GVM_ROOT=$GVM_HOME - if ! grep -q "GVM_ROOT=" ~/.bashrc; then - echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc - else - sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_ROOT|g" ~/.bashrc - fi - cd $GVM_ROOT/bin - [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" - gvm use go${GO_VERSION} --default - systemctl set-environment GOPATH=$GOPATH + if [ ! -d $GVM_HOME/bin ]; then + echo $'GVM was not installed' + exit 629532 + fi + export GVM_ROOT=$GVM_HOME + if ! grep -q "GVM_ROOT=" ~/.bashrc; then + echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc + else + sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_ROOT|g" ~/.bashrc + fi + cd $GVM_ROOT/bin + [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" + gvm use go${GO_VERSION} --default - if [ ${#GOPATH} -lt 2 ]; then - echo $'GOPATH was not set' - exit 629825 - fi + if [ ${#GOPATH} -lt 2 ]; then + echo $'GOPATH was not set' + exit 629825 + fi + + systemctl set-environment GOPATH=$GOPATH +} + +function mesh_upgrade_golang { + cat < ${rootdir}/root/upgrade_golang.sh +#!/bin/bash + +export GVM_ROOT=$GVM_HOME + +apt-get -y install build-essential libc6-dev +apt-get -y install gcc-multilib g++-multilib make +apt-get -y install curl git mercurial binutils bison +if [ ! -d $INSTALL_DIR ]; then + mkdir $INSTALL_DIR +fi +cd $INSTALL_DIR + +git clone $GVM_REPO gvm + +cd $INSTALL_DIR/gvm +git checkout $GVM_COMMIT -b $GVM_COMMIT +if [ ! -f binscripts/gvm-installer ]; then + echo $'gvm installer not found' +fi +chmod +x binscripts/gvm-installer + +if [ -d /root/.gvm ]; then + rm -rf /root/.gvm +fi +if [ -d $GVM_HOME ]; then + rm -rf $GVM_HOME +fi +if ! grep -q "export GVM_ROOT=" ~/.bashrc; then + echo "export GVM_ROOT=$GVM_HOME" >> ~/.bashrc +else + sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_HOME|g" ~/.bashrc +fi + +if [ ! -d /home/git ]; then + adduser --disabled-login --gecos 'Gogs' git +fi +if [ -d /home/git/Maildir ]; then + rm -rf /home/git/Maildir +fi + +./binscripts/gvm-installer master /home/git + +if [ ! -d $GVM_HOME ]; then + echo $'Unable to install gvm' + exit 83537 +fi + +[[ -s "$GVM_HOME/scripts/gvm" ]] && source "$GVM_HOME/scripts/gvm" +if [ ! -f $GVM_HOME/bin/gvm ]; then + echo $'gvm was not installed' +fi +if ! grep -q "export GVM_ROOT=" ~/.bashrc; then + echo "export GVM_ROOT=$GVM_HOME" >> ~/.bashrc +fi + +cd $GVM_HOME/bin + +$GVM_HOME/bin/gvm install go${GO_INTERMEDIATE_VERSION} +if [ ! "\$?" = "0" ]; then + echo $"Unable to install intermediate go version ${GO_INTERMEDIATE_VERSION}" + if [ -f $GVM_HOME/logs/go-go${GO_INTERMEDIATE_VERSION}-compile.log ]; then + cat $GVM_HOME/logs/go-go${GO_INTERMEDIATE_VERSION}-compile.log + fi + exit 352872 +fi + +export GOROOT_BOOTSTRAP=/home/git/gvm/gos/go${GO_INTERMEDIATE_VERSION} + +$GVM_HOME/bin/gvm install go${GO_VERSION} +if [ ! "\$?" = "0" ]; then + echo $"Unable to install go version ${GO_VERSION}" + if [ -f $GVM_HOME/logs/go-go${GO_VERSION}-compile.log ]; then + cat $GVM_HOME/logs/go-go${GO_VERSION}-compile.log + fi + exit 529252 +fi + +chown -R git:git $GVM_HOME + +if [ ! -d $GVM_HOME/bin ]; then + echo $'GVM was not installed' + exit 629532 +fi + +if ! grep -q "GVM_ROOT=" ~/.bashrc; then + echo "export GVM_ROOT=$GVM_HOME" >> ~/.bashrc +else + sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_HOME|g" ~/.bashrc +fi + +cd $GVM_HOME/bin +[[ -s "$GVM_HOME/scripts/gvm" ]] && source "$GVM_HOME/scripts/gvm" +#$GVM_HOME/bin/gvm use go${GO_VERSION} --default +#if [ ! "\$?" = "0" ]; then +# echo $"Unable to use go version ${GO_VERSION}" +# if [ -f $GVM_HOME/logs/go-go${GO_VERSION}-compile.log ]; then +# cat $GVM_HOME/logs/go-go${GO_VERSION}-compile.log +# fi +#fi + +echo "export GOPATH=/home/git/gvm/pkgsets/go${GO_VERSION}/global" >> ~/.bashrc +export GOPATH=/home/git/gvm/pkgsets/go${GO_VERSION}/global +systemctl set-environment GOPATH=\$GOPATH + +exit 0 +EOF + chroot ${rootdir} chmod +x /root/upgrade_golang.sh + chroot ${rootdir} /root/upgrade_golang.sh + if [ ! "$?" = "0" ]; then + echo $'Failed to upgrade golang' + cat ${rootdir}/root/upgrade_golang.sh + rm -f ${rootdir}/root/upgrade_golang.sh + exit 836535 + fi + rm -f ${rootdir}/root/upgrade_golang.sh } function upgrade_golang { - if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then - return - fi + if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then + return + fi - # NOTE: this is annoyingly hacky and going in the opposite - # direction of a pure blend, but it's necessary if you want - # to run the latest version of gogs + # NOTE: this is annoyingly hacky and going in the opposite + # direction of a pure blend, but it's necessary if you want + # to run the latest version of gogs - # update to the next commit - function_check set_repo_commit - set_repo_commit $INSTALL_DIR/gvm "gvm commit" "$GVM_COMMIT" $GVM_REPO + # update to the next commit + function_check set_repo_commit + set_repo_commit $INSTALL_DIR/gvm "gvm commit" "$GVM_COMMIT" $GVM_REPO - if grep -Fxq "upgrade_golang" $COMPLETION_FILE; then - return - fi + if grep -Fxq "upgrade_golang" $COMPLETION_FILE; then + return + fi - export GVM_ROOT=$GVM_HOME + export GVM_ROOT=$GVM_HOME - apt-get -y install curl git mercurial make binutils bison gcc build-essential - if [ ! -d $INSTALL_DIR ]; then - mkdir $INSTALL_DIR - fi - cd $INSTALL_DIR - function_check git_clone - git_clone $GVM_REPO gvm - cd $INSTALL_DIR/gvm - git checkout $GVM_COMMIT -b $GVM_COMMIT - if [ ! -f binscripts/gvm-installer ]; then - echo $'gvm installer not found' - fi - chmod +x binscripts/gvm-installer + apt-get -y install build-essential libc6-dev-i386 gcc-multilib g++-multilib + apt-get -y install gcc curl git mercurial make binutils bison + if [ ! -d $INSTALL_DIR ]; then + mkdir $INSTALL_DIR + fi + cd $INSTALL_DIR + function_check git_clone + git_clone $GVM_REPO gvm + cd $INSTALL_DIR/gvm + git checkout $GVM_COMMIT -b $GVM_COMMIT + if [ ! -f binscripts/gvm-installer ]; then + echo $'gvm installer not found' + fi + chmod +x binscripts/gvm-installer - if [ -d /root/.gvm ]; then - rm -rf /root/.gvm - fi - if [ -d $GVM_ROOT ]; then - rm -rf $GVM_ROOT - fi - sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_ROOT|g" ~/.bashrc + if [ -d /root/.gvm ]; then + rm -rf /root/.gvm + fi + if [ -d $GVM_ROOT ]; then + rm -rf $GVM_ROOT + fi + sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_ROOT|g" ~/.bashrc - if [ ! -d /home/git ]; then - # add a gogs user account within which the gvm home directory will exist - adduser --disabled-login --gecos 'Gogs' git - fi - if [ -d /home/git/Maildir ]; then - rm -rf /home/git/Maildir - fi + if [ ! -d /home/git ]; then + # add a gogs user account within which the gvm home directory will exist + adduser --disabled-login --gecos 'Gogs' git + fi + if [ -d /home/git/Maildir ]; then + rm -rf /home/git/Maildir + fi - # TODO: this script is all over the place - # and contains hardcoded github. See if you can do better - ./binscripts/gvm-installer master /home/git + # TODO: this script is all over the place + # and contains hardcoded github. See if you can do better + ./binscripts/gvm-installer master /home/git - if [ ! -d $GVM_ROOT ]; then - echo $'Unable to install gvm' - exit 83537 - fi + if [ ! -d $GVM_ROOT ]; then + echo $'Unable to install gvm' + exit 83537 + fi - [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" - if [ ! -f $GVM_ROOT/bin/gvm ]; then - echo $'gvm was not installed' - fi - if ! grep -q "export GVM_ROOT=" ~/.bashrc; then - echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc - fi + [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm" + if [ ! -f $GVM_ROOT/bin/gvm ]; then + echo $'gvm was not installed' + fi + if ! grep -q "export GVM_ROOT=" ~/.bashrc; then + echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc + fi - cd $GVM_ROOT/bin - gvm install go1.4 - gvm use go1.4 - export GOROOT_BOOTSTRAP=$GOROOT - gvm install go${GO_VERSION} - if [ ! "$?" = "0" ]; then - echo $'Unable to upgrade golang' - exit 529252 - fi - gvm use go${GO_VERSION} --default + export GOROOT_BOOTSTRAP=$GOROOT - chown -R git:git $GVM_HOME + cd $GVM_ROOT/bin + gvm install go${GO_INTERMEDIATE_VERSION} + gvm use go${GO_INTERMEDIATE_VERSION} + gvm install go${GO_VERSION} + if [ ! "$?" = "0" ]; then + echo $'Unable to upgrade golang' + exit 529252 + fi + gvm use go${GO_VERSION} --default - if ! grep -q "gvm commit" $COMPLETION_FILE; then - echo "gvm commit:$GVM_COMMIT" >> $COMPLETION_FILE - else - sed -i "s/gvm commit.*/gvm commit:$GVM_COMMIT/g" $COMPLETION_FILE - fi + chown -R git:git $GVM_HOME - echo 'upgrade_golang' >> $COMPLETION_FILE + if ! grep -q "gvm commit" $COMPLETION_FILE; then + echo "gvm commit:$GVM_COMMIT" >> $COMPLETION_FILE + else + sed -i "s/gvm commit.*/gvm commit:$GVM_COMMIT/g" $COMPLETION_FILE + fi + + echo 'upgrade_golang' >> $COMPLETION_FILE } # NOTE: deliberately there is no "exit 0" diff --git a/src/zeronetavahi b/src/zeronetavahi index ea345deb..2b36194b 100755 --- a/src/zeronetavahi +++ b/src/zeronetavahi @@ -52,7 +52,8 @@ ZERONET_INDEX=$ZERONET_INSTALL/mesh.html ZERONET_CONFIG=$ZERONET_INSTALL/bootstrap IPFS_PORT=4001 -IPFS_COMMAND=/usr/bin/jsipfs +IPFS_PATH=/usr/bin +IPFS_COMMAND=$IPFS_PATH/ipfs MY_BLOG_STR=$"My Blog" MY_MAIL_STR=$"My Mail" diff --git a/website/EN/homeserver.html b/website/EN/homeserver.html index b6db9999..21565f08 100644 --- a/website/EN/homeserver.html +++ b/website/EN/homeserver.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -256,7 +256,8 @@ First you will need to create an image.
sudo su
-apt-get -y install build-essential git python-docutils mktorrent \
+apt-get -y install build-essential libc6-dev-i386 \
+gcc-multilib g++-multilib git python-docutils mktorrent \
 vmdebootstrap xz-utils dosfstools btrfs-tools extlinux \
 python-distro-info mbr qemu-user-static binfmt-support \
 u-boot-tools qemu
diff --git a/website/EN/mesh.html b/website/EN/mesh.html
index 013c1e04..fec1e011 100644
--- a/website/EN/mesh.html
+++ b/website/EN/mesh.html
@@ -3,7 +3,7 @@
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
 
-
+
 
 
 
@@ -263,7 +263,8 @@ First you will need to create an image.
 
sudo su
-apt-get -y install build-essential git python-docutils mktorrent \
+apt-get -y install build-essential libc6-dev-i386 \
+gcc-multilib g++-multilib git python-docutils mktorrent \
 vmdebootstrap xz-utils dosfstools btrfs-tools extlinux \
 python-distro-info mbr qemu-user-static binfmt-support \
 u-boot-tools qemu