Skip to content

Commit 4e79500

Browse files
committed
Added a download-only switch to docker/updatedb
- Legacy-Id: 17909
1 parent 186e2ae commit 4e79500

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

docker/updatedb

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)";
7272
shortopts=DhqvV
7373
longopts=no-download,help,quiet,verbose,version
7474

75+
LOAD=1
7576
DOWNLOAD=1
7677
QUIET=""
7778

@@ -90,9 +91,10 @@ fi
9091

9192
while true ; do
9293
case "$1" in
93-
-D| --no-download) DOWNLOAD="";; # Don't download, use existing file
94+
-d| --download) LOAD="";; # Only download
95+
-D| --no-download) DOWNLOAD="";; # Don't download, use existing file
9496
-h| --help) usage; exit;; # Show this help, then exit
95-
-q| --quiet) QUIET="-q";; # Don't show progress
97+
-q| --quiet) QUIET="-q";; # Don't show progress
9698
-v| --verbose) VERBOSE=1;; # Be more talkative
9799
-V| --version) version; exit;; # Show program version, then exit
98100
--) shift; break;;
@@ -129,16 +131,17 @@ if [ "$DOWNLOAD" ]; then
129131
wget $QUIET -N -P $DATADIR https://www.ietf.org/lib/dt/sprint/ietf_utf8.sql.gz || die "No new data, quitting."
130132
fi
131133

132-
echo "Loading database ..."
133-
if [ -z "$QUIET" ]; then
134-
gunzip < $DATADIR/ietf_utf8.sql.gz \
135-
| pv --progress --bytes --rate --eta --size $(gzip --list --quiet $DATADIR/ietf_utf8.sql.gz | awk '{ print $2 }') \
136-
| sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \
137-
| $parent/ietf/manage.py dbshell
138-
else
139-
gunzip < $DATADIR/ietf_utf8.sql.gz \
140-
| sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \
141-
| $parent/ietf/manage.py dbshell
134+
if [ "$LOAD" ]; then
135+
echo "Loading database ..."
136+
if [ -z "$QUIET" ]; then
137+
gunzip < $DATADIR/ietf_utf8.sql.gz \
138+
| pv --progress --bytes --rate --eta --size $(gzip --list --quiet $DATADIR/ietf_utf8.sql.gz | awk '{ print $2 }') \
139+
| sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \
140+
| $parent/ietf/manage.py dbshell
141+
else
142+
gunzip < $DATADIR/ietf_utf8.sql.gz \
143+
| sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \
144+
| $parent/ietf/manage.py dbshell
145+
fi
142146
fi
143147

144-

0 commit comments

Comments
 (0)