all : fix inputrc + mysql : add createdb script
This commit is contained in:
parent
775cfba38c
commit
300de09c5a
32
pluie/alpine-mysql/createdb.sh
Normal file
32
pluie/alpine-mysql/createdb.sh
Normal file
|
@ -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 <<EOF > $tfile
|
||||
CREATE DATABASE IF NOT EXISTS \`$dbname\` CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
EOF
|
||||
|
||||
if [ ! -z "$dbuser" ]; then
|
||||
cat <<EOF >> $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
|
||||
|
13
pluie/alpine/install.d/20-inputrc.sh
Normal file
13
pluie/alpine/install.d/20-inputrc.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Keyboard shortcut : Ctrl+x followed by desired key
|
||||
# refresh without bash logout : bind -f ~/.inputrc
|
||||
|
||||
cat <<EOF > /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
|
Loading…
Reference in New Issue
Block a user