Skip to content

Commit

Permalink
fix: add addkey.sh for setting nodekey
Browse files Browse the repository at this point in the history
  • Loading branch information
wormholeslab committed Jul 28, 2023
1 parent ace1d00 commit bcbe0f1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions addkey.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
cd
erbhome=".erbie/erbie"

#read -p "Enter your private key or press 'ENTER' for none:" ky
echo -e "Enter your private key or press 'ENTER' for none: \c"
while : ;do
char=`
stty cbreak -echo
dd if=/dev/tty bs=1 count=1 2>/dev/null
stty -cbreak echo
`
if [ "$char" = "" ];then
echo
break
fi
PASS="$PASS$char"
echo -n "*"
done
if [ -n "$PASS" ]; then
mkdir -p $erbhome
if [ ${#PASS} -eq 64 ];then

echo "$PASS" > $erbhome/nodekey
elif [ ${#PASS} -eq 66 ] && ([ ${PASS:0:2} == "0x" ] || [ ${PASS:0:2} == "0X" ]);then
echo ${PASS:2:64} > $erbhome/nodekey
else
echo "the nodekey format is not correct"
exit 1
fi
fi

0 comments on commit bcbe0f1

Please sign in to comment.