Move back to go implementation of ipfs
This commit is contained in:
parent
28d3640c6d
commit
5ec40daaf3
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -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 <<EOF > ${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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
@ -49,12 +53,132 @@ function select_go_version {
|
|||
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 [ ${#GOPATH} -lt 2 ]; then
|
||||
echo $'GOPATH was not set'
|
||||
exit 629825
|
||||
fi
|
||||
|
||||
systemctl set-environment GOPATH=$GOPATH
|
||||
}
|
||||
|
||||
function mesh_upgrade_golang {
|
||||
cat <<EOF > ${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 {
|
||||
|
@ -76,7 +200,8 @@ function upgrade_golang {
|
|||
|
||||
export GVM_ROOT=$GVM_HOME
|
||||
|
||||
apt-get -y install curl git mercurial make binutils bison gcc build-essential
|
||||
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
|
||||
|
@ -123,10 +248,11 @@ function upgrade_golang {
|
|||
echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc
|
||||
fi
|
||||
|
||||
cd $GVM_ROOT/bin
|
||||
gvm install go1.4
|
||||
gvm use go1.4
|
||||
export GOROOT_BOOTSTRAP=$GOROOT
|
||||
|
||||
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'
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<!-- 2016-08-09 Tue 19:25 -->
|
||||
<!-- 2016-08-14 Sun 13:17 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title></title>
|
||||
|
@ -256,7 +256,8 @@ First you will need to create an image.
|
|||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-bash">sudo su
|
||||
apt-get -y install build-essential git python-docutils mktorrent <span class="org-sh-escaped-newline">\</span>
|
||||
apt-get -y install build-essential libc6-dev-i386 <span class="org-sh-escaped-newline">\</span>
|
||||
gcc-multilib g++-multilib git python-docutils mktorrent <span class="org-sh-escaped-newline">\</span>
|
||||
vmdebootstrap xz-utils dosfstools btrfs-tools extlinux <span class="org-sh-escaped-newline">\</span>
|
||||
python-distro-info mbr qemu-user-static binfmt-support <span class="org-sh-escaped-newline">\</span>
|
||||
u-boot-tools qemu
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<!-- 2016-08-09 Tue 19:41 -->
|
||||
<!-- 2016-08-14 Sun 13:19 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title></title>
|
||||
|
@ -263,7 +263,8 @@ First you will need to create an image.
|
|||
<div class="org-src-container">
|
||||
|
||||
<pre class="src src-bash">sudo su
|
||||
apt-get -y install build-essential git python-docutils mktorrent <span class="org-sh-escaped-newline">\</span>
|
||||
apt-get -y install build-essential libc6-dev-i386 <span class="org-sh-escaped-newline">\</span>
|
||||
gcc-multilib g++-multilib git python-docutils mktorrent <span class="org-sh-escaped-newline">\</span>
|
||||
vmdebootstrap xz-utils dosfstools btrfs-tools extlinux <span class="org-sh-escaped-newline">\</span>
|
||||
python-distro-info mbr qemu-user-static binfmt-support <span class="org-sh-escaped-newline">\</span>
|
||||
u-boot-tools qemu
|
||||
|
|
Loading…
Reference in New Issue