aboutsummaryrefslogtreecommitdiff
path: root/ipfs-check-install-setup-init-update
blob: 3121be7268eaef98e08d01e4c2032e895434d96d (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
41
42
#!/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(){
    _ak_log_info "Making temp files"
    pwd > pwd
    mktemp -d > 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
    _ak_log_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
    _ak_log_info "Found IPFS! Skipping downloading..."
    _ak_ipfs_swarm_install
fi
if [ ! -d $AK_IPFS_REPO ]
then
    _ak_ipfs init
    _ak_ipfs_swarm_install
fi

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