From 4e79500df8814f1785cb55b05c5011d321554a2a Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Fri, 5 Jun 2020 11:54:51 +0000 Subject: [PATCH] Added a download-only switch to docker/updatedb - Legacy-Id: 17909 --- docker/updatedb | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/docker/updatedb b/docker/updatedb index e2091f4c6..569d86d57 100755 --- a/docker/updatedb +++ b/docker/updatedb @@ -72,6 +72,7 @@ trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; shortopts=DhqvV longopts=no-download,help,quiet,verbose,version +LOAD=1 DOWNLOAD=1 QUIET="" @@ -90,9 +91,10 @@ fi while true ; do case "$1" in - -D| --no-download) DOWNLOAD="";; # Don't download, use existing file + -d| --download) LOAD="";; # Only download + -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 + -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;; @@ -129,16 +131,17 @@ if [ "$DOWNLOAD" ]; then 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 ..." -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 +if [ "$LOAD" ]; then + echo "Loading database ..." + 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 fi -