11#! /bin/bash
22
3- version=0.10
3+ version=0.11
44program=${0##*/ }
55progdir=${0%/* }
66if [ " $progdir " = " $program " ]; then progdir=" ." ; fi
77if [ " $progdir " = " ." ]; then progdir=" $PWD " ; fi
8- parent=$( dirname $progdir )
8+ parent=$( dirname " $progdir " )
99if [ " $parent " = " ." ]; then parent=" $PWD " ; fi
1010
11- export LANG=C
1211
13- # ----------------------------------------------------------------------
1412function usage() {
1513 cat << EOF
1614NAME
17- $program - Make a tarball of the MySQL database files and upload it.
15+ $program - Make a tarball of the MySQL database files and upload it
1816
1917SYNOPSIS
2018 $program [OPTIONS]
2119
2220DESCRIPTION
23-
2421 This script creates a compressed tarball from the MySQL database files
2522 on disk, and uploads it to the ietf datatracker developer area on
2623 www.ietf.org.
2724
2825 It is intended to be used with the docker datatracker environment, after
2926 you have set up the database with docker/setupdb, started the docker
30- image with docker/run, and updated the database with docker/updatedb.
27+ image with docker/run, and updated the database with docker/updatedb.
3128
3229 To use it, exit from the docker container, to make sure that mysqldb
3330 isn't running and all the files consistent and available for copy. Then
3431 run docker/$program outside the docker container. You need to have ssh
3532 access to www.ietf.org in order for the scp command to succeed.
3633
34+ OPTIONS
3735EOF
38- echo -e " OPTIONS"
39- if [ " $( uname) " = " Linux" ]; then
40- egrep " ^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" $0 | tr -s " \t|" " \t," | sed -r -e ' s/\)[ \t]+([A-Z]+)=\$2[^#]*#/=\1\t/' -e ' s/\)[^#]*#/\t/'
41- else
42- egrep " ^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" $0 | sed ' s/\|.*\$2[^#]*#/ /' | sed -E ' s/\|.*\)[^#]*#/ /'
43- fi
36+ sed -n -E " s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" " $0 "
4437 cat << EOF
4538
46- FILES
47-
4839AUTHOR
49- Written by Henrik Levkowetz, <henrik@levkowetz.com>
40+ Written by:
41+ Henrik Levkowetz, <henrik@levkowetz.com>
42+ Lars Eggert, <lars@eggert.org>
5043
5144COPYRIGHT
52-
5345 Copyright (c) 2016 IETF Trust and the persons identified as authors of
54- the code. All rights reserved. License 'Simplified BSD', as specified
55- in http://opensource.org/licenses/BSD-3-Clause.
56-
57- EOF
46+ the code. All rights reserved. Redistribution and use in source and
47+ binary forms, with or without modification, is permitted pursuant to,
48+ and subject to the license terms contained in, the Revised BSD
49+ License set forth in Section 4.c of the IETF Trust’s Legal Provisions
50+ Relating to IETF Documents(https://trustee.ietf.org/license-info).
5851
52+ EOF
5953}
6054
61- # ----------------------------------------------------------------------
55+
6256function die() {
6357 echo -e " \n$program : error: $* " >&2
6458 exit 1
6559}
6660
67- function note() {
68- if [ -n " $VERBOSE " ]; then echo -e " $* " ; fi
69- }
7061
71- # ----------------------------------------------------------------------
7262function version() {
7363 echo -e " $program $version "
7464}
7565
76- # ----------------------------------------------------------------------
77- trap ' echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
7866
67+ trap ' echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
7968
80- # ----------------------------------------------------------------------
8169# Option parsing
82-
83- # Options
84- shortopts=hvV
85- longopts=help,verbose,version
86-
87- # Default values
88-
89- if [ " $( uname) " = " Linux" ]; then
90- args=$( getopt -o " $shortopts " --long " $longopts " -n ' $program' -- $SV " $@ " )
91- if [ $? != 0 ] ; then die " Terminating..." >&2 ; exit 1 ; fi
92- eval set -- " $args "
93- sed=" sed -r"
94- else
95- # Darwin, BSDs
96- args=$( getopt -o$shortopts $SV $* )
97- if [ $? != 0 ] ; then die " Terminating..." >&2 ; exit 1 ; fi
98- set -- $args
99- sed=" sed -E"
100- fi
70+ shortopts=hV
71+ args=$( getopt -o$shortopts $SV $* )
72+ if [ $? != 0 ] ; then die " Terminating..." >&2 ; exit 1 ; fi
73+ set -- $args
10174
10275while true ; do
10376 case " $1 " in
104- -h| --help) usage; exit ;; # Show this help, then exit
105- -v| --verbose) VERBOSE=1;; # Be more talkative
106- -V| --version) version; exit ;; # Show program version, then exit
107- --) shift ; break ;;
108- * ) die " Internal error, inconsistent option specification: '$1 '" ;;
77+ -h) usage; exit ;; # Show this help, then exit
78+ -V) version; exit ;; # Show program version, then exit
79+ --) shift ; break ;;
80+ * ) die " Internal error, inconsistent option specification: '$1 '" ;;
10981 esac
11082 shift
11183done
11284
113- # ----------------------------------------------------------------------
11485# The program itself
115-
11686if [ -e " /.dockerenv" -o -n " $( grep -s ' /docker/' /proc/self/cgroup) " ]; then
11787 die " It looks as if you're running inside docker -- please quit docker first."
11888fi
@@ -123,4 +93,4 @@ cd $workdir
12393echo " Building tarfile ..."
12494tar cjf ietf_utf8.bin.tar.bz2 mysql
12595echo " Copying tarfile to ietfa.amsl.com ..."
126- scp ietf_utf8.bin.tar.bz2 ietfa.amsl.com:/a/www/www6s/lib/dt/sprint/
96+ scp ietf_utf8.bin.tar.bz2 ietfa.amsl.com:/a/www/www6s/lib/dt/sprint/
0 commit comments