Skip to content

Commit c4ba1ea

Browse files
committed
Rip out more unused stuff, and update copyright based on TLP
- Legacy-Id: 19418
1 parent 6fb6499 commit c4ba1ea

6 files changed

Lines changed: 154 additions & 274 deletions

File tree

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
4. **TEMPORARY:** Until Lars' changes have been merged and a docker image is
1919
available for download, you will need to build it locally:
2020

21-
docker/build -l
21+
docker/build
2222

2323
This will take a while, but only needs to be done once.
2424

docker/build

Lines changed: 30 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,87 @@
11
#!/bin/bash
22

3-
version=0.11
3+
version=0.20
44
program=${0##*/}
55
progdir=${0%/*}
66
if [ "$progdir" = "$program" ]; then progdir="."; fi
77
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
88
parent=$(dirname "$progdir")
99
if [ "$parent" = "." ]; then parent="$PWD"; fi
1010

11-
export LANG=C
1211

13-
# ----------------------------------------------------------------------
1412
function usage() {
1513
cat <<EOF
1614
NAME
17-
$program - Build a docker datatracker image.
15+
$program - Build a datatracker docker image
1816
1917
SYNOPSIS
20-
$program [OPTIONS] ARGS
18+
$program [OPTIONS]
2119
2220
DESCRIPTION
23-
24-
This script builds a debian-based docker image which has been
21+
This script builds a Ubuntu-based docker image that has been
2522
set up with the dependencies needed to easily run the IETF
2623
datatracker in development mode. It uses docker/Dockerfile;
2724
i.e., the Dockerfile in the same directory as this script.
28-
It assumes that the user has upload rights for the docker
29-
ietf/datatracker-environment repository, in order to push the
30-
image.
3125
26+
OPTIONS
3227
EOF
33-
echo -e "OPTIONS"
34-
if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then
35-
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/'
36-
else
37-
grep -E "^[ ]+[-][A-Za-z| -]+\*?\)[ ]+[A-Za-z].+#" "$0" | sed 's/\|.*\$2[^#]*#/ /'| sed -E 's/\|.*\)[^#]*#/ /'
38-
fi
28+
sed -n -E "s|(^\s+-[A-Za-z])\).*#(.*)|\1 \2|p" "$0"
3929
cat <<EOF
4030
41-
FILES
42-
4331
AUTHOR
44-
Written by Henrik Levkowetz, <henrik@levkowetz.com>
32+
Written by:
33+
Henrik Levkowetz, <henrik@levkowetz.com>
34+
Lars Eggert, <lars@eggert.org>
4535
4636
COPYRIGHT
47-
4837
Copyright (c) 2016 IETF Trust and the persons identified as authors of
49-
the code. All rights reserved. License 'Simplified BSD', as specified
50-
in http://opensource.org/licenses/BSD-3-Clause.
38+
the code. All rights reserved. Redistribution and use in source and
39+
binary forms, with or without modification, is permitted pursuant to,
40+
and subject to the license terms contained in, the Revised BSD
41+
License set forth in Section 4.c of the IETF Trust’s Legal Provisions
42+
Relating to IETF Documents(https://trustee.ietf.org/license-info).
5143
5244
EOF
53-
5445
}
5546

56-
# ----------------------------------------------------------------------
47+
5748
function die() {
5849
echo -e "\n$program: error: $*" >&2
5950
exit 1
6051
}
6152

62-
# ----------------------------------------------------------------------
53+
6354
function version() {
6455
echo -e "$program $version"
6556
}
6657

67-
# ----------------------------------------------------------------------
68-
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
69-
70-
71-
# ----------------------------------------------------------------------
72-
# Option parsing
7358

74-
# Options
75-
shortopts=hlt:vV
76-
longopts=help,local,tag=,version
59+
trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR
7760

7861
# Default values
7962
IMAGE=ietf/datatracker-environment
8063
TAG=$(basename "$(svn info "$parent" | grep ^URL | awk '{print $2}')")
81-
LOCAL=""
82-
83-
if [ "$(uname)" = "Linux" ]; then
84-
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
85-
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
86-
eval set -- "$args"
87-
else
88-
# Darwin, BSDs
89-
args=$(getopt -o$shortopts $SV $*)
90-
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
91-
set -- $args
92-
fi
64+
LOCAL=1
65+
66+
# Option parsing
67+
shortopts=hut:V
68+
args=$(getopt -o$shortopts $*)
69+
if [ $? != 0 ] ; then die "Terminating..." >&2 ; exit 1 ; fi
70+
set -- $args
9371

9472
while true ; do
9573
case "$1" in
96-
-h| --help) usage; exit;; # Show this help, then exit
97-
-l| --local) LOCAL=1;; # Don't upload
98-
-t| --tag) TAG=$2; shift;; # Use this docker image tag, instead of the latest svn tags name
99-
-V| --version) version; exit;; # Show program version, then exit
100-
--) shift; break;;
101-
*) die "Internal error, inconsistent option specification: '$1'";;
74+
-h) usage; exit;; # Show this help, then exit
75+
-u) LOCAL=0;; # Upload image to repository after build
76+
-t) TAG=$2; shift;; # Use this docker image tag
77+
-V) version; exit;; # Show program version, then exit
78+
--) shift; break;;
79+
*) die "Internal error, inconsistent option specification: '$1'";;
10280
esac
10381
shift
10482
done
10583

106-
# ----------------------------------------------------------------------
10784
# The program itself
108-
10985
docker rmi -f $IMAGE:trunk 2>/dev/null || true
11086
docker build --progress plain -t "$IMAGE:$TAG" docker/
11187
docker tag "$(docker images -q $IMAGE | head -n 1)" $IMAGE:latest

docker/copydb

Lines changed: 26 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,88 @@
11
#!/bin/bash
22

3-
version=0.10
3+
version=0.11
44
program=${0##*/}
55
progdir=${0%/*}
66
if [ "$progdir" = "$program" ]; then progdir="."; fi
77
if [ "$progdir" = "." ]; then progdir="$PWD"; fi
8-
parent=$(dirname $progdir)
8+
parent=$(dirname "$progdir")
99
if [ "$parent" = "." ]; then parent="$PWD"; fi
1010

11-
export LANG=C
1211

13-
# ----------------------------------------------------------------------
1412
function usage() {
1513
cat <<EOF
1614
NAME
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
1917
SYNOPSIS
2018
$program [OPTIONS]
2119
2220
DESCRIPTION
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
3735
EOF
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-
4839
AUTHOR
49-
Written by Henrik Levkowetz, <henrik@levkowetz.com>
40+
Written by:
41+
Henrik Levkowetz, <henrik@levkowetz.com>
42+
Lars Eggert, <lars@eggert.org>
5043
5144
COPYRIGHT
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+
6256
function 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-
# ----------------------------------------------------------------------
7262
function 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

10275
while 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
11183
done
11284

113-
# ----------------------------------------------------------------------
11485
# The program itself
115-
11686
if [ -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."
11888
fi
@@ -123,4 +93,4 @@ cd $workdir
12393
echo "Building tarfile ..."
12494
tar cjf ietf_utf8.bin.tar.bz2 mysql
12595
echo "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

Comments
 (0)