2019-06-04 20:56:02 +02:00
|
|
|
#!/bin/bash
|
2018-10-03 19:15:04 +02:00
|
|
|
|
2019-03-25 18:04:31 +01:00
|
|
|
set -o xtrace
|
2019-06-04 20:56:02 +02:00
|
|
|
set -e
|
2019-03-25 18:04:31 +01:00
|
|
|
|
2019-07-08 10:22:48 +02:00
|
|
|
SDK_ARGS=""
|
|
|
|
|
2019-06-04 20:56:02 +02:00
|
|
|
function parse_yaml {
|
|
|
|
local prefix=$2
|
|
|
|
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
|
|
|
|
sed -ne "s|^\($s\):|\1|" \
|
|
|
|
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
|
|
|
|
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
|
|
|
|
awk -F$fs '{
|
|
|
|
indent = length($1)/2;
|
|
|
|
vname[indent] = $2;
|
|
|
|
for (i in vname) {if (i > indent) {delete vname[i]}}
|
|
|
|
if (length($3) > 0) {
|
|
|
|
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
|
|
|
|
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
2018-10-03 19:15:04 +02:00
|
|
|
|
2019-07-08 10:22:48 +02:00
|
|
|
if [ -z ${SDK_CONFIG+x} ]; then
|
2019-06-04 20:56:02 +02:00
|
|
|
CONFIG="/daemon/daemon_settings.yml"
|
2019-01-29 13:01:05 +01:00
|
|
|
else
|
2019-07-08 10:22:48 +02:00
|
|
|
CONFIG=$SDK_CONFIG
|
2019-06-04 20:56:02 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
cat $CONFIG
|
|
|
|
|
|
|
|
eval $(parse_yaml ${CONFIG} "LBRY_")
|
|
|
|
|
|
|
|
if [ ! -d "$LBRY_data_dir" ]; then
|
|
|
|
mkdir $LBRY_data_dir
|
|
|
|
fi
|
|
|
|
if [ ! -d "$LBRY_wallet_dir" ]; then
|
|
|
|
mkdir $LBRY_wallet_dir
|
2019-01-29 13:01:05 +01:00
|
|
|
fi
|
2019-06-04 20:56:02 +02:00
|
|
|
if [ ! -d "$LBRY_download_dir" ]; then
|
|
|
|
mkdir $LBRY_download_dir
|
|
|
|
fi
|
|
|
|
|
2019-07-08 10:22:48 +02:00
|
|
|
if [ ! -z ${SDK_LBRYUM_SERVERS+x} ]; then
|
|
|
|
SDK_ARGS="${SDK_ARGS} --lbryum-servers=${SDK_LBRYUM_SERVERS}"
|
|
|
|
fi
|
|
|
|
|
2021-09-29 09:42:31 +02:00
|
|
|
rm -rf /storage/lbrynet/lbrynet.sqlite*
|
2019-07-08 10:22:48 +02:00
|
|
|
./lbrynet start --config=$CONFIG $SDK_ARGS
|