+ correct FS-flags on citadel.co* on startup
authorWilfried Göesgens <willi@citadel.org>
Wed, 25 Feb 2009 22:06:38 +0000 (22:06 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 25 Feb 2009 22:06:38 +0000 (22:06 +0000)
+ separate automatical generated config files
* move these automatic generated files to /var/lib/citadel/data in the debian build
* move citadel.control and citadel.config on upgrade if we find them in the old location.

citadel/citadel_dirs.c
citadel/citadel_dirs.h
citadel/configure.ac
citadel/control.c
citadel/debian/citadel-server.postinst
citadel/debian/rules

index fe187f019d017495b2ffccb622d04f41deeef3bf..9d7085bb711ad3b6a0b0c263836968a20a7b1b1f 100644 (file)
@@ -40,6 +40,7 @@ char ctdl_message_dir[PATH_MAX]="messages";
 char ctdl_usrpic_dir[PATH_MAX]="userpics";
 char ctdl_bbsbase_dir[PATH_MAX]="";
 char ctdl_etc_dir[PATH_MAX]="";
+char ctdl_autoetc_dir[PATH_MAX]="";
 /* attention! this may be non volatile on some oses */
 char ctdl_run_dir[PATH_MAX]="";
 char ctdl_spool_dir[PATH_MAX]="network";
@@ -133,6 +134,15 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
 #endif
        StripSlashes(ctdl_sbin_dir, 1);
        StripSlashes(ctdl_bin_dir, 1);
+
+#ifndef HAVE_AUTO_ETC_DIR
+       basedir=ctdldir;
+#else
+       basedir=AUTO_ETC_DIR;
+#endif
+       COMPUTE_DIRECTORY(ctdl_autoetc_dir);
+       StripSlashes(ctdl_autoetc_dir, 1);
+
 #ifndef HAVE_ETC_DIR
        basedir=ctdldir;
 #else
@@ -218,18 +228,18 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        snprintf(file_arcq, 
                         sizeof file_arcq,
                         "%srefcount_adjustments.dat",
-                        ctdl_etc_dir);
+                        ctdl_autoetc_dir);
        StripSlashes(file_arcq, 0);
        snprintf(file_citadel_control, 
                         sizeof file_citadel_control,
                         "%scitadel.control",
-                        ctdl_etc_dir
+                        ctdl_autoetc_dir
                         );
        StripSlashes(file_citadel_control, 0);
        snprintf(file_citadel_config, 
                         sizeof file_citadel_config,
                         "%scitadel.config",
-                        ctdl_etc_dir);
+                        ctdl_autoetc_dir);
        StripSlashes(file_citadel_config, 0);
        snprintf(file_citadel_rc, 
                         sizeof file_citadel_rc,
index 4c2d67ffc8bfa59a6b451d8857566b7559d29159..897986d6d5a330c752682df42e790913ea5d271f 100644 (file)
@@ -20,6 +20,7 @@ extern char ctdl_key_dir[PATH_MAX];
 extern char ctdl_message_dir[PATH_MAX];
 extern char ctdl_usrpic_dir[PATH_MAX];
 extern char ctdl_etc_dir[PATH_MAX];
+extern char ctdl_autoetc_dir[PATH_MAX];
 extern char ctdl_run_dir[PATH_MAX];
 extern char ctdl_spool_dir[PATH_MAX];
 extern char ctdl_netout_dir[PATH_MAX];
index 84d935cf56f82264fd757bfac0f48e6d16238e9e..6a59d0076ffd906f236a153c213dc59258819f52 100644 (file)
@@ -95,6 +95,18 @@ AC_ARG_WITH(sysconfdir,
                        ]
 )
 
+dnl Checks for the Configdir
+AC_ARG_WITH(autosysconfdir, 
+                       [  --with-autosysconfdir         directory to store the automaticaly maintained configs under],
+                       [ if test "x$withval" != "xno" ; then
+                                           AC_DEFINE(HAVE_AUTO_ETC_DIR, [], [should we search our automatic config in an alternate place?])
+                                               AC_DEFINE_UNQUOTED(AUTO_ETC_DIR, "$withval", [where to search our automatic config files])
+                                               MAKE_AUTO_ETC_DIR=$withval
+                                               AC_SUBST(MAKE_AUTO_ETC_DIR)
+                         fi
+                       ]
+)
+
 dnl Checks for where to put our utilities
 AC_ARG_WITH(utility-bindir, 
                        [  --with-utility-bindir   directory where to find helper binaries],
index 305ed3d2332c2f0ee2b1a9b6b459ec452b8731ca..03ffa7c75d09917455cd31fdf42cf427ba146414 100644 (file)
@@ -164,6 +164,8 @@ void get_control(void)
                if (control_fp != NULL) {
                        lock_control();
                        fchown(fileno(control_fp), config.c_ctdluid, -1);
+                       fchmod(fileno(control_fp), 
+                              S_IRUSR|S_IWUSR);
                }
        }
        if (control_fp == NULL) {
@@ -171,6 +173,8 @@ void get_control(void)
                if (control_fp != NULL) {
                        lock_control();
                        fchown(fileno(control_fp), config.c_ctdluid, -1);
+                       fchmod(fileno(control_fp), 
+                              S_IRUSR|S_IWUSR);
                        memset(&CitControl, 0, sizeof(struct CitControl));
                        fwrite(&CitControl, sizeof(struct CitControl),
                               1, control_fp);
@@ -188,6 +192,7 @@ void get_control(void)
        fread(&CitControl, sizeof(struct CitControl), 1, control_fp);
        already_have_control = 1;
        chown(file_citadel_control, config.c_ctdluid, (-1));
+       
 }
 
 /*
index f9120899d22e14caefdbdd614eaa9106aa92382d..25663616f114dec3bdf5fce8c75cedbf4ff0ad03 100644 (file)
@@ -40,6 +40,17 @@ case "$1" in
 #This is not debian conformant, and uniq to the citadel.org debs.
        export ALTER_ETC_SERVICES=yes
 #
+        if test -S /var/run/citadel/citadel.socket; then 
+            /usr/sbin/sendcommand "DOWN"
+        fi
+        while test -S /var/run/citadel/citadel.socket; do 
+            sleep 1
+        done
+       if test ! -f /var/lib/citadel/data/citadel.control -a -f /etc/citadel/citadel.control; then
+           mv /etc/citadel/citadel.control /var/lib/citadel/data/
+           mv /etc/citadel/citadel.config /var/lib/citadel/data/
+       fi
+
         echo -n "applying your settings.... "
         /usr/lib/citadel-server/setup -q
        echo "done"
index d3a750c08744b7e41500ec1b6f8f7d7ae0a63e56..e29c9d0e5a704eb1e9a0918656bfbdc0631e6b08 100755 (executable)
@@ -50,6 +50,7 @@ configure-stamp:
                --with-staticdatadir=/etc/citadel/ \
                --with-ssldir=/etc/ssl/citadel/ \
                --with-utility-bindir=/usr/lib/citadel-server/ \
+               --with-autosysconfdir=/var/lib/citadel/data/ \
                --with-pam \
                --with-db \
                --with-zlib \