diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2018-12-11 18:10:48 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2018-12-11 18:10:48 +0300 |
commit | 8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3 (patch) | |
tree | d03b70f693463fc836a8dbe4240424d2547530c8 /modules/pkgs/rdsdump | |
parent | c4273035cf5876e3ba8ed2c6b492d31c2de290ee (diff) | |
download | nixsap-8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3.tar.gz |
(* HUGE *) Use nixpkgs overlays
Diffstat (limited to 'modules/pkgs/rdsdump')
-rw-r--r-- | modules/pkgs/rdsdump/default.nix | 17 | ||||
-rw-r--r-- | modules/pkgs/rdsdump/rdsdump.bash | 70 |
2 files changed, 0 insertions, 87 deletions
diff --git a/modules/pkgs/rdsdump/default.nix b/modules/pkgs/rdsdump/default.nix deleted file mode 100644 index 5d9b024..0000000 --- a/modules/pkgs/rdsdump/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenv, bash, mysql, makeWrapper }: - -stdenv.mkDerivation { - name = "rdsdump"; - buildInputs = [ bash ]; - phases = [ "installPhase" ]; - nativeBuildInputs = [ makeWrapper ]; - installPhase = '' - mkdir -p $out/bin - cp -a ${./rdsdump.bash} $out/bin/rdsdump - chmod +x $out/bin/rdsdump - patchShebangs $out/bin/rdsdump - wrapProgram "$out/bin/rdsdump" \ - --prefix PATH : '${mysql.client.bin}/bin' - ''; -} - diff --git a/modules/pkgs/rdsdump/rdsdump.bash b/modules/pkgs/rdsdump/rdsdump.bash deleted file mode 100644 index 6b8cbf1..0000000 --- a/modules/pkgs/rdsdump/rdsdump.bash +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -mysql_args= -mysqldump_args= -master_data=0 -while [ $# -gt 0 ]; do - case $1 in - --host=*|--password=*|--user=*|\ - --defaults-file=*|--defaults-extra-file=*|\ - --ssl=*|--ssl-ca=*|--ssl-key=*|--ssl-cert=*|\ - -h?*|-u?*|-p?*) - mysql_args="$mysql_args $1" - mysqldump_args="$mysqldump_args $1" - shift 1;; - --host|--user|\ - --defaults-file|--defaults-extra-file|\ - --ssl-ca|--ssl-key|--ssl-cert|\ - -h|-u) - mysql_args="$mysql_args $1 $2" - mysqldump_args="$mysqldump_args $1 $2" - shift 2;; - --master-data=*) - master_data=$(echo "$1" | cut -d= -f2) - shift;; - --master-data) - master_data=$2 - shift 2;; - *) - mysqldump_args="$mysqldump_args $1" - shift;; - esac -done - -replica () { - mysql $mysql_args "$@" -} - -start_replication () { - replica -N -e "CALL mysql.rds_start_replication;" >&2 -} - -stop_replication () { - replica -N -e "CALL mysql.rds_stop_replication;" >&2 -} - -trap 'start_replication' EXIT -stop_replication - -if [ "$master_data" -gt 0 ]; then -if [ "$master_data" -eq 2 ]; then - printf '-- ' -fi -replica -e 'SHOW SLAVE STATUS\G' | awk -f <(cat - <<- 'AWK' - /\<Exec_Master_Log_Pos\>/ { log_pos = $2 }; - /\<Relay_Master_Log_File\>/ { log_file = $2 }; - END { - printf "CHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%d;\n", log_file, log_pos - } -AWK -) -fi - -mysqldump $mysqldump_args & -sleep 30 - -start_replication -trap - EXIT - -wait |