Skip to content

Commit

Permalink
modified: initialization.sh (#548)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
Changes made to fix localhost address to reach V2X Hub Web UI and allow
for script to be run multiple times without changing mysql password
files.

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
[V2XHUB Contributing
Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md)
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
  • Loading branch information
jwillmartin authored Jul 10, 2023
1 parent 1c5a862 commit 639ad08
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 26 deletions.
38 changes: 25 additions & 13 deletions configuration/amd64/initialization.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
directory=$(pwd)
mysqlDir="$directory/mysql"

# update and upgrade commands to update linux OS
sudo apt update -y && sudo apt upgrade -y
Expand All @@ -11,21 +13,31 @@ sudo apt install curl -y #Curl for downloading files over i
curl -L https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/engineering_tools/install-docker.sh | bash

#make passwords for mysql
mkdir secrets && cd secrets
mkdir -p secrets && cd secrets

#creates password files where user inputs password
read -p "enter password for the mysql_root_password: " sql_root_pass
echo "$sql_root_pass" > sql_root_pass.txt

read -p "enter password for mysql_password: " sql_pass
echo "$sql_pass" > sql_pass.txt

#remove endline characters from password files
tr -d '\n' <sql_root_pass.txt> mysql_root_password.txt && tr -d '\n' <sql_pass.txt> mysql_password.txt
rm sql_root_pass.txt && rm sql_pass.txt
FILE1=mysql_root_password.txt
FILE2=mysql_password.txt
if test -f "$FILE1"; then
echo "$FILE1 exists."
else
read -p "enter password for the mysql_root_password: " sql_root_pass
echo "$sql_root_pass" > sql_root_pass.txt
#remove endline characters from password files
tr -d '\n' <sql_root_pass.txt> mysql_root_password.txt && rm sql_root_pass.txt
fi

if test -f "$FILE2"; then
echo "$FILE2 exists."
else
read -p "enter password for mysql_password: " sql_pass
echo "$sql_pass" > sql_pass.txt
#remove endline characters from password files
tr -d '\n' <sql_pass.txt> mysql_password.txt && rm sql_pass.txt
fi

#AMD64 initialzation
cd ..
cd $directory
sudo apt-get -y remove docker docker-engine docker.io containerd runc
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Expand All @@ -38,8 +50,8 @@ sudo apt update -y && sudo apt upgrade -y
sudo docker-compose up -d

#create v2xhub user
cd mysql
cd $mysqlDir
./add_v2xhub_user.bash

chromium-browser "https://127.0.0.1" > /dev/null 2>&1 &
chromium-browser "http://127.0.0.1" > /dev/null 2>&1 &
chromium-browser "https://127.0.0.1:19760" > /dev/null 2>&1 &
39 changes: 26 additions & 13 deletions configuration/arm64/initialization.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash
directory=$(pwd)
mysqlDir="$directory/mysql"

# update and upgrade commands to update linux OS
sudo apt update -y && sudo apt upgrade -y

Expand All @@ -10,21 +13,31 @@ sudo apt install curl -y #Curl for downloading files over i
curl -L https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/engineering_tools/install-docker.sh | bash

#make passwords for mysql
mkdir secrets && cd secrets
mkdir -p secrets && cd secrets

#creates password files where user inputs password
read -p "enter password for the mysql_root_password: " sql_root_pass
echo "$sql_root_pass" > sql_root_pass.txt

read -p "enter password for mysql_password: " sql_pass
echo "$sql_pass" > sql_pass.txt

#remove endline characters from password files
tr -d '\n' <sql_root_pass.txt> mysql_root_password.txt && tr -d '\n' <sql_pass.txt> mysql_password.txt
rm sql_root_pass.txt && rm sql_pass.txt
FILE1=mysql_root_password.txt
FILE2=mysql_password.txt
if test -f "$FILE1"; then
echo "$FILE1 exists."
else
read -p "enter password for the mysql_root_password: " sql_root_pass
echo "$sql_root_pass" > sql_root_pass.txt
#remove endline characters from password files
tr -d '\n' <sql_root_pass.txt> mysql_root_password.txt && rm sql_root_pass.txt
fi

if test -f "$FILE2"; then
echo "$FILE2 exists."
else
read -p "enter password for mysql_password: " sql_pass
echo "$sql_pass" > sql_pass.txt
#remove endline characters from password files
tr -d '\n' <sql_pass.txt> mysql_password.txt && rm sql_pass.txt
fi

#ARM initialization
cd ..
cd $directory
sudo apt-get -y remove docker docker-engine docker.io containerd runc
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
OS=$(lsb_release -i | awk 'FS=":" {print $3;}' | awk '{print tolower($0)}')
Expand All @@ -38,8 +51,8 @@ sudo apt update -y && sudo apt upgrade -y
sudo docker-compose up -d

#create v2xhub user
cd mysql
cd $mysqlDir
./add_v2xhub_user.bash

chromium-browser "https://127.0.0.1" > /dev/null 2>&1 &
chromium-browser "http://127.0.0.1" > /dev/null 2>&1 &
chromium-browser "https://127.0.0.1:19760" > /dev/null 2>&1 &

0 comments on commit 639ad08

Please sign in to comment.