Skip to content

Commit a0d9fd2

Browse files
committed
add --print-env to install.sh
1 parent 9e6952f commit a0d9fd2

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

scripts/install.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ def run_install(answers: dict):
211211
args += f' -c {config}'
212212

213213
if archive_ttl:
214-
os.environ['ARCHIVE_TTL'] = archive_ttl # set env variable
214+
CONFIG['ARCHIVE_TTL'] = archive_ttl # set env variable
215215
if state_ttl:
216-
os.environ['STATE_TTL'] = state_ttl
216+
CONFIG['STATE_TTL'] = state_ttl
217217
if add_shard:
218-
os.environ['ADD_SHARD'] = add_shard
218+
CONFIG['ADD_SHARD'] = add_shard
219219
if collate_shard:
220-
os.environ['COLLATE_SHARD'] = collate_shard
220+
CONFIG['COLLATE_SHARD'] = collate_shard
221221
if archive_blocks:
222-
os.environ['ARCHIVE_BLOCKS'] = archive_blocks
222+
CONFIG['ARCHIVE_BLOCKS'] = archive_blocks
223223
command += ['-v', 'master']
224224

225225
if validator_mode and validator_mode not in ('Skip', 'Validator wallet'):
@@ -239,7 +239,7 @@ def run_install(answers: dict):
239239
log = None
240240
stdin = None
241241
if background:
242-
os.environ['PYTHONUNBUFFERED'] = '1'
242+
CONFIG['PYTHONUNBUFFERED'] = '1'
243243
log = open("mytonctrl_installation.log", "a")
244244
stdin=subprocess.DEVNULL
245245
command = ['nohup'] + command
@@ -249,6 +249,19 @@ def run_install(answers: dict):
249249

250250
print(command)
251251

252+
if os.getenv('PRINT_ENV'):
253+
print('command:')
254+
print(' '.join(command))
255+
print('envs:')
256+
for k, v in CONFIG.items():
257+
if ' ' in v:
258+
v = f'"{v}"'
259+
print(f'{k}={v}')
260+
sys.exit(0)
261+
262+
for k, v in CONFIG.items():
263+
os.environ[k] = v
264+
252265
process = subprocess.Popen(
253266
command,
254267
stdout=log,
@@ -261,6 +274,9 @@ def run_install(answers: dict):
261274
print("="*100 + f"\nRunning installation in the background. Check './mytonctrl_installation.log' for progress. PID: {process.pid}\n" + "="*100)
262275

263276

277+
CONFIG = {}
278+
279+
264280
def main():
265281
try:
266282
answers = run_cli()

scripts/install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ show_help_and_exit() {
2424
echo 'Supported arguments:'
2525
echo ' -c, --config URL Provide custom network config'
2626
echo ' -e, --env-file PATH Provide env file with installation parameters'
27+
echo ' --print-env Print result command and envs after interactive installer without installing MyTonCtrl'
2728
echo ' -t, --telemetry Disable telemetry'
2829
echo ' -i, --ignore-reqs Ignore minimum requirements'
29-
echo ' -d, --dump Use pre-packaged dump. Reduces duration of initial synchronization.'
30+
echo ' -d, --dump Use pre-packaged dump. Reduces duration of initial synchronization'
3031
echo ' -a, --author Set MyTonCtrl git repo author'
3132
echo ' -r, --repo Set MyTonCtrl git repo name'
3233
echo ' -b, --branch Set MyTonCtrl git repo branch'
33-
echo ' -m, --mode MODE Install MyTonCtrl with specified mode (validator or liteserver)'
34+
echo ' -m, --mode MODE Install MyTonCtrl with specified mode (validator or liteserver). Leave empty to launch interactive installer'
3435
echo ' -n, --network NETWORK Specify the network (mainnet or testnet)'
3536
echo ' -g, --node-repo URL TON node git repo URL (default: https://github.com/ton-blockchain/ton.git)'
3637
echo ' -v, --node-version VERSION Specify the TON node version (commit, branch, or tag)'
@@ -77,6 +78,7 @@ while (($#)); do
7778
--help) newargv+=(-h) ;;
7879
--telemetry) newargv+=(-t) ;;
7980
--ignore-reqs) newargv+=(-i) ;;
81+
--print-env) export PRINT_ENV=true ;;
8082

8183
# with arg
8284
--config|--author|--repo|--branch|--mode|--network|--node-repo|--backup|--user|--node-version|--env-file)

0 commit comments

Comments
 (0)