| if [ "$rootfolder" == "2" ]; then | if [ "$rootfolder" == "2" ]; then | ||||
| ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE | ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE | ||||
| else | else | ||||
| ROOT=$(pwd) # Default to current directory if user chooses 1 | |||||
| echo $pwd | |||||
| ROOT=./chess/production_A | |||||
| fi | fi | ||||
| mkdir -p $ROOT | mkdir -p $ROOT | ||||
| cd $ROOT | |||||
| ROOT=$(realpath $ROOT) | |||||
| sudo chown -R $USER:$USER $ROOT | |||||
| # If ROOT is not the current directory, create the necessary directories and change to ROOT | |||||
| # if [ "$ROOT" != "$(pwd)" ]; then | |||||
| # sudo chown $USER:$USER $ROOT | |||||
| # fi | |||||
| # Change to ROOT directory | |||||
| cd $ROOT || { echo "Failed to change to ROOT directory $ROOT"; exit 1; } | |||||
| echo $PWD | |||||
| wget -q -O - http://git.bbh/chess/elxr/raw/branch/master/centosinit.sh > $ROOT/centosinit.sh | wget -q -O - http://git.bbh/chess/elxr/raw/branch/master/centosinit.sh > $ROOT/centosinit.sh | ||||
| sudo chmod u+x $ROOT/centosinit.sh | sudo chmod u+x $ROOT/centosinit.sh | ||||
| sh $ROOT/centosinit.sh | sh $ROOT/centosinit.sh | ||||
| # If ROOT is not the current directory, create the necessary directories and change to ROOT | |||||
| if [ "$ROOT" != "$(pwd)" ]; then | |||||
| sudo mkdir -p /var/chess | |||||
| sudo chown $USER:$USER /var/chess | |||||
| mkdir -p /var/chess/$INSTANCENAME | |||||
| sudo chown $USER:$USER /var/chess/$INSTANCENAME | |||||
| mkdir -p $ROOT | |||||
| sudo chown $USER:$USER $ROOT | |||||
| # Change to ROOT directory | |||||
| cd $ROOT || { echo "Failed to change to ROOT directory $ROOT"; exit 1; } | |||||
| fi | |||||
| # Platform-specific installation | # Platform-specific installation | ||||
| if [ -f /etc/os-release ]; then | if [ -f /etc/os-release ]; then | ||||
| . /etc/os-release | . /etc/os-release | ||||
| # Install npm dependencies and link | # Install npm dependencies and link | ||||
| cd elxr | cd elxr | ||||
| npm i | npm i | ||||
| npm link | |||||
| npm link --force | |||||
| cd .. | cd .. | ||||
| sudo ln -s $ROOT/elxr/bin/elxr $(npm bin -g)/elxr | sudo ln -s $ROOT/elxr/bin/elxr $(npm bin -g)/elxr | ||||
| # ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'cihsr'; | # ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'cihsr'; | ||||
| # FLUSH PRIVILEGES; | # FLUSH PRIVILEGES; | ||||
| mysql -u root -p cihsr < cihsr_prod.sql | |||||
| # mysql -u root -p cihsr < cihsr_prod.sql |