mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 15:10:38 +01:00
try fix call hsmtool
This commit is contained in:
parent
38ab24b144
commit
dfeaa4469b
1 changed files with 42 additions and 35 deletions
|
@ -141,44 +141,51 @@ function decryptHSMsecret() {
|
||||||
# Options #
|
# Options #
|
||||||
###########
|
###########
|
||||||
if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ]; then
|
if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ]; then
|
||||||
if ! sudo ls $hsmSecretPath 2>1 1>/dev/null; then
|
|
||||||
|
# check/delete existing wallet
|
||||||
|
if [ "$1" = "new-force" ]; then
|
||||||
|
echo "# deleting any old wallet ..."
|
||||||
|
sudo rm $hsmSecretPath
|
||||||
|
else
|
||||||
|
if sudo ls $hsmSecretPath 2>1 1>/dev/null; then
|
||||||
|
echo "# The hsm_secret is already present at $hsmSecretPath."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# check for https://github.com/trezor/python-mnemonic
|
# check for https://github.com/trezor/python-mnemonic
|
||||||
if [ $(pip list | grep -c mnemonic) -eq 0 ];then
|
if [ $(pip list | grep -c mnemonic) -eq 0 ];then
|
||||||
pip install mnemonic==0.19 1>/dev/null
|
pip install mnemonic==0.19 1>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "new" ]; then
|
if [ "$1" = "new" ]; then
|
||||||
seedPassword="$3"
|
seedPassword="$3"
|
||||||
# get 24 words
|
# get 24 words
|
||||||
source <(python /home/admin/config.scripts/blitz.mnemonic.py)
|
source <(python /home/admin/config.scripts/blitz.mnemonic.py)
|
||||||
#TODO seedWords to cln.backup.sh seed-export-gui
|
#TODO seedwords to cln.backup.sh seed-export-gui
|
||||||
/home/admin/config.scripts/cln.backup.sh seed-export-gui $seedWords6x4
|
/home/admin/config.scripts/cln.backup.sh seed-export-gui "${seedwords6x4}"
|
||||||
elif [ "$1" = "new-force" ]; then
|
elif [ "$1" = "new-force" ]; then
|
||||||
# get 24 words
|
# get 24 words
|
||||||
source <(python /home/admin/config.scripts/blitz.mnemonic.py)
|
source <(python /home/admin/config.scripts/blitz.mnemonic.py)
|
||||||
echo "seedwords='${seedwords}'"
|
echo "seedwords='${seedwords}'"
|
||||||
echo "seedwords6x4='${seedwords6x4}'"
|
echo "seedwords6x4='${seedwords6x4}'"
|
||||||
elif [ "$1" = "seed" ]; then
|
elif [ "$1" = "seed" ]; then
|
||||||
#TODO get seedWords from cln.backup.sh seed-import-gui [$RESULTFILE]
|
#TODO get seedwords from cln.backup.sh seed-import-gui [$RESULTFILE]
|
||||||
seedWords="$3"
|
seedwords="$3"
|
||||||
seedPassword="$4"
|
seedpassword="$4"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# (echo "0"; echo "purpose lyrics clutch girl weird elbow hover large protect hover level guess damage advance glory warrior wear zone crash room drastic judge hurry enough"; echo) | sudo -u bitcoin /home/bitcoin/lightning/tools/hsmtool "generatehsm" /home/bitcoin/.lightning/bitcoin/hsm_secret
|
||||||
|
|
||||||
# pass to 'hsmtool generatehsm hsm_secret'
|
# pass to 'hsmtool generatehsm hsm_secret'
|
||||||
if [ ${#seedPassword} -eq 0 ]; then
|
if [ ${#seedpassword} -eq 0 ]; then
|
||||||
(echo "0"; echo "$seedWords"; echo) | \
|
(echo "0"; echo "${seedwords}"; echo) | sudo -u bitcoin /home/bitcoin/lightning/tools/hsmtool "generatehsm" $hsmSecretPath
|
||||||
sudo -u bitcoin /home/bitcoin/lightning/tools/hsmtool "generatehsm" \
|
|
||||||
$hsmSecretPath
|
|
||||||
else
|
else
|
||||||
# pass to 'hsmtool generatehsm hsm_secret' - confirm seedPassword
|
# pass to 'hsmtool generatehsm hsm_secret' - confirm seedPassword
|
||||||
(echo "0";echo "$seedWords";echo "$seedPassword";echo "$seedPassword")|\
|
(echo "0";echo "$seedwords";echo "$seedpassword";echo "$seedpassword")|\
|
||||||
sudo -u bitcoin /home/bitcoin/lightning/tools/hsmtool "generatehsm" \
|
sudo -u bitcoin /home/bitcoin/lightning/tools/hsmtool "generatehsm" $hsmSecretPath
|
||||||
$hsmSecretPath
|
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
else
|
|
||||||
echo "# The hsm_secret is already present at $hsmSecretPath."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "$1" = "unlock" ]; then
|
elif [ "$1" = "unlock" ]; then
|
||||||
# getpassword
|
# getpassword
|
||||||
|
|
Loading…
Add table
Reference in a new issue