[mswin]: Bitcoin .cookie filename fix

[opt/cfg]: Add --bitcoin-data-dir option
This commit is contained in:
The MMGen Project 2016-12-03 20:14:04 +03:00
commit 0b3a40bd29
Signed by: mmgen
GPG key ID: 62DBE9E5212F05BE
5 changed files with 23 additions and 17 deletions

View file

@ -29,6 +29,9 @@
# Uncomment to override 'rpcpassword' in bitcoin.conf
# rpc_password mypassword
# Uncomment to set the Bitcoin datadir
# bitcoin_data_dir /path/to/datadir
# Set the default hash preset:
# hash_preset 3

View file

@ -90,8 +90,10 @@ class g(object):
else os.path.join(home_dir,'.bitcoin')
# User opt sets global var:
common_opts = ('color','no_license','rpc_host','rpc_port','testnet','rpc_user','rpc_password')
common_opts = (
'color','no_license','rpc_host','rpc_port','testnet','rpc_user','rpc_password',
'bitcoin_data_dir'
)
required_opts = (
'quiet','verbose','debug','outdir','echo_passphrase','passwd_file','stdout',
'show_hash_presets','label','keep_passphrase','keep_hash_preset',
@ -102,11 +104,12 @@ class g(object):
('label','keep_label'),
('tx_id','info'),
('tx_id','terse_info'),
('batch','rescan'),
('batch','rescan')
)
cfg_file_opts = (
'color','debug','hash_preset','http_timeout','no_license','rpc_host','rpc_port',
'quiet','tx_fee','tx_fee_adj','usr_randchars','testnet','rpc_user','rpc_password'
'quiet','tx_fee','tx_fee_adj','usr_randchars','testnet','rpc_user','rpc_password',
'bitcoin_data_dir'
)
env_opts = (
'MMGEN_BOGUS_WALLET_DATA',

View file

@ -67,16 +67,17 @@ def _show_hash_presets():
# most, but not all, of these set the corresponding global var
common_opts_data = """
--, --color=c Set to '0' to disable color output, '1' to enable
--, --data-dir=d Specify the location of {pnm}'s data directory
--, --no-license Suppress the GPL license prompt
--, --rpc-host=h Communicate with bitcoind running on host 'h'
--, --rpc-port=p Communicate with bitcoind listening on port 'p'
--, --rpc-user=u Override 'rpcuser' in bitcoin.conf
--, --rpc-password=p Override 'rpcpassword' in bitcoin.conf
--, --testnet=1 Set to '1' enable testnet, '0' to disable
--, --skip-cfg-file Skip reading the configuration file
--, --version Print version information and exit
--, --color=0|1 Disable or enable color output
--, --bitcoin-data-dir=d Specify Bitcoin data directory location 'd'
--, --data-dir=d Specify {pnm} data directory location 'd'
--, --no-license Suppress the GPL license prompt
--, --rpc-host=h Communicate with bitcoind running on host 'h'
--, --rpc-port=p Communicate with bitcoind listening on port 'p'
--, --rpc-user=user Override 'rpcuser' in bitcoin.conf
--, --rpc-password=pass Override 'rpcpassword' in bitcoin.conf
--, --testnet=0|1 Disable or enable testnet
--, --skip-cfg-file Skip reading the configuration file
--, --version Print version information and exit
""".format(pnm=g.proj_name)
def opt_preproc_debug(short_opts,long_opts,skipped_opts,uopts,args):

View file

@ -704,8 +704,7 @@ def get_bitcoind_cfg_options(cfg_keys):
def get_bitcoind_auth_cookie():
f = os.path.join(g.bitcoin_data_dir,('',g.testnet_name)[g.testnet],
('.','_')[g.platform=='win']+'cookie')
f = os.path.join(g.bitcoin_data_dir,('',g.testnet_name)[g.testnet],'.cookie')
if file_is_readable(f):
return get_lines_from_file(f,'')[0]

View file

@ -2,7 +2,7 @@
CMD='rm -rf /usr/local/share/mmgen /usr/local/bin/mmgen-* /usr/local/lib/python2.7/dist-packages/mmgen*'
if [ "$EUID" = 0 ]; then
if [ "$EUID" = 0 -o "$HOMEPATH" ]; then
set -x; $CMD
else
set -x; sudo $CMD