-
Notifications
You must be signed in to change notification settings - Fork 0
/
genacs
executable file
·66 lines (55 loc) · 1.65 KB
/
genacs
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
numchains=$1
chainname=$2
numcoins=$3
if [ -z ${1+x} ] || [ -z ${2+x} ] || [ -z ${3+x} ]
then
echo
echo "Usage: ./genacs <numchains> <chainname> <supply>"
echo "Example: ./genacs 10 TXTEST 1000000"
echo
exit
fi
startdir=$PWD
manychainsout=manychains
ufwenablefile=acufwenable
ufwdisablefile=acufwdisable
coinlistfile=coinlist
acfile=startacs
genfile=startacsgen
seedipfile=seedip
cd ~/komodo/src
git pull
gcc -o manychains komodo_port.c
./manychains -gen $numchains $chainname $numcoins > $startdir/$manychainsout
cd $startdir
echo "coinlist=(" > $coinlistfile
echo "#!/bin/bash" > $acfile
echo "cd ~/komodo/src" >> $acfile
echo "#!/bin/bash" > $genfile
echo "cd ~/komodo/src" >> $genfile
while read komodo acname acsupply acend acreward achalving acdecay amp pound portlabel port
do
acnameonly=$(echo $acname | sed 's/-ac_name=//')
acsupplyonly=$(echo $acsupply | sed 's/-ac_supply=//')
let "p2pport = $port - 1"
echo "'$acnameonly $acsupplyonly'" >> $coinlistfile
echo "sudo ufw allow $p2pport comment '$acnameonly'" >> $ufwenablefile
echo "sudo ufw delete allow $p2pport" >> $ufwdisablefile
#echo "$komodo $acname $acsupply &" >> $acfile
#echo "$komodo -gen -genproclimit=1 $acname $acsupply &" >> $genfile
done < "$manychainsout"
echo ")" >> $coinlistfile
myip=`curl -s4 checkip.amazonaws.com`
echo "seed_ip=$myip" > $seedipfile
rm $manychainsout
#chmod +x $acfile
#chmod +x $genfile
chmod +x $ufwenablefile
chmod +x $ufwdisablefile
if [ -f $ufwenablefile ] && [ -f $ufwdisablefile ] && [ -f $seedipfile ] && [ -f $coinlistfile ]
then
echo "Success!"
else
echo "One or more files failed to generate"
fi