diff --git a/docker/updatedb b/docker/updatedb index 98acd7b73..6b9281753 100755 --- a/docker/updatedb +++ b/docker/updatedb @@ -69,10 +69,11 @@ trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; # Option parsing # Options -shortopts=DhvV -longopts=no-download,help,verbose,version +shortopts=DhqvV +longopts=no-download,help,quiet,verbose,version DOWNLOAD=1 +QUIET="" if [ "$(uname)" = "Linux" ]; then args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@") @@ -91,6 +92,7 @@ while true ; do case "$1" in -D| --no-download) DOWNLOAD="";; # Don't download, use existing file -h| --help) usage; exit;; # Show this help, then exit + -q| --quiet) QUIET="-q";; # Don't show progress -v| --verbose) VERBOSE=1;; # Be more talkative -V| --version) version; exit;; # Show program version, then exit --) shift; break;; @@ -124,14 +126,19 @@ DATADIR=$parent/data if [ "$DOWNLOAD" ]; then echo "Fetching database dump ..." - wget -N -P $DATADIR https://www.ietf.org/lib/dt/sprint/ietf_utf8.sql.gz || die "No new data, quitting." + wget $QUIET -N -P $DATADIR https://www.ietf.org/lib/dt/sprint/ietf_utf8.sql.gz || die "No new data, quitting." fi echo "Loading database ..." -gunzip < $DATADIR/ietf_utf8.sql.gz \ - | pv --progress --bytes --rate --eta --size $(gzip --list --quiet $DATADIR/ietf_utf8.sql.gz | awk '{ print $2 }') \ - | sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \ - | $parent/ietf/manage.py dbshell - +if [ -z "$QUIET" ]; then + gunzip < $DATADIR/ietf_utf8.sql.gz \ + | pv --progress --bytes --rate --eta --size $(gzip --list --quiet $DATADIR/ietf_utf8.sql.gz | awk '{ print $2 }') \ + | sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \ + | $parent/ietf/manage.py dbshell +else + gunzip < $DATADIR/ietf_utf8.sql.gz \ + | sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \ + | $parent/ietf/manage.py dbshell +fi