-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfullpath_validate.sh
executable file
·38 lines (29 loc) · 1.38 KB
/
fullpath_validate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Looks like an issue with my local setup this should not be neccessary in production. We may need to check the path first... "which gam". We could then set the "gam=" variable technically
gam="/Users/camglegg/bin/gam/gam"
# Get Franchise Name as input
read -p "Enter Franchise Name: " franchise_name
# Get Franchise Country as input (assuming it's either "Canada" or "US")
read -p "Enter Franchise Country (Canada or US): " franchise_country
# Get Franchise State/Province as input (must be abbreviation "AZ" == Arizona, "ON" == Ontario etc.)
read -p "Enter Franchise State (or Province). This must be the short form, two letter, abbeviation: " franchise_state
# Define the base path for OUs
base_path="/FP/"
# Create OU with location-specific path. This should be broken down as $base_path/$franchise_location_$franchise_state_$franchise_name
country_code=""
if [ "$franchise_country" == "Canada" ]; then
country_code="CA"
elif [ "$franchise_country" == "US" ]; then
country_code="US"
else
echo "Invalid location. Please enter either 'Canada' or 'US'."
exit 1
fi
full_path="$base_path$franchise_country/${country_code}_${franchise_state}_$franchise_name"
# Create top-level Franchise OU
$gam create org "$full_path"
# Create sub-OUs
sub_ous=("Owner" "Operations" "CD" "CG")
for sub_ou in "${sub_ous[@]}"; do
sub_ou_path="$full_path/$sub_ou"
$gam create org "$sub_ou_path"
done