94cb23bbabc7440c9b45539e7a8fbbd04c7751b5
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_run
() {
50 echo -n
" * running $1 "
51 if [[ -z
"${DRY_RUN}" ]]; then
52 (cat $1 | mysql_pipe
) || die
"ERROR"
57 function mysql_run_directory
() {
58 for sql
in $1/*.sql
; do
63 function script_run
() {
64 echo -n
" * running $1 "
65 if [[ -z
"${DRY_RUN}" ]]; then
71 function mailman_stop
() {
72 echo -n
" * stops mailman"
73 if [[ -z
"${DRY_RUN}" ]]; then
74 /etc
/init.d
/mailman stop
&>/dev
/null
79 function mailman_templates
() {
80 echo -n
" * copies new mails templates"
81 if [[ -z
"${DRY_RUN}" ]]; then
82 mkdir
-p
/etc
/mailman
/xorg
83 cp -f ..
/..
/modules
/lists
/mail_templates
/*.txt
/etc
/mailman
/xorg
88 function mailman_start
() {
89 echo -n
" * starts mailman"
90 if [[ -z
"${DRY_RUN}" ]]; then
91 /etc
/init.d
/mailman start
&>/dev
/null