diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-01-04 20:45:39 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-01-04 20:45:39 +0100 |
commit | 0d10205772b2745356969176de6f52510527e5a6 (patch) | |
tree | 1cdbc2075815fa88a0b80818174542e00a41f855 /bin | |
parent | 28fbc218f45b35527ea5e25d5f62c388fc02b5e1 (diff) |
Add more scripts
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/extra/mariadb-adduser | 25 | ||||
-rwxr-xr-x | bin/extra/oclipp | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/bin/extra/mariadb-adduser b/bin/extra/mariadb-adduser new file mode 100755 index 0000000..d4e1b45 --- /dev/null +++ b/bin/extra/mariadb-adduser @@ -0,0 +1,25 @@ +#!/bin/sh +if [ "$(id -u)" -ne 0 ] +then + >&2 printf "Not root.\n" + exit 1 +fi + +printf 'name? ' +name="$(head -n 1)" +printf 'password? ' +password="$(head -n 1)" +printf 'database? ' +database="$(head -n 1)" + +( + cat <<EOF + CREATE USER '$name'@'%' IDENTIFIED BY '$password'; +EOF + [ "$database" ] && cat <<EOF + GRANT ALL PRIVILEGES ON `$database`.* TO '$name'@'%' WITH GRANT OPTION; + CREATE DATABASE `$database`; + FLUSH PRIVILEGES; +EOF + +) | mariadb diff --git a/bin/extra/oclipp b/bin/extra/oclipp new file mode 100755 index 0000000..b711385 --- /dev/null +++ b/bin/extra/oclipp @@ -0,0 +1,2 @@ +#!/bin/sh +printf "\033]52;c;%s\a" "$(cat | base64)" |