diff options
author | Tom Willemse | 2013-07-22 23:01:45 +0200 |
---|---|---|
committer | Tom Willemse | 2013-07-22 23:01:45 +0200 |
commit | 1e32fe78f689490cfdeb8bb7b0b33edcfc019946 (patch) | |
tree | 6544ed5f26aa562852a977cbd8c84bf9cea87871 | |
download | utilities-1e32fe78f689490cfdeb8bb7b0b33edcfc019946.tar.gz utilities-1e32fe78f689490cfdeb8bb7b0b33edcfc019946.zip |
Initial commit
-rwxr-xr-x | copydb | 22 | ||||
-rwxr-xr-x | git-dot | 11 | ||||
-rwxr-xr-x | git-etc | 11 | ||||
-rwxr-xr-x | rebasedb | 14 |
4 files changed, 58 insertions, 0 deletions
@@ -0,0 +1,22 @@ +#!/bin/zsh + +echo -n 'Database root PW (for DB creation): ' +read -s ROOTPW +echo + +echo -n 'Database user for new DB: ' +read DBUSER + +echo -n 'Database user PW for new DB: ' +read -s DBPASSW +echo + +mysql -u root -p"$ROOTPW" -B <<EOF +CREATE DATABASE $2; +GRANT ALL ON $2.* to '$DBUSER'@'localhost'; +EOF + +unset ROOTPW + +mysqldump -u "$DBUSER" -p"$DBPASSW" "$1" \ + | mysql -u "$DBUSER" -p"$DBPASSW" "$2" @@ -0,0 +1,11 @@ +#!/bin/zsh + +GITDIR=/home/slash/projects/dotfiles/.git + +if [ ! -d "$GITDIR" ]; then + echo "Cloning dotfiles to $GITDIR" + git clone git@ryuslash.org:dotfiles.git "$GITDIR" +fi + +cd $HOME +git --git-dir "$GITDIR" --work-tree "$HOME" "$@" @@ -0,0 +1,11 @@ +#!/usr/bin/zsh + +GITDIR=/home/slash/projects/etcfiles + +if [ ! -d "$GITDIR" ]; then + echo "Cloning etcfiles to $GITDIR" + git clone git@ryuslash.org:etcfiles.git "$GITDIR" +fi + +cd /etc +git --git-dir "$GITDIR" --work-tree /etc/ "$@" diff --git a/rebasedb b/rebasedb new file mode 100755 index 0000000..6b41fd4 --- /dev/null +++ b/rebasedb @@ -0,0 +1,14 @@ +#!/bin/zsh + +echo -n 'Database root PW (for DB manipulation): ' +read -s ROOTPW +echo + +mysql -u root -p"$ROOTPW" -B <<EOF +DROP DATABASE $2; CREATE DATABASE $2; +EOF +echo "Recreated database $2" + +mysqldump -u root -p"$ROOTPW" "$1" \ + | mysql -u root -p"$ROOTPW" -B "$2" +echo "Copied $1 to $2" |