3 MYSQL
='mysql -u admin '
8 if [ "$UID" != 0 ] && [ "$1" != "-u" ] ; then
9 echo "has to be run as root"
13 if [[ -n
"${DBPREFIX}" ]]; then
14 echo "Using non-default database ${DBPREFIX}x4dat."
16 if [[ -z
"${DATABASE}" ]]; then
17 DATABASE
="${DBPREFIX}x4dat"
26 if [[ -n
"${NO_CONFIRM}" ]]; then
28 echo "* press ^C to cancel, waiting 5 seconds..."
32 echo "* press ^D to start import (^C to cancel)"
37 function mysql_pipe
() {
38 sed -e
"s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" |
$MYSQL $DATABASE
41 function mysql_exec
() {
42 echo -n
" * executing $1 "
43 if [[ -z
"${DRY_RUN}" ]]; then
44 (echo "$1" | mysql_pipe
) || die
"ERROR"
49 function mysql_pipe_nodb
() {
50 sed -e
"s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" |
$MYSQL
53 function mysql_exec_nodb
() {
54 echo -n
" * executing $1 "
55 if [[ -z
"${DRY_RUN}" ]]; then
56 (echo "$1" | mysql_pipe_nodb
) || die
"ERROR"
61 function mysql_run
() {
62 echo -n
" * running $1 "
63 if [[ -z
"${DRY_RUN}" ]]; then
64 (cat "$1" | mysql_pipe
) || die
"ERROR"
69 function mysql_run_directory
() {
70 for sql
in $1/*.sql
; do
75 function script_run
() {
76 echo -n
" * running $1 "
77 if [[ -z
"${DRY_RUN}" ]]; then
83 function mailman_stop
() {
84 echo -n
" * stops mailman"
85 if [[ -z
"${DRY_RUN}" ]]; then
86 /etc
/init.d
/mailman stop
&>/dev
/null
91 function mailman_templates
() {
92 echo -n
" * copies new mails templates"
93 if [[ -z
"${DRY_RUN}" ]]; then
94 mkdir
-p
/etc
/mailman
/xorg
95 cp -f ..
/..
/modules
/lists
/mail_templates
/*.txt
/etc
/mailman
/xorg
100 function mailman_start
() {
101 echo -n
" * starts mailman"
102 if [[ -z
"${DRY_RUN}" ]]; then
103 /etc
/init.d
/mailman start
&>/dev
/null