Projects
Kolab:3.4
cyrus-imapd
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 133
View file
cyrus-imapd.cvt_cyrusdb_all
Changed
@@ -1,6 +1,11 @@ #!/bin/bash # Simplified version of Simon Matter's cvt_cyrusdb_all. +function usage() { + echo "Usage: $0 [-C <altconfig>] [--verbose] [--devel] <export|import>" + exit 1 +} + [ -f "/etc/sysconfig/cyrus-imapd" ] && \ . /etc/sysconfig/cyrus-imapd @@ -23,6 +28,8 @@ alt_config="/etc/imapd.conf" devel_mode=0 +verbose_mode=0 +mode="" while [ $# -gt 0 ]; do case $1 in @@ -36,9 +43,31 @@ shift ;; + --verbose) + verbose_mode=1 + shift + ;; + + export|import) + mode=$1 + shift + ;; + + *) + usage + ;; + esac done +if [ -z "${mode}" ]; then + usage +fi + +if [ ${devel_mode} -eq 1 ]; then + verbose_mode=1 +fi + declare -a dbs declare -a db_paths @@ -83,7 +112,6 @@ db_tech=$2 if [ ! -f "${db_path}" ]; then -# echo "No such file or directory '${db_path}'" return 1 fi @@ -93,7 +121,6 @@ } function convert_database() { -# echo "Converting $1 from $2 to $3 using $4" retval=$(${cvt_cyrusdb} -C ${alt_config} "$1" "$2" "$3" "$4" >/dev/null 2>&1; echo $?) chown cyrus:mail "$3" } @@ -126,12 +153,10 @@ fi if [ -z "${value}" ]; then -# echo "Cannot determine $1_path" return 1 fi if [ ! -f "${value}" ]; then -# echo "No such file or directory '${value}'" return 1 fi @@ -152,7 +177,9 @@ config_directory=$(get_config "configdirectory") -echo "Using configuration directory: '${config_directory}'" +if [ ${devel_mode} -eq 1 ]; then + echo "Using configuration directory: '${config_directory}'" +fi x=0 while [ ${x} -lt ${#dbs[@]} ]; do @@ -160,10 +187,14 @@ default=$(get_config_default "${dbs[${x}]}") current=$(get_current "${dbs[${x}]}" "${db_paths[${x}]}") - echo -n "${dbs[${x}]}: " + if [ ${verbose_mode} -eq 1 ]; then + echo -n "${dbs[${x}]}: " + fi if [ $? -ne 0 ]; then - echo "SKIPPED" + if [ ${verbose_mode} -eq 1 ]; then + echo "SKIPPED" + fi let x++ continue fi @@ -174,7 +205,9 @@ fi if [ "${config}" == "${default}" -a "${config}" == "${current}" ]; then - echo "SKIPPED (unchanged)" + if [ ${verbose_mode} -eq 1 ]; then + echo "SKIPPED (unchanged)" + fi let x++ continue fi @@ -182,28 +215,38 @@ db_path=$(expand_db_path "${db_paths[${x}]}") if [ ! -f "${db_path}" ]; then - echo "SKIPPED (No such file or directory '${db_path}')" + if [ ${verbose_mode} -eq 1 ]; then + echo "SKIPPED (No such file or directory '${db_path}')" + fi let x++ continue fi if [ "${current}" != "${default}" ]; then - echo -n "to default(1), " + if [ ${devel_mode} -eq 1 ]; then + echo -n "to default(1), " + fi convert_database "${db_path}" "${current}" "${db_path}.${default}" "${default}" fi if [ "${current}" != "${config}" ]; then mv "${db_path}" "${db_path}.${current}" if [ "${current}" != "${default}" ]; then - echo -n "to default(2), " + if [ ${devel_mode} -eq 1 ]; then + echo -n "to default(2), " + fi convert_database "${db_path}.${current}" "${current}" "${db_path}.${default}" "${default}" fi - echo -n "to config(1), " + if [ ${devel_mode} -eq 1 ]; then + echo -n "to config(1), " + fi convert_database "${db_path}.${current}" "${current}" "${db_path}" "${config}" fi - echo "OK" + if [ ${verbose_mode} -eq 1 ]; then + echo "OK" + fi let x++ done
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.