Rip out more unused stuff, and update copyright based on TLP
- Legacy-Id: 19418
This commit is contained in:
parent
6fb64998ce
commit
c4ba1ea75f
|
@ -18,7 +18,7 @@
|
|||
4. **TEMPORARY:** Until Lars' changes have been merged and a docker image is
|
||||
available for download, you will need to build it locally:
|
||||
|
||||
docker/build -l
|
||||
docker/build
|
||||
|
||||
This will take a while, but only needs to be done once.
|
||||
|
||||
|
|
82
docker/build
82
docker/build
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.11
|
||||
version=0.20
|
||||
program=${0##*/}
|
||||
progdir=${0%/*}
|
||||
if [ "$progdir" = "$program" ]; then progdir="."; fi
|
||||
|
@ -8,104 +8,80 @@ if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
|||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
|
||||
export LANG=C
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
$program - Build a docker datatracker image.
|
||||
$program - Build a datatracker docker image
|
||||
|
||||
SYNOPSIS
|
||||
$program [OPTIONS] ARGS
|
||||
$program [OPTIONS]
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
This script builds a debian-based docker image which has been
|
||||
This script builds a Ubuntu-based docker image that has been
|
||||
set up with the dependencies needed to easily run the IETF
|
||||
datatracker in development mode. It uses docker/Dockerfile;
|
||||
i.e., the Dockerfile in the same directory as this script.
|
||||
It assumes that the user has upload rights for the docker
|
||||
ietf/datatracker-environment repository, in order to push the
|
||||
image.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
echo -e "OPTIONS"
|
||||
if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then
|
||||
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | tr -s "\t|" "\t," | sed -r -e 's/\)[ \t]+([A-Z]+)=\$2[^#]*#/=\1\t/' -e 's/\)[^#]*#/\t/'
|
||||
else
|
||||
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | sed 's/\|.*\$2[^#]*#/ /'| sed -E 's/\|.*\)[^#]*#/ /'
|
||||
fi
|
||||
sed -n -E "s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" "$0"
|
||||
cat <<EOF
|
||||
|
||||
FILES
|
||||
|
||||
AUTHOR
|
||||
Written by Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. License 'Simplified BSD', as specified
|
||||
in http://opensource.org/licenses/BSD-3-Clause.
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Option parsing
|
||||
|
||||
# Options
|
||||
shortopts=hlt:vV
|
||||
longopts=help,local,tag=,version
|
||||
|
||||
# Default values
|
||||
IMAGE=ietf/datatracker-environment
|
||||
TAG=$(basename "$(svn info "$parent" | grep ^URL | awk '{print $2}')")
|
||||
LOCAL=""
|
||||
LOCAL=1
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
eval set -- "$args"
|
||||
else
|
||||
# Darwin, BSDs
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
fi
|
||||
# Option parsing
|
||||
shortopts=hut:V
|
||||
args=$(getopt -o$shortopts $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-l| --local) LOCAL=1;; # Don't upload
|
||||
-t| --tag) TAG=$2; shift;; # Use this docker image tag, instead of the latest svn tags name
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-u) LOCAL=0;; # Upload image to repository after build
|
||||
-t) TAG=$2; shift;; # Use this docker image tag
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# The program itself
|
||||
|
||||
docker rmi -f $IMAGE:trunk 2>/dev/null || true
|
||||
docker build --progress plain -t "$IMAGE:$TAG" docker/
|
||||
docker tag "$(docker images -q $IMAGE | head -n 1)" $IMAGE:latest
|
||||
|
|
|
@ -1,118 +1,88 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.10
|
||||
version=0.11
|
||||
program=${0##*/}
|
||||
progdir=${0%/*}
|
||||
if [ "$progdir" = "$program" ]; then progdir="."; fi
|
||||
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
||||
parent=$(dirname $progdir)
|
||||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
|
||||
export LANG=C
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
$program - Make a tarball of the MySQL database files and upload it.
|
||||
$program - Make a tarball of the MySQL database files and upload it
|
||||
|
||||
SYNOPSIS
|
||||
$program [OPTIONS]
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
This script creates a compressed tarball from the MySQL database files
|
||||
on disk, and uploads it to the ietf datatracker developer area on
|
||||
www.ietf.org.
|
||||
|
||||
It is intended to be used with the docker datatracker environment, after
|
||||
you have set up the database with docker/setupdb, started the docker
|
||||
image with docker/run, and updated the database with docker/updatedb.
|
||||
image with docker/run, and updated the database with docker/updatedb.
|
||||
|
||||
To use it, exit from the docker container, to make sure that mysqldb
|
||||
isn't running and all the files consistent and available for copy. Then
|
||||
run docker/$program outside the docker container. You need to have ssh
|
||||
access to www.ietf.org in order for the scp command to succeed.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
echo -e "OPTIONS"
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
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/'
|
||||
else
|
||||
egrep "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" $0 | sed 's/\|.*\$2[^#]*#/ /'| sed -E 's/\|.*\)[^#]*#/ /'
|
||||
fi
|
||||
sed -n -E "s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" "$0"
|
||||
cat <<EOF
|
||||
|
||||
FILES
|
||||
|
||||
AUTHOR
|
||||
Written by Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. License 'Simplified BSD', as specified
|
||||
in http://opensource.org/licenses/BSD-3-Clause.
|
||||
|
||||
EOF
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
function note() {
|
||||
if [ -n "$VERBOSE" ]; then echo -e "$*"; fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Option parsing
|
||||
|
||||
# Options
|
||||
shortopts=hvV
|
||||
longopts=help,verbose,version
|
||||
|
||||
# Default values
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
eval set -- "$args"
|
||||
sed="sed -r"
|
||||
else
|
||||
# Darwin, BSDs
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
sed="sed -E"
|
||||
fi
|
||||
shortopts=hV
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-v| --verbose) VERBOSE=1;; # Be more talkative
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# The program itself
|
||||
|
||||
if [ -e "/.dockerenv" -o -n "$(grep -s '/docker/' /proc/self/cgroup)" ]; then
|
||||
die "It looks as if you're running inside docker -- please quit docker first."
|
||||
fi
|
||||
|
@ -123,4 +93,4 @@ cd $workdir
|
|||
echo "Building tarfile ..."
|
||||
tar cjf ietf_utf8.bin.tar.bz2 mysql
|
||||
echo "Copying tarfile to ietfa.amsl.com ..."
|
||||
scp ietf_utf8.bin.tar.bz2 ietfa.amsl.com:/a/www/www6s/lib/dt/sprint/
|
||||
scp ietf_utf8.bin.tar.bz2 ietfa.amsl.com:/a/www/www6s/lib/dt/sprint/
|
|
@ -1,127 +1,104 @@
|
|||
#!/bin/bash
|
||||
|
||||
version=0.10
|
||||
version=0.11
|
||||
program=${0##*/}
|
||||
progdir=${0%/*}
|
||||
if [ "$progdir" = "$program" ]; then progdir="."; fi
|
||||
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
||||
parent=$(dirname $progdir)
|
||||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
|
||||
export LANG=C
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
$program - Copy additional data files from the ietf server
|
||||
|
||||
SYNOPSIS
|
||||
$program [OPTIONS]
|
||||
$program [OPTIONS] [DESTINATION]
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
This script copies additional data files used by the datatracker
|
||||
from the ietf server to a local directory, for instance drafts,
|
||||
charters, rfcs, agendas, minutes, etc.
|
||||
from the ietf server to a local directory, for instance drafts,
|
||||
charters, rfcs, agendas, minutes, etc.
|
||||
|
||||
If no destination is given, the default is data/developers.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
echo -e "OPTIONS"
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
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/'
|
||||
else
|
||||
egrep "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" $0 | sed 's/\|.*\$2[^#]*#/ /'| sed -E 's/\|.*\)[^#]*#/ /'
|
||||
fi
|
||||
sed -n -E "s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" "$0"
|
||||
cat <<EOF
|
||||
|
||||
FILES
|
||||
|
||||
AUTHOR
|
||||
Written by Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. License 'Simplified BSD', as specified
|
||||
in http://opensource.org/licenses/BSD-3-Clause.
|
||||
|
||||
EOF
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
function note() {
|
||||
if [ -n "$VERBOSE" ]; then echo -e "$*"; fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Option parsing
|
||||
|
||||
# Options
|
||||
shortopts=hvV
|
||||
longopts=help,verbose,version
|
||||
|
||||
# Default values
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
eval set -- "$args"
|
||||
sed="sed -r"
|
||||
else
|
||||
# Darwin, BSDs
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
sed="sed -E"
|
||||
fi
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-v| --verbose) VERBOSE=1;; # Be more talkative
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-v) VERBOSE=1;; # Be more talkative
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# The program itself
|
||||
if [ $# -lt 1 ]; then
|
||||
DEST_ROOT=data/developers
|
||||
else
|
||||
DEST_ROOT="${1%/}"
|
||||
fi
|
||||
echo "Using destination $DEST_ROOT"
|
||||
|
||||
[ $# -lt 1 ] && die "Missing argument: rsync destination"
|
||||
|
||||
DEST_ROOT="${1%/}"
|
||||
for dir in charter conflict-reviews internet-drafts review rfc slides status-changes yang; do
|
||||
dest="$DEST_ROOT/ietf-ftp/$dir"
|
||||
mkdir -p "$dest"
|
||||
echo "Fetching $dest ..."
|
||||
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::everything-ftp/$dir/ $dest/
|
||||
done
|
||||
|
||||
for dir in floor photo; do
|
||||
dest="$DEST_ROOT/media/$dir"
|
||||
mkdir -p "$dest"
|
||||
echo "Fetching $dest ..."
|
||||
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::dev.media/$dir/ $dest/
|
||||
done
|
||||
|
||||
|
||||
dest="$DEST_ROOT/archive/id"
|
||||
echo "Fetching $dest ..."
|
||||
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::id-archive/ $dest/
|
||||
|
||||
|
||||
dest="$DEST_ROOT/archive/id"
|
||||
mkdir -p "$dest"
|
||||
echo "Fetching $dest ..."
|
||||
rsync -auz ${VERBOSE:+--info=progress2} rsync.ietf.org::id-archive/ $dest/
|
87
docker/run
87
docker/run
|
@ -7,9 +7,8 @@ if [ "$progdir" = "$program" ]; then progdir="."; fi
|
|||
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
||||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
if [[ $(uname) =~ CYGWIN.* ]]; then parent=$(echo "$parent" | sed -e 's/^\/cygdrive\/\(.\)/\1:/'); fi
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
|
@ -19,87 +18,69 @@ SYNOPSIS
|
|||
$program [OPTIONS] ARGS
|
||||
|
||||
DESCRIPTION
|
||||
This is a wrapper which runs an Ubuntu-based docker image which
|
||||
has been set up with the dependencies needed to easily run the
|
||||
IETF datatracker in development mode.
|
||||
|
||||
This is a wrapper which runs docker with suitable arguments on a
|
||||
debian-based docker image which has been set up with the dependencies
|
||||
needed to easily run the IETF datatracker in development mode. By
|
||||
default, it expects to find the MySQL database files at
|
||||
$parent/data/mysql, which is mapped inside the
|
||||
container to /var/lib/mysql, and it will set up a home directory for
|
||||
the current user ($USER) and map it to $HOME.
|
||||
MySQL database files at data/mysql will be used; if they do not exist,
|
||||
a database dump will be retrieved and restored on first run.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
echo -e "OPTIONS"
|
||||
if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then
|
||||
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | tr -s "\t|" "\t," | sed -r -e 's/\)[ \t]+([A-Z]+)=\$2[^#]*#/=\1\t/' -e 's/\)[^#]*#/\t/'
|
||||
else
|
||||
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | sed 's/\|.*\$2[^#]*#/ /'| sed -E 's/\|.*\)[^#]*#/ /'
|
||||
fi
|
||||
sed -n -E "s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" "$0"
|
||||
cat <<EOF
|
||||
|
||||
FILES
|
||||
|
||||
AUTHOR
|
||||
Written by Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
|
||||
Copyright (c) 2015 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. License 'Simplified BSD', as specified
|
||||
in http://opensource.org/licenses/BSD-3-Clause.
|
||||
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Option parsing
|
||||
|
||||
# Options
|
||||
shortopts=hp:vVcC
|
||||
longopts=help,port=,version,cached,no-cached
|
||||
|
||||
# Default values
|
||||
MYSQLDIR=$parent/data/mysql
|
||||
PORT=8000
|
||||
REPO="ietf/datatracker-environment"
|
||||
CACHED=':cached'
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
eval set -- "$args"
|
||||
else
|
||||
# Darwin, BSDs
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
fi
|
||||
# Option parsing
|
||||
shortopts=hp:VcC
|
||||
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-c| --cached) CACHED=':cached';; # Use cached disk access to reduce system load
|
||||
-C| --no-cached) CACHED=':consistent';; # Use fully synchronized disk access
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-p| --port) PORT=$2; shift;; # Bind the container's port 8000 to external port PORT
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
-c) CACHED=':cached';; # Use cached disk access to reduce system load
|
||||
-C) CACHED=':consistent';; # Use fully synchronized disk access
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-p) PORT=$2; shift;; # Bind the container's port 8000 to external port PORT
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
@ -108,8 +89,6 @@ if [ -z "$TAG" ]; then
|
|||
TAG=$(basename "$(svn info "$parent" | grep ^URL | awk '{print $2}')")
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
echo "Starting a docker container for '$REPO:$TAG'."
|
||||
mkdir -p "$MYSQLDIR"
|
||||
docker run -ti -p "$PORT":8000 -p 33306:3306 \
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash
|
||||
# -*- indent-with-tabs: 1 -*-
|
||||
|
||||
version=0.20
|
||||
program=${0##*/}
|
||||
|
@ -9,7 +8,7 @@ if [ "$progdir" = "." ]; then progdir="$PWD"; fi
|
|||
parent=$(dirname "$progdir")
|
||||
if [ "$parent" = "." ]; then parent="$PWD"; fi
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
NAME
|
||||
|
@ -19,89 +18,68 @@ SYNOPSIS
|
|||
$program [OPTIONS] ARGS
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
This script downloads a dump of the IETF database and loads into the
|
||||
local sql server if it is newer than the current dump.
|
||||
|
||||
OPTIONS
|
||||
EOF
|
||||
echo -e "OPTIONS"
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | tr -s "\t|" "\t," | sed -r -e 's/\)[ \t]+([A-Z]+)=\$2[^#]*#/=\1\t/' -e 's/\)[^#]*#/\t/'
|
||||
else
|
||||
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | sed 's/\|.*\$2[^#]*#/ /'| sed -E 's/\|.*\)[^#]*#/ /'
|
||||
fi
|
||||
sed -n -E "s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" "$0"
|
||||
cat <<EOF
|
||||
|
||||
FILES
|
||||
|
||||
AUTHOR
|
||||
Written by Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Written by:
|
||||
Henrik Levkowetz, <henrik@levkowetz.com>
|
||||
Lars Eggert, <lars@eggert.org>
|
||||
|
||||
COPYRIGHT
|
||||
|
||||
Copyright (c) 2015 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. License 'Simplified BSD', as specified
|
||||
in http://opensource.org/licenses/BSD-3-Clause.
|
||||
|
||||
Copyright (c) 2016 IETF Trust and the persons identified as authors of
|
||||
the code. All rights reserved. Redistribution and use in source and
|
||||
binary forms, with or without modification, is permitted pursuant to,
|
||||
and subject to the license terms contained in, the Revised BSD
|
||||
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
|
||||
Relating to IETF Documents(https://trustee.ietf.org/license-info).
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function die() {
|
||||
echo -e "\n$program: error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
function version() {
|
||||
echo -e "$program $version"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Option parsing
|
||||
|
||||
# Options
|
||||
shortopts=DLZhqvV
|
||||
longopts=no-download,no-load,no-zap,help,version
|
||||
|
||||
LOAD=1
|
||||
DOWNLOAD=1
|
||||
DROP=1
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
args=$(getopt -o "$shortopts" --long "$longopts" -n "$program" -- $SV "$@")
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
eval set -- "$args"
|
||||
else
|
||||
# Darwin, BSDs
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
fi
|
||||
args=$(getopt -o$shortopts $SV $*)
|
||||
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
|
||||
set -- $args
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-D| --no-download) DOWNLOAD="";; #Don't download, use existing file
|
||||
-L| --no-load) LOAD=""; ;; # Don't load the database
|
||||
-Z| --no-zap) DROP="";; # Don't drop new tables
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
-D) DOWNLOAD="";; # Don't download, use existing file
|
||||
-L) LOAD=""; ;; # Don't load the database
|
||||
-Z) DROP="";; # Don't drop new tables
|
||||
-h) usage; exit;; # Show this help, then exit
|
||||
-V) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# The program itself
|
||||
|
||||
DATADIR=$parent/data
|
||||
|
||||
DUMP=ietf_utf8.sql.gz
|
||||
if [ "$DOWNLOAD" ]; then
|
||||
echo "Fetching database dump..."
|
||||
|
|
Loading…
Reference in a new issue