From 300de09c5a5075e4d702caaef94d2584eaf7e6e4 Mon Sep 17 00:00:00 2001 From: a-sansara Date: Fri, 29 Jul 2016 15:22:12 +0200 Subject: [PATCH] all : fix inputrc + mysql : add createdb script --- pluie/alpine-mysql/createdb.sh | 32 ++++++++++++++++++++++++++++ pluie/alpine/install.d/20-inputrc.sh | 13 +++++++++++ 2 files changed, 45 insertions(+) create mode 100644 pluie/alpine-mysql/createdb.sh create mode 100644 pluie/alpine/install.d/20-inputrc.sh diff --git a/pluie/alpine-mysql/createdb.sh b/pluie/alpine-mysql/createdb.sh new file mode 100644 index 0000000..1656e6f --- /dev/null +++ b/pluie/alpine-mysql/createdb.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + +dbname=${1:-''} +dbuser=${2:-''} + +echo "dbname : $dbname" +echo "dbuser : $dbuser" + +tfile=`mktemp` +if [ ! -f "$tfile" ]; then + return 1 +fi + +if [ ! -z "$dbname" ]; then + cat < $tfile +CREATE DATABASE IF NOT EXISTS \`$dbname\` CHARACTER SET utf8 COLLATE utf8_general_ci; +EOF + + if [ ! -z "$dbuser" ]; then + cat <> $tfile +GRANT ALL ON \`$dbname\`.* to '$dbuser'@'localhost'; +GRANT ALL ON \`$dbname\`.* to '$dbuser'@'%'; +EOF + fi + + echo "FLUSH PRIVILEGES;" >> $tfile + cat $tfile; + mysql -uroot < $tfile + rm -f $tfile +fi + diff --git a/pluie/alpine/install.d/20-inputrc.sh b/pluie/alpine/install.d/20-inputrc.sh new file mode 100644 index 0000000..5eb4b97 --- /dev/null +++ b/pluie/alpine/install.d/20-inputrc.sh @@ -0,0 +1,13 @@ +# Keyboard shortcut : Ctrl+x followed by desired key +# refresh without bash logout : bind -f ~/.inputrc + +cat < /etc/inputrc +"\e[1;5C": forward-word # ctrl + right +"\e[1;5D": backward-word # ctrl + left +"\e[1~": beginning-of-line # home +"\e[3~": delete-char # delete +"\e[4~": end-of-line # end +"\e[5~": history-search-backward # page-up +"\e[6~": history-search-forward # page-down +EOF +bind -f /etc/inputrc