aboutsummaryrefslogtreecommitdiff
path: root/lib/_ak_ipfs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_ak_ipfs')
-rwxr-xr-xlib/_ak_ipfs74
1 files changed, 52 insertions, 22 deletions
diff --git a/lib/_ak_ipfs b/lib/_ak_ipfs
index 3437083..5c47f91 100755
--- a/lib/_ak_ipfs
+++ b/lib/_ak_ipfs
@@ -265,7 +265,7 @@ _ak_ipfs_name_publish(){
_ak_log_error "No argument given"
exit 1
fi
- _ak_ipfs name publish "$1" "$2"
+ _ak_ipfs name publish --key="$1" "$2"
if [ $? -ne 0 ]
then
_ak_log_error "Failed to get $1"
@@ -273,6 +273,16 @@ _ak_ipfs_name_publish(){
fi
}
+_ak_ipfs_config_publish(){
+ if [ -z $1 ] || [ ! -n "$1" ]
+ then
+ _ak_log_error "No argument given"
+ exit 1
+ fi
+ _ak_ipfs_check_config_key
+ _ak_ipfs_name_publish "ak-config" $1
+}
+
_ak_ipfs_name_resolve(){
if [ -z $1 ] || [ ! -n "$1" ]
then
@@ -321,21 +331,24 @@ _ak_ipns_resolve(){
fi
}
-_ak_ipfs_check(){
- _ak_ipfs_files_ls /zarchive > /dev/null
- if [ $? -ne 0 ]
- then
- _ak_log_error "/zarchive is missing"
- else
- _ak_log_info "/zarchive OK"
- fi
- _ak_ipfs_files_ls /zlatest > /dev/null
+_ak_ipfs_check_config_key(){
+ _ak_ipfs_key_list | grep ak-config > /dev/null
if [ $? -ne 0 ]
then
- _ak_log_error "/zlatest is missing"
+ _ak_log_warning "ak-config key is missing"
+ _ak_ipfs_key_gen ak-config
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "ak-config fails to create"
+ else
+ _ak_log_info "ak-config created"
+ fi
else
- _ak_log_info "/zlatest is OK"
+ _ak_log_info "ak-config is there"
fi
+}
+
+_ak_ipfs_check_zchain_key(){
_ak_ipfs_key_list | grep zchain > /dev/null
if [ $? -ne 0 ]
then
@@ -350,22 +363,35 @@ _ak_ipfs_check(){
else
_ak_log_info "zchain is there"
fi
- _ak_ipfs_key_list | grep ak-config > /dev/null
+}
+
+_ak_ipfs_check_zarchive_dir(){
+ _ak_ipfs_files_ls /zarchive > /dev/null
if [ $? -ne 0 ]
then
- _ak_log_warning "ak-config key is missing"
- _ak_ipfs_key_gen ak-config
- if [ $? -ne 0 ]
- then
- _ak_log_error "ak-config fails to create"
- else
- _ak_log_info "ak-config created"
- fi
+ _ak_log_error "/zarchive is missing"
else
- _ak_log_info "ak-config is there"
+ _ak_log_info "/zarchive OK"
fi
}
+_ak_ipfs_check_zlatest_file(){
+ _ak_ipfs_files_ls /zlatest > /dev/null
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "/zlatest is missing"
+ else
+ _ak_log_info "/zlatest is OK"
+ fi
+}
+
+_ak_ipfs_check(){
+ _ak_ipfs_check_zarchive_dir
+ _ak_ipfs_check_zlatest_file
+ _ak_ipfs_check_config_key
+ _ak_ipfs_check_zchain_key
+}
+
_ak_ipfs_init(){
if [ ! -d $AK_IPFS_REPO ]
then
@@ -429,3 +455,7 @@ _ak_ipfs_swarm_install() {
_ak_log_error "Visit https://arching-kaos.net/files/swarm.key and copy it to your ipfs folder"
fi
}
+
+_ak_ipfs_get_config_ipns_key(){
+ _ak_ipfs_key_list_full | grep 'ak-config' | cut -d ' ' -f 1
+}