aboutsummaryrefslogtreecommitdiff
path: root/ipfs-check-install-setup-init-update
blob: eaa106bb3b5686e7bc9048fe2a5ce94992675f12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
source lib/_ak_log
source lib/_ak_ipfs

if [ ! -d $AK_BINDIR ]; then mkdir $AK_BINDIR ;fi
if [ ! -d $AK_ARCHIVESDIR ]; then mkdir $AK_ARCHIVESDIR ;fi

_ak_ipfs_install(){
    logit "INFO" "Making temp files"
    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
    logit "INFO" "ipfs installed on $AK_BINDIR"
}

which ipfs > /dev/null 2>&1
if [ $? -ne 0 ]; then
    _ak_ipfs_download
    _ak_ipfs_install
    _ak_ipfs init
    _ak_ipfs_swarm_install
else
    logit "INFO" "Found IPFS! Skipping downloading..."
    _ak_ipfs_swarm_install
fi
if [ ! -d $HOME/.ipfs ]; then
    _ak_ipfs init
    _ak_ipfs_swarm_install
fi

if [ ! -f $AK_ZGENESIS ]
then
    ipfs add -Q $AK_GENESIS > $AK_ZGENESIS
fi