diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2023-05-04 04:03:35 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2023-05-04 04:03:35 +0300 |
commit | cc2711769f8d90451c53e52ed68fb37cebbab7d6 (patch) | |
tree | d3f49f86b1b50067279affa7f68ae7d88e8f3327 /ipfs-check-install-setup-init-update | |
parent | 83680bafd73a3d4c2842902c12d0d15a030d849c (diff) | |
download | arching-kaos-tools-cc2711769f8d90451c53e52ed68fb37cebbab7d6.tar.gz arching-kaos-tools-cc2711769f8d90451c53e52ed68fb37cebbab7d6.tar.bz2 arching-kaos-tools-cc2711769f8d90451c53e52ed68fb37cebbab7d6.zip |
Updated ipfs script
Diffstat (limited to 'ipfs-check-install-setup-init-update')
-rwxr-xr-x | ipfs-check-install-setup-init-update | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/ipfs-check-install-setup-init-update b/ipfs-check-install-setup-init-update index 13f2961..ad21c6c 100755 --- a/ipfs-check-install-setup-init-update +++ b/ipfs-check-install-setup-init-update @@ -1,41 +1,43 @@ #!/bin/bash +if [[ ! -d $AK_BINDIR ]]; then mkdir $AK_BINDIR ;fi +if [[ ! -d $AK_ARCHIVESDIR ]]; then mkdir $AK_ARCHIVESDIR ;fi logthis(){ echo "$(date -u +%s) $1 $2" >> $AK_WORKDIR/logs } + install(){ logthis "[INFO]" "Attempting to install IPFS..." IPFS_VERSION="$(curl -s https://dist.ipfs.tech/kubo/versions | tail -1)" + + # Setting the SHA512SUM for our swarm SWARMSHA512SUM="7001e37412758c43d372a969e977ca11511e034c8c1e233a58dc3ce1c6f3c1aa7d2da8cba9944a5eabaa8885742bfe6cc6794224c146b7129da8f633b53b9cfc" + IPFS_TARGET_FILE="kubo_"$IPFS_VERSION"_linux-amd64.tar.gz" - AKBIN="$AK_WORKDIR/bin" - mkdir $AKBIN - AKAR="$AK_ARCHIVESDIR" - if [ ! -d $AKAR ]; then - mkdir $AKAR - if [ $? != 0 ]; then - logthis "[ERROR]" "Problem creating directory" - exit 1; - fi - fi + logthis "[INFO]" "Downloading ipfs $IPFS_VERSION" - if [ ! -f $AKAR/$IPFS_TARGET_FILE ]; then - wget -O $AKAR/$IPFS_TARGET_FILE https://dist.ipfs.tech/kubo/$IPFS_VERSION/$IPFS_TARGET_FILE ; + if [ ! -f $AK_ARCHIVESDIR/$IPFS_TARGET_FILE ]; then + wget -O $AK_ARCHIVESDIR/$IPFS_TARGET_FILE https://dist.ipfs.tech/kubo/$IPFS_VERSION/$IPFS_TARGET_FILE ; fi + logthis "[INFO]" "Making temp files" - TIMESTAMP="$(date -u +%s)" - TEMPASSIN="/tmp/aktmp_$TIMESTAMP" - if [ ! -d $TEMPASSIN ]; then - mkdir $TEMPASSIN - cd $TEMPASSIN - tar xf $AKAR/$IPFS_TARGET_FILE - cp kubo/ipfs $AKBIN/ipfs - fi - logthis "[INFO]" "ipfs installed on $AKBIN" + pwd > pwd + mktemp > tempassin + ak_curdir=$(cat pwd) + TEMPASSIN=$(cat tempassin) + cd $TEMPASSIN + tar xf $AK_ARCHIVESDIR/$IPFS_TARGET_FILE + cp kubo/ipfs $AK_BINDIR/ipfs + cd $ak_curdir + rm -rf $TEMPASSIN + logthis "[INFO]" "ipfs installed on $AK_BINDIR" + if [ ! -d $HOME/.ipfs ]; then mkdir $HOME/.ipfs - $AKBIN/ipfs init ; + $AK_BINDIR/ipfs init ; fi + ipfs add -Q $AK_GENESIS > $AK_ZGENESIS } + swarm_install() { if [ ! -f $HOME/.ipfs/swarm.key ]; then logthis "[INFO]" "Downloading swarm key" @@ -47,10 +49,12 @@ swarm_install() { logthis "[ERROR]" "Visit https\:\/\/arching-kaos.net\/files\/swarm.key and copy it to your ipfs folder" ; fi } + which ipfs > /dev/null 2>&1 if [ $? != 0 ]; then install ipfs init + swarm_install else logthis "[INFO]" "Found IPFS! Skipping downloading..." swarm_install |