-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfreshen_local_nasr.sh
executable file
·43 lines (34 loc) · 1.01 KB
/
freshen_local_nasr.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
39
40
41
42
#!/bin/bash
set -eu # Always put this in Bourne shell scripts
IFS=$(printf '\n\t') # Always put this in Bourne shell scripts
# Download latest documents from from FAA
# The script begins here
# Set some basic variables and make them read-only
PROGNAME=$(basename "$0")
PROGDIR=$(readlink -m "$(dirname "$0")")
NUMARGS=$#
declare -r PROGNAME
declare -r PROGDIR
declare -r NUMARGS
# Validate number of command line parameters
if [ "$NUMARGS" -ne 1 ] ; then
echo "Usage: $PROGNAME <DOWNLOAD_ROOT_DIR>" >&2
echo "eg: $PROGNAME ." >&2
exit 1
fi
# Get command line parameter
DOWNLOAD_ROOT_DIR=$(readlink -f "$1")
declare -r DOWNLOAD_ROOT
if [ ! -d "$DOWNLOAD_ROOT_DIR" ]; then
echo "$DOWNLOAD_ROOT_DIR doesn't exist" >&2
exit 1
fi
# get URL for current CIFP edition
cifp_url=$(./get_current_nasr_url.py)
# Update local cifp
echo "Downloading $cifp_url"
wget \
--directory-prefix="$DOWNLOAD_ROOT_DIR" \
--timestamping \
--ignore-case \
"$cifp_url"