From f6922634223c4ba6e757f58532d4753e1b3ca15f Mon Sep 17 00:00:00 2001 From: dotneft Date: Wed, 3 Aug 2016 11:28:09 -0700 Subject: [PATCH 1/2] Fixed schema name for PostgreSQL --- agent/alpine/run_zabbix_component.sh | 4 +- agent/alpine/update.sh | 126 ++++++++++++++++++ agent/ubuntu/run_zabbix_component.sh | 4 +- java-gateway/alpine/run_zabbix_component.sh | 4 +- java-gateway/ubuntu/run_zabbix_component.sh | 4 +- proxy-mysql/alpine/run_zabbix_component.sh | 4 +- proxy-mysql/ubuntu/run_zabbix_component.sh | 4 +- proxy-sqlite3/alpine/run_zabbix_component.sh | 4 +- proxy-sqlite3/ubuntu/run_zabbix_component.sh | 4 +- server-mysql/alpine/run_zabbix_component.sh | 4 +- server-mysql/ubuntu/run_zabbix_component.sh | 4 +- server-pgsql/alpine/run_zabbix_component.sh | 4 +- server-pgsql/ubuntu/run_zabbix_component.sh | 4 +- .../alpine/run_zabbix_component.sh | 4 +- .../ubuntu/run_zabbix_component.sh | 4 +- .../alpine/run_zabbix_component.sh | 4 +- .../ubuntu/run_zabbix_component.sh | 4 +- .../alpine/run_zabbix_component.sh | 4 +- .../ubuntu/run_zabbix_component.sh | 4 +- 19 files changed, 144 insertions(+), 54 deletions(-) create mode 100755 agent/alpine/update.sh diff --git a/agent/alpine/run_zabbix_component.sh b/agent/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/agent/alpine/run_zabbix_component.sh +++ b/agent/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/agent/alpine/update.sh b/agent/alpine/update.sh new file mode 100755 index 000000000..196ce3628 --- /dev/null +++ b/agent/alpine/update.sh @@ -0,0 +1,126 @@ +#!/bin/bash +set -eo pipefail + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +helperDir='.template-helpers' + +repos=( "$@" ) +if [ ${#repos[@]} -eq 0 ]; then + repos=( */ ) +fi +repos=( "${repos[@]%/}" ) + +replace_field() { + repo="$1" + field="$2" + content="$3" + extraSed="${4:-}" + sed_escaped_value="$(echo "$content" | sed 's/[\/&]/\\&/g')" + sed_escaped_value="${sed_escaped_value//$'\n'/\\n}" + sed -ri "s/${extraSed}%%${field}%%${extraSed}/$sed_escaped_value/g" "$repo/README.md" +} + +dockerLatest="$(curl -fsSL 'https://get.docker.com/latest')" + +for repo in "${repos[@]}"; do + if [ -x "$repo/update.sh" ]; then + ( set -x; "$repo/update.sh" ) + fi + + if [ -e "$repo/content.md" ]; then + githubRepo="$(cat "$repo/github-repo")" + + mailingList="$(cat "$repo/mailing-list.md" 2>/dev/null || true)" + if [ "$mailingList" ]; then + mailingList=" $mailingList " + else + mailingList=' ' + fi + + dockerVersions="$(cat "$repo/docker-versions.md" 2>/dev/null || cat "$helperDir/docker-versions.md")" + + userFeedback="$(cat "$repo/user-feedback.md" 2>/dev/null || cat "$helperDir/user-feedback.md")" + + license="$(cat "$repo/license.md" 2>/dev/null || true)" + if [ "$license" ]; then + license=$'\n\n''# License'$'\n\n'"$license" + fi + + logo= + logoFile= + for f in png svg; do + if [ -e "$repo/logo.$f" ]; then + logoFile="$repo/logo.$f" + break + fi + done + if [ "$logoFile" ]; then + logoCommit="$(git log -1 --format='format:%H' -- "$logoFile" 2>/dev/null || true)" + [ "$logoCommit" ] || logoCommit='master' + if [ "${logoFile##*.}" = 'svg' ]; then + logo="![logo](https://rawgit.com/docker-library/docs/$logoCommit/$logoFile)" + else + logo="![logo](https://raw.githubusercontent.com/docker-library/docs/$logoCommit/$logoFile)" + fi + fi + + compose= + composeYml= + if [ -f "$repo/docker-compose.yml" ]; then + compose="$(cat "$repo/compose.md" 2>/dev/null || cat "$helperDir/compose.md")" + composeYml=$'```yaml\n'"$(cat "$repo/docker-compose.yml")"$'\n```' + fi + + deprecated= + if [ -f "$repo/deprecated.md" ]; then + deprecated=$'# **DEPRECATED**\n\n' + deprecated+="$(cat "$repo/deprecated.md")" + deprecated+=$'\n\n' + fi + + { echo -n "$deprecated"; cat "$helperDir/template.md"; } > "$repo/README.md" + + echo ' TAGS => generate-dockerfile-links-partial.sh' + partial="$("$helperDir/generate-dockerfile-links-partial.sh" "$repo")" + [ "$partial" ] + replace_field "$repo" 'TAGS' "$partial" + + echo ' CONTENT => '"$repo"'/content.md' + replace_field "$repo" 'CONTENT' "$(cat "$repo/content.md")" + + echo ' VARIANT => variant.sh' + replace_field "$repo" 'VARIANT' "$("$helperDir/variant.sh" "$repo")" + + # has to be after CONTENT because it's contained in content.md + echo " LOGO => $logo" + replace_field "$repo" 'LOGO' "$logo" '\s*' + + echo ' COMPOSE => '"$repo"'/compose.md' + replace_field "$repo" 'COMPOSE' "$compose" + + echo ' COMPOSE-YML => '"$repo"'/docker-compose.yml' + replace_field "$repo" 'COMPOSE-YML' "$composeYml" + + echo ' DOCKER-VERSIONS => '"$repo"'/docker-versions.md' + replace_field "$repo" 'DOCKER-VERSIONS' "$dockerVersions" + + echo ' DOCKER-LATEST => "'"$dockerLatest"'"' + replace_field "$repo" 'DOCKER-LATEST' "$dockerLatest" + + echo ' LICENSE => '"$repo"'/license.md' + replace_field "$repo" 'LICENSE' "$license" + + echo ' USER-FEEDBACK => '"$repo"'/user-feedback.md' + replace_field "$repo" 'USER-FEEDBACK' "$userFeedback" + + echo ' REPO => "'"$repo"'"' + replace_field "$repo" 'REPO' "$repo" + + echo ' GITHUB-REPO => "'"$githubRepo"'"' + replace_field "$repo" 'GITHUB-REPO' "$githubRepo" + + echo + else + echo >&2 "skipping $repo: missing repo/content.md" + fi +done diff --git a/agent/ubuntu/run_zabbix_component.sh b/agent/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/agent/ubuntu/run_zabbix_component.sh +++ b/agent/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/java-gateway/alpine/run_zabbix_component.sh b/java-gateway/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/java-gateway/alpine/run_zabbix_component.sh +++ b/java-gateway/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/java-gateway/ubuntu/run_zabbix_component.sh b/java-gateway/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/java-gateway/ubuntu/run_zabbix_component.sh +++ b/java-gateway/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/proxy-mysql/alpine/run_zabbix_component.sh b/proxy-mysql/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/proxy-mysql/alpine/run_zabbix_component.sh +++ b/proxy-mysql/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/proxy-mysql/ubuntu/run_zabbix_component.sh b/proxy-mysql/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/proxy-mysql/ubuntu/run_zabbix_component.sh +++ b/proxy-mysql/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/proxy-sqlite3/alpine/run_zabbix_component.sh b/proxy-sqlite3/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/proxy-sqlite3/alpine/run_zabbix_component.sh +++ b/proxy-sqlite3/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/proxy-sqlite3/ubuntu/run_zabbix_component.sh b/proxy-sqlite3/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/proxy-sqlite3/ubuntu/run_zabbix_component.sh +++ b/proxy-sqlite3/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/server-mysql/alpine/run_zabbix_component.sh b/server-mysql/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/server-mysql/alpine/run_zabbix_component.sh +++ b/server-mysql/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/server-mysql/ubuntu/run_zabbix_component.sh b/server-mysql/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/server-mysql/ubuntu/run_zabbix_component.sh +++ b/server-mysql/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/server-pgsql/alpine/run_zabbix_component.sh b/server-pgsql/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/server-pgsql/alpine/run_zabbix_component.sh +++ b/server-pgsql/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/server-pgsql/ubuntu/run_zabbix_component.sh b/server-pgsql/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/server-pgsql/ubuntu/run_zabbix_component.sh +++ b/server-pgsql/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/web-apache-mysql/alpine/run_zabbix_component.sh b/web-apache-mysql/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/web-apache-mysql/alpine/run_zabbix_component.sh +++ b/web-apache-mysql/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/web-apache-mysql/ubuntu/run_zabbix_component.sh b/web-apache-mysql/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/web-apache-mysql/ubuntu/run_zabbix_component.sh +++ b/web-apache-mysql/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/web-nginx-mysql/alpine/run_zabbix_component.sh b/web-nginx-mysql/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/web-nginx-mysql/alpine/run_zabbix_component.sh +++ b/web-nginx-mysql/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/web-nginx-mysql/ubuntu/run_zabbix_component.sh b/web-nginx-mysql/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/web-nginx-mysql/ubuntu/run_zabbix_component.sh +++ b/web-nginx-mysql/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/web-nginx-pgsql/alpine/run_zabbix_component.sh b/web-nginx-pgsql/alpine/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/web-nginx-pgsql/alpine/run_zabbix_component.sh +++ b/web-nginx-pgsql/alpine/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." diff --git a/web-nginx-pgsql/ubuntu/run_zabbix_component.sh b/web-nginx-pgsql/ubuntu/run_zabbix_component.sh index 7207536f2..25633c209 100755 --- a/web-nginx-pgsql/ubuntu/run_zabbix_component.sh +++ b/web-nginx-pgsql/ubuntu/run_zabbix_component.sh @@ -307,8 +307,6 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" - cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ @@ -331,7 +329,7 @@ create_db_schema_postgresql() { local type=$1 DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = - c.relnamespace WHERE n.nspname = '${DB_SERVER_DBNAME}' AND c.relname = 'dbversion'") + c.relnamespace WHERE n.nspname = 'public' AND c.relname = 'dbversion'") if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists." From 0618ea2ca20aa0d5cb2b89079fef1b87aaefd875 Mon Sep 17 00:00:00 2001 From: dotneft Date: Wed, 3 Aug 2016 11:31:02 -0700 Subject: [PATCH 2/2] Fixed schema name for PostgreSQL --- agent/alpine/update.sh | 126 ----------------------------------------- 1 file changed, 126 deletions(-) delete mode 100755 agent/alpine/update.sh diff --git a/agent/alpine/update.sh b/agent/alpine/update.sh deleted file mode 100755 index 196ce3628..000000000 --- a/agent/alpine/update.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -set -eo pipefail - -cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -helperDir='.template-helpers' - -repos=( "$@" ) -if [ ${#repos[@]} -eq 0 ]; then - repos=( */ ) -fi -repos=( "${repos[@]%/}" ) - -replace_field() { - repo="$1" - field="$2" - content="$3" - extraSed="${4:-}" - sed_escaped_value="$(echo "$content" | sed 's/[\/&]/\\&/g')" - sed_escaped_value="${sed_escaped_value//$'\n'/\\n}" - sed -ri "s/${extraSed}%%${field}%%${extraSed}/$sed_escaped_value/g" "$repo/README.md" -} - -dockerLatest="$(curl -fsSL 'https://get.docker.com/latest')" - -for repo in "${repos[@]}"; do - if [ -x "$repo/update.sh" ]; then - ( set -x; "$repo/update.sh" ) - fi - - if [ -e "$repo/content.md" ]; then - githubRepo="$(cat "$repo/github-repo")" - - mailingList="$(cat "$repo/mailing-list.md" 2>/dev/null || true)" - if [ "$mailingList" ]; then - mailingList=" $mailingList " - else - mailingList=' ' - fi - - dockerVersions="$(cat "$repo/docker-versions.md" 2>/dev/null || cat "$helperDir/docker-versions.md")" - - userFeedback="$(cat "$repo/user-feedback.md" 2>/dev/null || cat "$helperDir/user-feedback.md")" - - license="$(cat "$repo/license.md" 2>/dev/null || true)" - if [ "$license" ]; then - license=$'\n\n''# License'$'\n\n'"$license" - fi - - logo= - logoFile= - for f in png svg; do - if [ -e "$repo/logo.$f" ]; then - logoFile="$repo/logo.$f" - break - fi - done - if [ "$logoFile" ]; then - logoCommit="$(git log -1 --format='format:%H' -- "$logoFile" 2>/dev/null || true)" - [ "$logoCommit" ] || logoCommit='master' - if [ "${logoFile##*.}" = 'svg' ]; then - logo="![logo](https://rawgit.com/docker-library/docs/$logoCommit/$logoFile)" - else - logo="![logo](https://raw.githubusercontent.com/docker-library/docs/$logoCommit/$logoFile)" - fi - fi - - compose= - composeYml= - if [ -f "$repo/docker-compose.yml" ]; then - compose="$(cat "$repo/compose.md" 2>/dev/null || cat "$helperDir/compose.md")" - composeYml=$'```yaml\n'"$(cat "$repo/docker-compose.yml")"$'\n```' - fi - - deprecated= - if [ -f "$repo/deprecated.md" ]; then - deprecated=$'# **DEPRECATED**\n\n' - deprecated+="$(cat "$repo/deprecated.md")" - deprecated+=$'\n\n' - fi - - { echo -n "$deprecated"; cat "$helperDir/template.md"; } > "$repo/README.md" - - echo ' TAGS => generate-dockerfile-links-partial.sh' - partial="$("$helperDir/generate-dockerfile-links-partial.sh" "$repo")" - [ "$partial" ] - replace_field "$repo" 'TAGS' "$partial" - - echo ' CONTENT => '"$repo"'/content.md' - replace_field "$repo" 'CONTENT' "$(cat "$repo/content.md")" - - echo ' VARIANT => variant.sh' - replace_field "$repo" 'VARIANT' "$("$helperDir/variant.sh" "$repo")" - - # has to be after CONTENT because it's contained in content.md - echo " LOGO => $logo" - replace_field "$repo" 'LOGO' "$logo" '\s*' - - echo ' COMPOSE => '"$repo"'/compose.md' - replace_field "$repo" 'COMPOSE' "$compose" - - echo ' COMPOSE-YML => '"$repo"'/docker-compose.yml' - replace_field "$repo" 'COMPOSE-YML' "$composeYml" - - echo ' DOCKER-VERSIONS => '"$repo"'/docker-versions.md' - replace_field "$repo" 'DOCKER-VERSIONS' "$dockerVersions" - - echo ' DOCKER-LATEST => "'"$dockerLatest"'"' - replace_field "$repo" 'DOCKER-LATEST' "$dockerLatest" - - echo ' LICENSE => '"$repo"'/license.md' - replace_field "$repo" 'LICENSE' "$license" - - echo ' USER-FEEDBACK => '"$repo"'/user-feedback.md' - replace_field "$repo" 'USER-FEEDBACK' "$userFeedback" - - echo ' REPO => "'"$repo"'"' - replace_field "$repo" 'REPO' "$repo" - - echo ' GITHUB-REPO => "'"$githubRepo"'"' - replace_field "$repo" 'GITHUB-REPO' "$githubRepo" - - echo - else - echo >&2 "skipping $repo: missing repo/content.md" - fi -done