Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use subscripted variables
Tom Scavo committed May 6, 2017
1 parent 9c90d14 commit 27bb60c
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions bin/process_main_aggregate.sh
@@ -25,12 +25,12 @@ display_help () {
This script produces the following files from the InCommon
main aggregate:
$out_filename1
$out_filename2
$out_filename3
$out_filename4
$out_filename5
$out_filename6
${out_filename[1]}
${out_filename[2]}
${out_filename[3]}
${out_filename[4]}
${out_filename[5]}
${out_filename[6]}
The script is intended to be run as a cron job. It can (and
should) be run often, to pick up the latest changes to metadata.
@@ -112,12 +112,12 @@ if [ -z "$LOG_LEVEL" ]; then
fi

# output filenames
out_filename1="all-idp-displaynames.csv"
out_filename2="all-idps-rands.csv"
out_filename3="all-sps-rands.csv"
out_filename4="security-contacts-legacy-list.csv"
out_filename5="security-contacts-summary.json"
out_filename6="security-contacts-summary-local.json"
out_filename[1]="all-idp-displaynames.csv"
out_filename[2]="all-idps-rands.csv"
out_filename[3]="all-sps-rands.csv"
out_filename[4]="security-contacts-legacy-list.csv"
out_filename[5]="security-contacts-summary.json"
out_filename[6]="security-contacts-summary-local.json"

#######################################################################
# Process command-line options and arguments
@@ -190,34 +190,34 @@ if [ $status_code -ne 0 ]; then
fi

# XSL stylesheets must exist
xsl_file1=$LIB_DIR/list_all_IdP_DisplayNames_csv.xsl
if [ ! -f "$xsl_file1" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file1" >&2
xsl_file[1]=$LIB_DIR/list_all_IdP_DisplayNames_csv.xsl
if [ ! -f "${xsl_file[1]}" ]; then
echo "ERROR: $script_name: lib file does not exist: ${xsl_file[1]}" >&2
exit 2
fi
xsl_file2=$LIB_DIR/list_all_RandS_IdPs_csv.xsl
if [ ! -f "$xsl_file2" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file2" >&2
xsl_file[2]=$LIB_DIR/list_all_RandS_IdPs_csv.xsl
if [ ! -f "${xsl_file[2]}" ]; then
echo "ERROR: $script_name: lib file does not exist: ${xsl_file[2]}" >&2
exit 2
fi
xsl_file3=$LIB_DIR/list_all_RandS_SPs_csv.xsl
if [ ! -f "$xsl_file3" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file3" >&2
xsl_file[3]=$LIB_DIR/list_all_RandS_SPs_csv.xsl
if [ ! -f "${xsl_file[3]}" ]; then
echo "ERROR: $script_name: lib file does not exist: ${xsl_file[3]}" >&2
exit 2
fi
xsl_file4=$LIB_DIR/security_contacts_legacy_list_csv.xsl
if [ ! -f "$xsl_file4" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file4" >&2
xsl_file[4]=$LIB_DIR/security_contacts_legacy_list_csv.xsl
if [ ! -f "${xsl_file[4]}" ]; then
echo "ERROR: $script_name: lib file does not exist: ${xsl_file[4]}" >&2
exit 2
fi
xsl_file5=$LIB_DIR/security_contacts_summary_json.xsl
if [ ! -f "$xsl_file5" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file5" >&2
xsl_file[5]=$LIB_DIR/security_contacts_summary_json.xsl
if [ ! -f "${xsl_file[5]}" ]; then
echo "ERROR: $script_name: lib file does not exist: ${xsl_file[5]}" >&2
exit 2
fi
xsl_file6=$LIB_DIR/security_contacts_summary_local_json.xsl
if [ ! -f "$xsl_file6" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file6" >&2
xsl_file[6]=$LIB_DIR/security_contacts_summary_local_json.xsl
if [ ! -f "${xsl_file[6]}" ]; then
echo "ERROR: $script_name: lib file does not exist: ${xsl_file[6]}" >&2
exit 2
fi

@@ -234,12 +234,12 @@ fi
xml_file="${tmp_dir}/saml-metadata.xml"

# output files
out_file1="${tmp_dir}/$out_filename1"
out_file2="${tmp_dir}/$out_filename2"
out_file3="${tmp_dir}/$out_filename3"
out_file4="${tmp_dir}/$out_filename4"
out_file5="${tmp_dir}/$out_filename5"
out_file6="${tmp_dir}/$out_filename6"
out_file[1]="${tmp_dir}/${out_filename[1]}"
out_file[2]="${tmp_dir}/${out_filename[2]}"
out_file[3]="${tmp_dir}/${out_filename[3]}"
out_file[4]="${tmp_dir}/${out_filename[4]}"
out_file[5]="${tmp_dir}/${out_filename[5]}"
out_file[6]="${tmp_dir}/${out_filename[6]}"

#######################################################################
# Main processing
@@ -266,62 +266,62 @@ if [ $exit_code -gt 1 ]; then
fi

# create the first output file
print_log_message -I "$script_name writing output file: $out_filename1"
/usr/bin/xsltproc $xsl_file1 $xml_file > $out_file1
print_log_message -I "$script_name writing output file: ${out_filename[1]}"
/usr/bin/xsltproc ${xsl_file[1]} $xml_file > ${out_file[1]}
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file1"
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: ${xsl_file[1]}"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the second output file
print_log_message -I "$script_name writing output file: $out_filename2"
/usr/bin/xsltproc $xsl_file2 $xml_file > $out_file2
print_log_message -I "$script_name writing output file: ${out_filename[2]}"
/usr/bin/xsltproc ${xsl_file[2]} $xml_file > ${out_file[2]}
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file2"
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: ${xsl_file[2]}"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the third output file
print_log_message -I "$script_name writing output file: $out_filename3"
/usr/bin/xsltproc $xsl_file3 $xml_file > $out_file3
print_log_message -I "$script_name writing output file: ${out_filename[3]}"
/usr/bin/xsltproc ${xsl_file[3]} $xml_file > ${out_file[3]}
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file3"
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: ${xsl_file[3]}"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the fourth output file
print_log_message -I "$script_name writing output file: $out_filename4"
/usr/bin/xsltproc $xsl_file4 $xml_file > $out_file4
print_log_message -I "$script_name writing output file: ${out_filename[4]}"
/usr/bin/xsltproc ${xsl_file[4]} $xml_file > ${out_file[4]}
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file4"
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: ${xsl_file[4]}"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the fifth output file
print_log_message -I "$script_name writing output file: $out_filename5"
/usr/bin/xsltproc $xsl_file5 $xml_file > $out_file5
print_log_message -I "$script_name writing output file: ${out_filename[5]}"
/usr/bin/xsltproc ${xsl_file[5]} $xml_file > ${out_file[5]}
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file5"
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: ${xsl_file[5]}"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the sixth output file
print_log_message -I "$script_name writing output file: $out_filename6"
/usr/bin/xsltproc $xsl_file6 $xml_file > $out_file6
print_log_message -I "$script_name writing output file: ${out_filename[6]}"
/usr/bin/xsltproc ${xsl_file[6]} $xml_file > ${out_file[6]}
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file6"
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: ${xsl_file[6]}"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# move the output files to the web directory
print_log_message -I "$script_name moving output files to dir: $out_dir"
/bin/mv $out_file1 $out_file2 $out_file3 $out_file4 $out_file5 $out_file6 $out_dir
/bin/mv ${out_file[1]} ${out_file[2]} ${out_file[3]} ${out_file[4]} ${out_file[5]} ${out_file[6]} $out_dir
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: mv failed ($exit_code) to dir: $out_dir"

0 comments on commit 27bb60c

Please sign in to comment.