Describe the bug
If prereqs.sh has already been run and CNODE_HOME is defined in the environment then running prereqs.sh again to create an Alternate name for top level folder does not create the directory structure.
Happens only when CNODE_HOME is set/exported as en environment variable.
To Reproduce
Steps to reproduce the behavior:
Follow guild-operators instructions to sync & run ./prereqs.sh
Run ls -l /opt/cardano/ to verify the cnode directory was created.
Run cd ~/tmp ; ./prereqs.sh -s -t testcnode
Run ls -l /opt/cardano/ to verify the testcnode directory was not created.
Run unset CNODE_HOME to clear the environment variable.
Re-run cd ~/tmp ; ./prereqs.sh -s -t testcnode
Run ls -l /opt/cardano/ to verify the testcnode directory was created.
Run cd ~/tmp ; ./prereqs.sh -s -t random
Run ls -l /opt/cardano/ to verify the random directory was created.
Expected behavior
New Alternate names for top level folders are created regardless if the default CNODE_HOME was created or is defined in the local environment.
Version:
OS: CentOS 8
Product version: CNTools 6
Cardano Node version: 1.21.1
Network you're connecting to: N/A - happens before network connections.
Additional Details
If on the subsequent run the user changes the network & opts to override files this will actually overwrite the wrong configuration files in the CNODE_HOME.
For example first run is defaults and creates /opt/cardano/cnode/files from mainnet configurations. When the next run is set to -f -n testnet and CNODE_HOME exists, not only does the new directory not get created, but the /opt/cardano/cnode/files/ are forcefully overwritten by the testnet configuration files. Below is an example showing what happens:
[root@c5fe27251f01 tmp]# ./prereqs.sh
Using yum to prepare packages for "CentOS Linux" system
Updating system packages...
Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
Installing missing prerequisite packages, if any..
Failed to set locale, defaulting to C.UTF-8
Failed to set locale, defaulting to C.UTF-8
Symlink updates not required for ncurse libs, skipping..
Creating Folder Structure ..
Setting up Environment Variable
Downloading files...
[root@c5fe27251f01 tmp]# md5sum /opt/cardano/cnode/files/*
00ec26075874f25fbbbe12d22592cacb /opt/cardano/cnode/files/byron-genesis.json
3c38cdc00409128de71d171e2f99a1ad /opt/cardano/cnode/files/config.json
a84961201e2a985c9220c135003183c5 /opt/cardano/cnode/files/genesis.json
7dcc87e829ace3aa02b73f56be8e5b40 /opt/cardano/cnode/files/topology.json
[root@c5fe27251f01 tmp]# ls -l /opt/cardano/
total 8
drwxr-xr-x. 8 root root 4096 Oct 15 22:45 cnode
[root@c5fe27251f01 tmp]# echo $CNODE_HOME
[root@c5fe27251f01 tmp]# . ~/.bashrc
[root@c5fe27251f01 tmp]# echo $CNODE_HOME
/opt/cardano/cnode
[root@c5fe27251f01 tmp]# /root/tmp/prereqs.sh -f -s -n testnet -t testnet
Creating Folder Structure ..
Setting up Environment Variable
Downloading files...
Forced full upgrade! Please edit scripts/env, scripts/cnode.sh, scripts/gLiveView.sh and scripts/topologyUpdater.sh (alongwith files/topology.json, files/config.json) as required/
[root@c5fe27251f01 tmp]# ls -l /opt/cardano/
total 8
drwxr-xr-x. 8 root root 4096 Oct 15 22:45 cnode
[root@c5fe27251f01 tmp]# md5sum /opt/cardano/cnode/files/*
ed897830d25f69f8b58ce83b3ba77d4c /opt/cardano/cnode/files/byron-genesis.json
0fc5a0e089e9f417e94542cc41c32cab /opt/cardano/cnode/files/config.json
3c38cdc00409128de71d171e2f99a1ad /opt/cardano/cnode/files/config.json_bkp1602802045
e23a9b77c359d6ed64b1f960e57bddc2 /opt/cardano/cnode/files/genesis.json
1c2b13d1c474223f0be0833ab922bbc5 /opt/cardano/cnode/files/topology.json
7dcc87e829ace3aa02b73f56be8e5b40 /opt/cardano/cnode/files/topology.json_bkp1602802045
[root@c5fe27251f01 tmp]#
Describe the bug If prereqs.sh has already been run and CNODE_HOME is defined in the environment then running prereqs.sh again to create an Alternate name for top level folder does not create the directory structure.
Happens only when CNODE_HOME is set/exported as en environment variable.
To Reproduce Steps to reproduce the behavior:
ls -l /opt/cardano/
to verify the cnode directory was created.cd ~/tmp ; ./prereqs.sh -s -t testcnode
ls -l /opt/cardano/
to verify the testcnode directory was not created.unset CNODE_HOME
to clear the environment variable.cd ~/tmp ; ./prereqs.sh -s -t testcnode
ls -l /opt/cardano/
to verify the testcnode directory was created.cd ~/tmp ; ./prereqs.sh -s -t random
ls -l /opt/cardano/
to verify the random directory was created.Expected behavior
Version:
Additional Details If on the subsequent run the user changes the network & opts to override files this will actually overwrite the wrong configuration files in the CNODE_HOME.
For example first run is defaults and creates /opt/cardano/cnode/files from mainnet configurations. When the next run is set to
-f -n testnet
and CNODE_HOME exists, not only does the new directory not get created, but the /opt/cardano/cnode/files/ are forcefully overwritten by the testnet configuration files. Below is an example showing what happens: