Re: [PATCH] Allow storing mc configuration in /etc/mc
- From: Pavel Tsekov <ptsekov gmx net>
- To: MC dev <mc-devel gnome org>
- Subject: Re: [PATCH] Allow storing mc configuration in /etc/mc
- Date: Sun, 6 May 2007 15:03:54 +0300 (EEST)
On Thu, 18 May 2006, Pavel Tsekov wrote:
On Thu, 18 May 2006, Oswald Buddenhagen wrote:
On Thu, May 18, 2006 at 04:09:00PM +0300, Pavel Tsekov wrote:
On Thu, 18 May 2006, Jindrich Novy wrote:
On Wed, 2006-05-17 at 23:36 +0300, Pavel Tsekov wrote:
I think the patch is pretty straigth forward. I am not really sure
that we want to check both mc_home and mc_home_alt though. Anyway,
if noone objects I'll commit this patch.
I would keep both checks for a while to not to break mc when someone
decides he wants the configs in one place as it used to be
(/usr/share/mc). On the other hand we could remove the dual checks
after some time when the most of the mc users are aware of the
change. I can write a patch for it as well then.
I don't want to start a big discussion about it - either way it is
acceptable. I just occured to me that it may be confusing for the end
user if both paths are checked.
you bet it is. for example, suse-packaged kdm has a long track record of
confusing the hell out of users with this approach.
i'd much prefer a clean switch to sysconfdir, which is presumably what
the debian packaging does.
Oswald, your advice is always appreciated. Let's see what the rest of the MC
developes think about that patch and whether Jindrich is willing to change
his patch.
If there are no objections I'll apply this patch. It moves the
files listed below to $(sysconfdir)/mc as the original patch
by Jindrich does:
extfs/extfs.ini
extfs/sfs.ini
syntax/Syntax
cedit.menu
edit.indent.rc
edit.spell.rc
mc.charsets
mc.ext
mc.lib
mc.menu
Unlike Jindrich's patch it doesn't support both $(sysconfdir)/mc and
$(pkgdatadir) locations. The semantics of `mc_home' remain the same
. It just replaces `mc_home' with SYSCONFDIR where appropriate.
Please, review it and let me know whether to commit.
Index: src/Makefile.am
===================================================================
RCS file: /sources/mc/mc/src/Makefile.am,v
retrieving revision 1.49
diff -u -p -r1.49 Makefile.am
--- src/Makefile.am 4 Feb 2006 11:13:30 -0000 1.49
+++ src/Makefile.am 6 May 2007 11:48:11 -0000
@@ -8,9 +8,11 @@ bin_PROGRAMS = mc mcmfmt
if CONS_SAVER
pkglibexec_PROGRAMS = cons.saver
AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \
- -DSAVERDIR=\""$(pkglibexecdir)"\"
+ -DSAVERDIR=\""$(pkglibexecdir)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\"
else
-AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
+AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\"
endif
noinst_PROGRAMS = man2hlp
Index: src/charsets.c
===================================================================
RCS file: /sources/mc/mc/src/charsets.c,v
retrieving revision 1.23
diff -u -p -r1.23 charsets.c
--- src/charsets.c 27 May 2005 03:35:15 -0000 1.23
+++ src/charsets.c 6 May 2007 11:48:11 -0000
@@ -44,11 +44,10 @@ load_codepages_list (void)
FILE *f;
char *fname;
char buf[256];
- extern char *mc_home;
extern int display_codepage;
char *default_codepage = NULL;
- fname = concat_dir_and_file (mc_home, CHARSETS_INDEX);
+ fname = concat_dir_and_file (SYSCONFDIR, CHARSETS_INDEX);
if (!(f = fopen (fname, "r"))) {
fprintf (stderr, _("Warning: file %s not found\n"), fname);
g_free (fname);
Index: src/cmd.c
===================================================================
RCS file: /sources/mc/mc/src/cmd.c,v
retrieving revision 1.165
diff -u -p -r1.165 cmd.c
--- src/cmd.c 2 May 2007 12:01:13 -0000 1.165
+++ src/cmd.c 6 May 2007 11:48:12 -0000
@@ -563,7 +563,7 @@ void ext_cmd (void)
_(" Which extension file you want to edit? "), 0, 2,
_("&User"), _("&System Wide"));
}
- extdir = concat_dir_and_file (mc_home, MC_LIB_EXT);
+ extdir = concat_dir_and_file (SYSCONFDIR, MC_LIB_EXT);
if (dir == 0){
buffer = concat_dir_and_file (home_dir, MC_USER_EXT);
@@ -593,7 +593,7 @@ menu_edit_cmd (int where)
_("&Local"), _("&Home"), _("&System Wide")
);
- menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
+ menufile = concat_dir_and_file (SYSCONFDIR, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
switch (dir) {
case 0:
@@ -607,7 +607,7 @@ menu_edit_cmd (int where)
break;
case 2:
- buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
+ buffer = g_strdup (menufile);
break;
default:
@@ -666,7 +666,7 @@ edit_syntax_cmd (void)
_(" Which syntax file you want to edit? "), 0, 2,
_("&User"), _("&System Wide"));
}
- extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
+ extdir = concat_dir_and_file (SYSCONFDIR, "syntax" PATH_SEP_STR "Syntax");
if (dir == 0) {
buffer = concat_dir_and_file (home_dir, SYNTAX_FILE);
Index: src/ext.c
===================================================================
RCS file: /sources/mc/mc/src/ext.c,v
retrieving revision 1.79
diff -u -p -r1.79 ext.c
--- src/ext.c 31 Jul 2005 20:29:35 -0000 1.79
+++ src/ext.c 6 May 2007 11:48:12 -0000
@@ -443,7 +443,7 @@ regex_command (const char *filename, con
if (!exist_file (extension_file)) {
g_free (extension_file);
check_stock_mc_ext:
- extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT);
+ extension_file = concat_dir_and_file (SYSCONFDIR, MC_LIB_EXT);
mc_user_ext = 0;
}
data = load_file (extension_file);
@@ -462,12 +462,12 @@ regex_command (const char *filename, con
} else {
char *title =
g_strdup_printf (_(" %s%s file error"),
- mc_home, MC_LIB_EXT);
+ SYSCONFDIR, MC_LIB_EXT);
message (1, title, _("The format of the %smc.ext "
"file has changed with version 3.0. It seems that "
"the installation failed. Please fetch a fresh "
"copy from the Midnight Commander package."),
- mc_home);
+ SYSCONFDIR);
g_free (title);
return 0;
}
@@ -479,7 +479,7 @@ regex_command (const char *filename, con
message (1, title, _("The format of the ~/%s file has "
"changed with version 3.0. You may either want to copy "
"it from %smc.ext or use that file as an example of how "
- "to write it."), MC_USER_EXT, mc_home);
+ "to write it."), MC_USER_EXT, SYSCONFDIR);
g_free (title);
}
}
Index: src/setup.c
===================================================================
RCS file: /sources/mc/mc/src/setup.c,v
retrieving revision 1.92
diff -u -p -r1.92 setup.c
--- src/setup.c 23 Feb 2006 15:32:18 -0000 1.92
+++ src/setup.c 6 May 2007 11:48:17 -0000
@@ -479,7 +487,7 @@ setup_init (void)
profile = concat_dir_and_file (home_dir, PROFILE_NAME);
if (!exist_file (profile)){
- inifile = concat_dir_and_file (mc_home, "mc.ini");
+ inifile = concat_dir_and_file (SYSCONFDIR, "mc.ini");
if (exist_file (inifile)){
g_free (profile);
profile = inifile;
@@ -502,7 +510,7 @@ load_setup (void)
/* mc.lib is common for all users, but has priority lower than
~/.mc/ini. FIXME: it's only used for keys and treestore now */
- global_profile_name = concat_dir_and_file (mc_home, "mc.lib");
+ global_profile_name = concat_dir_and_file (SYSCONFDIR, "mc.lib");
/* Load integer boolean options */
for (i = 0; int_options[i].opt_name; i++)
Index: src/user.c
===================================================================
RCS file: /sources/mc/mc/src/user.c,v
retrieving revision 1.76
diff -u -p -r1.76 user.c
--- src/user.c 10 May 2006 12:14:28 -0000 1.76
+++ src/user.c 6 May 2007 11:48:19 -0000
@@ -724,7 +724,7 @@ user_menu_cmd (struct WEdit *edit_widget
if (!exist_file (menu)){
g_free (menu);
menu = concat_dir_and_file \
- (mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
+ (SYSCONFDIR, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
}
Index: edit/Makefile.am
===================================================================
RCS file: /sources/mc/mc/edit/Makefile.am,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile.am
--- edit/Makefile.am 24 Jul 2005 13:37:58 -0000 1.9
+++ edit/Makefile.am 6 May 2007 11:48:19 -0000
@@ -1,5 +1,7 @@
AM_CFLAGS = $(GLIB_CFLAGS)
+AM_CPPFLAGS = -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\"
+
if USE_EDIT
noinst_LIBRARIES = libedit.a
else
Index: edit/editcmd.c
===================================================================
RCS file: /sources/mc/mc/edit/editcmd.c,v
retrieving revision 1.154
diff -u -p -r1.154 editcmd.c
--- edit/editcmd.c 2 May 2007 11:22:01 -0000 1.154
+++ edit/editcmd.c 6 May 2007 11:48:22 -0000
@@ -2516,7 +2542,7 @@ edit_block_process_cmd (WEdit *edit, con
const char *b = NULL;
char *quoted_name = NULL;
- o = catstrs (mc_home, shell_cmd, (char *) NULL); /* original source script */
+ o = catstrs (SYSCONFDIR, shell_cmd, (char *) NULL); /* original source script */
h = catstrs (home_dir, PATH_SEP_STR EDIT_DIR, shell_cmd, (char *) NULL); /* home script */
b = catstrs (home_dir, PATH_SEP_STR BLOCK_FILE, (char *) NULL); /* block file */
Index: edit/syntax.c
===================================================================
RCS file: /sources/mc/mc/edit/syntax.c,v
retrieving revision 1.81
diff -u -p -r1.81 syntax.c
--- edit/syntax.c 2 Aug 2006 15:18:22 -0000 1.81
+++ edit/syntax.c 6 May 2007 11:48:26 -0000
@@ -1025,7 +1049,7 @@ edit_read_syntax_file (WEdit * edit, cha
f = fopen (syntax_file, "r");
if (!f){
- lib_file = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax");
+ lib_file = concat_dir_and_file (SYSCONFDIR, "syntax" PATH_SEP_STR "Syntax");
f = fopen (lib_file, "r");
g_free (lib_file);
if (!f)
Index: vfs/Makefile.am
===================================================================
RCS file: /sources/mc/mc/vfs/Makefile.am,v
retrieving revision 1.52
diff -u -p -r1.52 Makefile.am
--- vfs/Makefile.am 23 Feb 2006 16:00:13 -0000 1.52
+++ vfs/Makefile.am 6 May 2007 11:48:26 -0000
@@ -12,6 +12,8 @@ else
AM_CFLAGS = $(GLIB_CFLAGS)
endif
+AM_CPPFLAGS = -DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\"
+
BASICFILES = \
cpio.c \
direntry.c \
Index: vfs/extfs.c
===================================================================
RCS file: /sources/mc/mc/vfs/extfs.c,v
retrieving revision 1.125
diff -u -p -r1.125 extfs.c
--- vfs/extfs.c 23 Mar 2006 15:00:50 -0000 1.125
+++ vfs/extfs.c 6 May 2007 11:48:27 -0000
@@ -1294,7 +1294,7 @@ static int extfs_init (struct vfs_class
(void) me;
- mc_extfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini");
+ mc_extfsini = concat_dir_and_file (SYSCONFDIR, "extfs" PATH_SEP_STR "extfs.ini");
cfg = fopen (mc_extfsini, "r");
/* We may not use vfs_die() message or message or similar,
Index: vfs/sfs.c
===================================================================
RCS file: /sources/mc/mc/vfs/sfs.c,v
retrieving revision 1.72
diff -u -p -r1.72 sfs.c
--- vfs/sfs.c 4 Apr 2006 09:26:13 -0000 1.72
+++ vfs/sfs.c 6 May 2007 11:48:27 -0000
@@ -321,7 +321,7 @@ static int sfs_init (struct vfs_class *m
(void) me;
- mc_sfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini");
+ mc_sfsini = concat_dir_and_file (SYSCONFDIR, "extfs" PATH_SEP_STR "sfs.ini");
cfg = fopen (mc_sfsini, "r");
if (!cfg){
Index: vfs/extfs/Makefile.am
===================================================================
RCS file: /sources/mc/mc/vfs/extfs/Makefile.am,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile.am
--- vfs/extfs/Makefile.am 20 Jul 2005 19:03:54 -0000 1.17
+++ vfs/extfs/Makefile.am 6 May 2007 11:48:27 -0000
@@ -1,7 +1,10 @@
extfsdir = $(pkgdatadir)/extfs
+# Configuration files
+EXTFS_CONFIG_FILES = extfs.ini sfs.ini
+
# Files to install and distribute other than extfs scripts
-EXTFS_MISC = README extfs.ini sfs.ini
+EXTFS_MISC = README
# Scripts hat don't need adaptation to the local system
EXTFS_CONST = bpp rpm trpm u7z
@@ -55,9 +58,11 @@ EXTFS_OUT = \
uzoo
if USE_VFS
+pkgsysconfdir = $(sysconfdir)/@PACKAGE@/extfs
+pkgsysconf_DATA = $(EXTFS_CONFIG_FILES)
extfs_DATA = $(EXTFS_MISC)
extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT)
endif
-EXTRA_DIST = $(EXTFS_MISC) $(EXTFS_CONST)
+EXTRA_DIST = $(EXTFS_CONFIG_FILES) $(EXTFS_MISC) $(EXTFS_CONST)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]