aboutsummaryrefslogtreecommitdiff
path: root/ipfs-check-install-setup-init-update
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-04-05 14:28:24 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-04-05 14:28:24 +0300
commit29b0d694517e610f98880844aeebe8eb12b0033a (patch)
treefe1885ff5a8c424b72330124e4905f0ddf14cfa4 /ipfs-check-install-setup-init-update
parent0fd522a6e324de08a99bdd42ead193acff6f3d15 (diff)
downloadarching-kaos-tools-29b0d694517e610f98880844aeebe8eb12b0033a.tar.gz
arching-kaos-tools-29b0d694517e610f98880844aeebe8eb12b0033a.tar.bz2
arching-kaos-tools-29b0d694517e610f98880844aeebe8eb12b0033a.zip
might fix ipfs installation
Diffstat (limited to 'ipfs-check-install-setup-init-update')
-rwxr-xr-xipfs-check-install-setup-init-update63
1 files changed, 15 insertions, 48 deletions
diff --git a/ipfs-check-install-setup-init-update b/ipfs-check-install-setup-init-update
index c20a0f2..663b009 100755
--- a/ipfs-check-install-setup-init-update
+++ b/ipfs-check-install-setup-init-update
@@ -1,23 +1,12 @@
#!/bin/bash
+source lib/_ak_ipfs
+source lib/_ak_log
+
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)"
-
- IPFS_TARGET_FILE="kubo_"$IPFS_VERSION"_linux-amd64.tar.gz"
-
- logthis "[INFO]" "Downloading ipfs $IPFS_VERSION"
- 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"
+_ak_ipfs_install(){
+ logit "INFO" "Making temp files"
pwd > pwd
mktemp > tempassin
ak_curdir=$(cat pwd)
@@ -27,44 +16,22 @@ install(){
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
- $AK_BINDIR/ipfs init
- fi
-}
-
-swarm_install() {
- # Setting the SHA512SUM for our swarm
- SWARMSHA512SUM="7001e37412758c43d372a969e977ca11511e034c8c1e233a58dc3ce1c6f3c1aa7d2da8cba9944a5eabaa8885742bfe6cc6794224c146b7129da8f633b53b9cfc"
-
- if [ ! -f $HOME/.ipfs/swarm.key ]
- then
- logthis "[INFO]" "Downloading swarm key"
- wget -O $HOME/.ipfs/swarm.key https://arching-kaos.net/files/swarm.key
- elif [ -f $HOME/.ipfs/swarm.key ] && [ "$(sha512sum $HOME/.ipfs/swarm.key | awk '{ print $1 }')" == "$SWARMSHA512SUM" ]
- then
- logthis "[INFO]" "Congrats! You are already in our swarm"
- else
- logthis "[ERROR]" "Found swarm.key but not ours"
- logthis "[ERROR]" "Visit https://arching-kaos.net/files/swarm.key and copy it to your ipfs folder"
- fi
+ logit "INFO" "ipfs installed on $AK_BINDIR"
}
which ipfs > /dev/null 2>&1
-if [ $? != 0 ]; then
- install
- ipfs init
- swarm_install
+if [ $? -ne 0 ]; then
+ _ak_ipfs_download
+ _ak_ipfs_install
+ _ak_ipfs init
+ _ak_ipfs_swarm_install
else
- logthis "[INFO]" "Found IPFS! Skipping downloading..."
- swarm_install
+ logit "INFO" "Found IPFS! Skipping downloading..."
+ _ak_ipfs_swarm_install
fi
if [ ! -d $HOME/.ipfs ]; then
- ipfs init
- swarm_install
+ _ak_ipfs init
+ _ak_ipfs_swarm_install
fi
if [ ! -f $AK_ZGENESIS ]