diff --git a/scripts/georeport-client.sh b/scripts/georeport-client.sh index 58f56ee8..e8aa7a2f 100755 --- a/scripts/georeport-client.sh +++ b/scripts/georeport-client.sh @@ -38,13 +38,19 @@ echo "-------------------------------------------------------------------------- for i in $(seq 1 50); do - RANDOM_1=$(awk -v min=-1 -v max=1 'BEGIN{srand(); print min+rand()*(max-min)}') - RANDOM_2=$(awk -v min=-1 -v max=1 'BEGIN{srand(); print min+rand()*(max-min)}') + # Generate a random angle in radians between 0 and 2*pi + RANDOM_ANGLE=$(awk -v seed="$RANDOM$((i * 10))" 'BEGIN {srand(seed); print rand() * 2 * 3.141592653589793;}') + # Generate a random radius within the circle + RANDOM_RADIUS=$(awk -v seed="$RANDOM$((i * 10))" -v max="$RADIUS_IN_DEGREES" 'BEGIN {srand(seed); print sqrt(rand()) * max;}') - LATITUDE=$(awk -v center_lat="$CENTER_LAT" -v radius="$RADIUS_IN_DEGREES" -v random_1="$RANDOM_1" 'BEGIN {print center_lat + (radius * random_1)}') - LONGITUDE=$(awk -v center_lng="$CENTER_LNG" -v radius="$RADIUS_IN_DEGREES" -v random_2="$RANDOM_2" 'BEGIN {print center_lng + (radius * random_2)}') + # Calculate the latitude and longitude offsets + LATITUDE_OFFSET=$(awk -v radius="$RANDOM_RADIUS" -v angle="$RANDOM_ANGLE" 'BEGIN {print radius * sin(angle);}') + LONGITUDE_OFFSET=$(awk -v radius="$RANDOM_RADIUS" -v angle="$RANDOM_ANGLE" 'BEGIN {print radius * cos(angle);}') + # Calculate the actual latitude and longitude + LATITUDE=$(awk -v center_lat="$CENTER_LAT" -v offset="$LATITUDE_OFFSET" 'BEGIN {print center_lat + offset;}') + LONGITUDE=$(awk -v center_lng="$CENTER_LNG" -v offset="$LONGITUDE_OFFSET" 'BEGIN {print center_lng + offset;}') RANDOM_SERVICE_CODE=$(printf "%s\n" "$SERVICES" | awk 'BEGIN {srand();}{a[NR]=$0}END{print a[int(rand()*NR)+1]}') EMAIL="test_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c10)@example.com" @@ -81,4 +87,4 @@ for i in $(seq 1 50); do printf "%-10s %-30s %-15s %-15s %-12s %-15s %-8s\n" "$i" "$EMAIL" "$LATITUDE" "$LONGITUDE" "$REQUEST_TIME" "$RESPONSE" "$RANDOM_SERVICE_CODE" done -echo "------------------------------------------------------------------------------------------------------------------" \ No newline at end of file +echo "------------------------------------------------------------------------------------------------------------------" diff --git a/scripts/start.sh b/scripts/start.sh index 7406f244..b924eff7 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -15,8 +15,12 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then usage fi +printf "\e[32mInstall all libraries with composer..\e[0m\n" +composer install --no-dev - composer install + +if [ "$ENVIRONMENT" != "prod" ]; then + printf "\e[32mNo Prod deployment. Installing Drupal with the Mark-a-Spot Distribution...\e[0m\n" # Define the path to the Drupal settings file SETTINGS_FILE="/app/data/web/sites/default/settings.php" @@ -49,12 +53,9 @@ fi sed -i "s|# \$settings\['config_sync_directory'\] = '/directory/outside/webroot';|\$settings['config_sync_directory'] = '../config/sync';|" "$SETTINGS_FILE" - echo "Custom configuration added to $SETTINGS_FILE" + printf "\e[32mCustom configuration added to $SETTINGS_FILE" - -if [ "$ENVIRONMENT" != "prod" ]; then - printf "\e[32mNo Prod deployment. Installing Drupal with the Mark-a-Spot Distribution...\e[0m\n" printf "\e[36mDropping all tables in the database...\e[0m\n" drush sql-drop -y printf "\e[36mExecuting the Markaspot:install command...\e[0m\n"