1
1

Move global config files from pkg_datadir to sysconfdir

* Also fixed 'make dist' command
 * changed contrib/dist/redhat/mc.spec.in for builds with new dir
Этот коммит содержится в:
Slava Zanko 2009-05-21 01:01:10 +03:00
родитель c6b42a7369
Коммит 0c17219b2a
18 изменённых файлов: 143 добавлений и 40 удалений

Просмотреть файл

@ -17,7 +17,9 @@ SCRIPTS_OUT = mc.csh mc.sh mc-wrapper.csh mc-wrapper.sh
suppbin_SCRIPTS = $(SCRIPTS_OUT) suppbin_SCRIPTS = $(SCRIPTS_OUT)
pkgdata_DATA = $(LIBFILES_ADD) cfgdir = $(sysconfdir)/@PACKAGE@
cfg_DATA = \
$(LIBFILES_ADD)
CLEANFILES = $(SCRIPTS_OUT) CLEANFILES = $(SCRIPTS_OUT)
@ -25,7 +27,7 @@ CLEANFILES = $(SCRIPTS_OUT)
EXTRA_DIST = \ EXTRA_DIST = \
$(SCRIPTS_IN) \ $(SCRIPTS_IN) \
$(noinst_DATA) \ $(noinst_DATA) \
mc.charsets $(cfg_DATA)
mc.csh: $(srcdir)/mc.csh.in mc.csh: $(srcdir)/mc.csh.in
sed "s%@""suppbindir@%$(suppbindir)%" $(srcdir)/mc.csh.in > mc.csh sed "s%@""suppbindir@%$(suppbindir)%" $(srcdir)/mc.csh.in > mc.csh

14
contrib/dist/redhat/mc.spec.in поставляемый
Просмотреть файл

@ -15,7 +15,7 @@
Summary: User-friendly text console file manager and visual shell Summary: User-friendly text console file manager and visual shell
Name: mc Name: mc
Version: %rpmver Version: %rpmver
Release: %rel%{?dist} Release: %rel
Epoch: 1 Epoch: 1
License: GPLv2 License: GPLv2
Group: System Environment/Shells Group: System Environment/Shells
@ -77,12 +77,24 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/profile.d/* %{_sysconfdir}/profile.d/*
%config %{_sysconfdir}/mc/Syntax
%config %{_sysconfdir}/mc/mc.charsets
%config %{_sysconfdir}/mc/mc.lib
%config(noreplace) %{_sysconfdir}/mc/*edit*
%config(noreplace) %{_sysconfdir}/mc/mc.ext
%config(noreplace) %{_sysconfdir}/mc/mc.menu
%config(noreplace) %{_sysconfdir}/mc/extfs/extfs.ini
%config(noreplace) %{_sysconfdir}/mc/extfs/sfs.ini
%dir %{_datadir}/mc %dir %{_datadir}/mc
%{_datadir}/mc/* %{_datadir}/mc/*
%dir %{_libexecdir}/mc %dir %{_libexecdir}/mc
%changelog %changelog
* Thu May 21 2009 Slava Zanko <slavazanko@gmail.com>
- Fix install patches: use %{_sysconfdir}/mc directory
* Fri May 8 2009 Slava Zanko <slavazanko@gmail.com> * Fri May 8 2009 Slava Zanko <slavazanko@gmail.com>
- Review spec-file to build on the current distributions - Review spec-file to build on the current distributions
- Change build rules - Change build rules

Просмотреть файл

@ -3,7 +3,8 @@ SUBDIRS = hints man $(DOC_LINGUAS)
pkgdata_DATA = mc.hlp pkgdata_DATA = mc.hlp
EXTRA_DIST = xnc.hlp $(DX_CONFIG) doxygen-include.am DOCS = FAQ HACKING INSTALL INSTALL.FAST MAINTAINERS
EXTRA_DIST = xnc.hlp $(DX_CONFIG) doxygen-include.am $(pkgdata_DATA) $(DOCS)
CLEANFILES = $(pkgdata_DATA) CLEANFILES = $(pkgdata_DATA)
mc.hlp: man/mc.1 $(srcdir)/xnc.hlp $(top_builddir)/src/man2hlp mc.hlp: man/mc.1 $(srcdir)/xnc.hlp $(top_builddir)/src/man2hlp

Просмотреть файл

@ -1880,12 +1880,15 @@ edit_block_process_cmd (WEdit *edit, const char *shell_cmd, int block)
goto edit_block_process_cmd__EXIT; goto edit_block_process_cmd__EXIT;
} }
if (!(script_src = fopen (o, "r"))) { if (!(script_src = fopen (o, "r"))) {
fclose (script_home); o = g_strconcat (mc_home_alt, shell_cmd, (char *) NULL);
unlink (h); if (!(script_src = fopen (o, "r"))) {
tmp = g_strconcat (_("Error reading script:"), o, (char *) NULL); fclose (script_home);
edit_error_dialog ("", get_sys_error (tmp)); unlink (h);
g_free(tmp); tmp = g_strconcat (_("Error reading script:"), o, (char *) NULL);
goto edit_block_process_cmd__EXIT; edit_error_dialog ("", get_sys_error (tmp));
g_free(tmp);
goto edit_block_process_cmd__EXIT;
}
} }
while (fgets (buf, sizeof (buf), script_src)) while (fgets (buf, sizeof (buf), script_src))
fputs (buf, script_home); fputs (buf, script_home);

Просмотреть файл

@ -685,6 +685,15 @@ static FILE *open_include_file (const char *filename)
g_free (error_file_name); g_free (error_file_name);
error_file_name = g_strconcat (mc_home, PATH_SEP_STR "syntax" PATH_SEP_STR, error_file_name = g_strconcat (mc_home, PATH_SEP_STR "syntax" PATH_SEP_STR,
filename, (char *) NULL); filename, (char *) NULL);
if ((f = fopen (error_file_name, "r"))) {
g_free (error_file_name);
return f;
}
g_free (error_file_name);
error_file_name = g_strconcat (mc_home_alt, PATH_SEP_STR "syntax" PATH_SEP_STR,
filename, (char *) NULL);
return fopen (error_file_name, "r"); return fopen (error_file_name, "r");
} }

Просмотреть файл

@ -1,21 +1,31 @@
## Process this file with automake to create Makefile.in. ## Process this file with automake to create Makefile.in.
LIBFILES_OUT = mc.ext LIBFILES_OUT = mc.ext
LIBFILES_CONST = mc.lib mc.menu mc.menu.sr cedit.menu edit.indent.rc \
edit.spell.rc
noinst_DATA = xterm.ad noinst_DATA = xterm.ad
pkgdata_DATA = mc.menu.sr
LIBFILES_CONST = \
cedit.menu \
edit.indent.rc \
edit.spell.rc \
mc.lib \
mc.menu
pkgdata_DATA = $(LIBFILES_CONST) $(LIBFILES_ADD) $(LIBFILES_OUT)
CLEANFILES = $(SCRIPTS_OUT) CLEANFILES = $(SCRIPTS_OUT)
cfgdir = $(sysconfdir)/@PACKAGE@
cfg_DATA = \
$(LIBFILES_CONST) \
$(LIBFILES_OUT) \
$(LIBFILES_ADD)
# Files processed by configure don't need to be here # Files processed by configure don't need to be here
EXTRA_DIST = \ EXTRA_DIST = \
$(LIBFILES_CONST) \ $(LIBFILES_CONST) \
$(SCRIPTS_IN) \ $(SCRIPTS_IN) \
$(noinst_DATA) $(noinst_DATA) \
$(pkgdata_DATA)

Просмотреть файл

@ -10,9 +10,12 @@ bin_PROGRAMS = mc mcmfmt
if CONS_SAVER if CONS_SAVER
pkglibexec_PROGRAMS = cons.saver pkglibexec_PROGRAMS = cons.saver
AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \ AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" \
-DSAVERDIR=\""$(pkglibexecdir)"\" -DSAVERDIR=\""$(pkglibexecdir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\"
else else
AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\" AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)/@PACKAGE@/"\"
endif endif
noinst_PROGRAMS = man2hlp noinst_PROGRAMS = man2hlp

Просмотреть файл

@ -53,12 +53,17 @@ load_codepages_list (void)
char *fname; char *fname;
char buf[256]; char buf[256];
extern char *mc_home; extern char *mc_home;
extern char *mc_home_alt;
extern int display_codepage; extern int display_codepage;
char *default_codepage = NULL; char *default_codepage = NULL;
fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); fname = concat_dir_and_file (mc_home, CHARSETS_INDEX);
if (!(f = fopen (fname, "r"))) { if (!(f = fopen (fname, "r"))) {
fprintf (stderr, _("Warning: file %s not found\n"), fname); g_free (fname);
fname = concat_dir_and_file (mc_home_alt, CHARSETS_INDEX);
if (!(f = fopen (fname, "r"))) {
fprintf (stderr, _("Warning: file %s not found\n"), fname);
}
g_free (fname); g_free (fname);
return -1; return -1;
} }

Просмотреть файл

@ -589,9 +589,13 @@ void ext_cmd (void)
check_for_default (extdir, buffer); check_for_default (extdir, buffer);
do_edit (buffer); do_edit (buffer);
g_free (buffer); g_free (buffer);
} else if (dir == 1) } else if (dir == 1) {
if (!exist_file(extdir)) {
g_free (extdir);
extdir = concat_dir_and_file (mc_home_alt, MC_LIB_EXT);
}
do_edit (extdir); do_edit (extdir);
}
g_free (extdir); g_free (extdir);
flush_extension_file (); flush_extension_file ();
} }
@ -614,6 +618,11 @@ menu_edit_cmd (int where)
menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); menufile = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
if (!exist_file(menufile)) {
g_free (menufile);
menufile = concat_dir_and_file (mc_home_alt, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
switch (dir) { switch (dir) {
case 0: case 0:
buffer = g_strdup (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU); buffer = g_strdup (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU);
@ -627,6 +636,10 @@ menu_edit_cmd (int where)
case 2: case 2:
buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); buffer = concat_dir_and_file (mc_home, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
if (!exist_file(buffer)) {
g_free (buffer);
buffer = concat_dir_and_file (mc_home_alt, where ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
break; break;
default: default:
@ -685,7 +698,7 @@ edit_syntax_cmd (void)
_(" Which syntax file you want to edit? "), D_NORMAL, 2, _(" Which syntax file you want to edit? "), D_NORMAL, 2,
_("&User"), _("&System Wide")); _("&User"), _("&System Wide"));
} }
extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); extdir = concat_dir_and_file (mc_home_alt, "syntax" PATH_SEP_STR "Syntax");
if (dir == 0) { if (dir == 0) {
buffer = concat_dir_and_file (home_dir, SYNTAX_FILE); buffer = concat_dir_and_file (home_dir, SYNTAX_FILE);

Просмотреть файл

@ -453,6 +453,10 @@ regex_command (const char *filename, const char *action, int *move_dir)
g_free (extension_file); g_free (extension_file);
check_stock_mc_ext: check_stock_mc_ext:
extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT);
if (!exist_file (extension_file)) {
g_free (extension_file);
extension_file = concat_dir_and_file (mc_home_alt, MC_LIB_EXT);
}
mc_user_ext = 0; mc_user_ext = 0;
} }
data = load_file (extension_file); data = load_file (extension_file);

Просмотреть файл

@ -287,9 +287,12 @@ int midnight_shutdown = 0;
/* The user's shell */ /* The user's shell */
const char *shell = NULL; const char *shell = NULL;
/* mc_home: The home of MC */ /* mc_home: The home of MC - /etc/mc or defined by MC_DATADIR */
char *mc_home = NULL; char *mc_home = NULL;
/* mc_home_alt: Alternative home of MC - deprecated /usr/share/mc */
char *mc_home_alt = NULL;
char cmd_buf[512]; char cmd_buf[512];
#ifdef USE_INTERNAL_EDIT #ifdef USE_INTERNAL_EDIT
@ -1806,8 +1809,9 @@ OS_Setup (void)
if ((mc_libdir = getenv ("MC_DATADIR")) != NULL) { if ((mc_libdir = getenv ("MC_DATADIR")) != NULL) {
mc_home = g_strdup (mc_libdir); mc_home = g_strdup (mc_libdir);
} else { } else {
mc_home = g_strdup (DATADIR); mc_home = g_strdup (SYSCONFDIR);
} }
mc_home_alt = mc_libdir != NULL ? g_strdup (SYSCONFDIR) : g_strdup (DATADIR);
} }
static void static void
@ -1940,7 +1944,7 @@ process_args (poptContext ctx, int c, const char *option_arg)
break; break;
case 'f': case 'f':
printf ("%s\n", mc_home); printf ("%s (%s)\n", mc_home, mc_home_alt);
exit (0); exit (0);
break; break;
@ -2300,6 +2304,7 @@ main (int argc, char *argv[])
} }
g_free (last_wd_string); g_free (last_wd_string);
g_free (mc_home_alt);
g_free (mc_home); g_free (mc_home);
done_key (); done_key ();
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET

Просмотреть файл

@ -127,6 +127,7 @@ void print_vfs_message(const char *msg, ...)
extern const char *prompt; extern const char *prompt;
extern const char *edit_one_file; extern const char *edit_one_file;
extern char *mc_home; extern char *mc_home;
extern char *mc_home_alt;
char *get_mc_lib_dir (void); char *get_mc_lib_dir (void);
int maybe_cd (int move_up_dir); int maybe_cd (int move_up_dir);

Просмотреть файл

@ -500,8 +500,15 @@ setup_init (void)
if (exist_file (inifile)){ if (exist_file (inifile)){
g_free (profile); g_free (profile);
profile = inifile; profile = inifile;
} else } else {
g_free (inifile); g_free (inifile);
inifile = concat_dir_and_file (mc_home_alt, "mc.ini");
if (exist_file (inifile)) {
g_free (profile);
profile = inifile;
} else
g_free (inifile);
}
} }
profile_name = profile; profile_name = profile;
@ -521,6 +528,11 @@ load_setup (void)
~/.mc/ini. FIXME: it's only used for keys and treestore now */ ~/.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 (mc_home, "mc.lib");
if (!exist_file(global_profile_name)) {
g_free (global_profile_name);
global_profile_name = concat_dir_and_file (mc_home_alt, "mc.lib");
}
/* Load integer boolean options */ /* Load integer boolean options */
for (i = 0; int_options[i].opt_name; i++) for (i = 0; int_options[i].opt_name; i++)
*int_options[i].opt_addr = *int_options[i].opt_addr =

Просмотреть файл

@ -739,6 +739,11 @@ user_menu_cmd (struct WEdit *edit_widget)
g_free (menu); g_free (menu);
menu = concat_dir_and_file \ menu = concat_dir_and_file \
(mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU); (mc_home, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
if (!exist_file (menu)) {
g_free (menu);
menu = concat_dir_and_file \
(mc_home_alt, edit_widget ? CEDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
} }
} }

Просмотреть файл

@ -575,16 +575,24 @@ load_mc_home_file (const char *filename, char **allocated_filename)
if (!data) { if (!data) {
g_free (hintfile); g_free (hintfile);
/* Fall back to the two-letter language code */ g_free (hintfile_base);
if (lang[0] && lang[1]) hintfile_base = concat_dir_and_file (mc_home_alt, filename);
lang[2] = 0;
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
data = load_file (hintfile); data = load_file (hintfile);
if (!data) { if (!data) {
g_free (hintfile); /* Fall back to the two-letter language code */
hintfile = hintfile_base; if (lang[0] && lang[1])
data = load_file (hintfile_base); lang[2] = 0;
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
data = load_file (hintfile);
if (!data) {
g_free (hintfile);
hintfile = hintfile_base;
data = load_file (hintfile_base);
}
} }
} }

Просмотреть файл

@ -1,5 +1,4 @@
SYNTAXFILES = \ SYNTAXFILES = \
Syntax \
ada95.syntax \ ada95.syntax \
awk.syntax \ awk.syntax \
aspx.syntax \ aspx.syntax \
@ -57,9 +56,15 @@ SYNTAXFILES = \
unknown.syntax \ unknown.syntax \
xml.syntax xml.syntax
SYNTAXCONFFILES = \
Syntax
if USE_EDIT if USE_EDIT
syntaxdir = $(pkgdatadir)/syntax syntaxdir = $(pkgdatadir)/syntax
syntax_DATA = $(SYNTAXFILES) syntax_DATA = $(SYNTAXFILES)
syntaxconfdir = $(sysconfdir)/@PACKAGE@
syntaxconf_DATA = $(SYNTAXCONFFILES)
endif endif
EXTRA_DIST = $(SYNTAXFILES) EXTRA_DIST = $(SYNTAXFILES) $(SYNTAXCONFFILES)

Просмотреть файл

@ -1,6 +1,6 @@
/* Virtual File System: External file system. /* Virtual File System: External file system.
Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007 Free Software Foundation, Inc. 2006, 2007, 2009 Free Software Foundation, Inc.
Written by: 1995 Jakub Jelinek Written by: 1995 Jakub Jelinek
Rewritten by: 1998 Pavel Machek Rewritten by: 1998 Pavel Machek
@ -256,7 +256,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
tmp = name_quote (name, 0); tmp = name_quote (name, 0);
} }
mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
cmd = cmd =
g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ",
local_name ? local_name : tmp, (char *) NULL); local_name ? local_name : tmp, (char *) NULL);
@ -631,7 +631,7 @@ extfs_cmd (const char *extfs_cmd, struct archive *archive,
archive_name = name_quote (extfs_get_archive_name (archive), 0); archive_name = name_quote (extfs_get_archive_name (archive), 0);
quoted_localname = name_quote (localname, 0); quoted_localname = name_quote (localname, 0);
mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype],
extfs_cmd, archive_name, " ", quoted_file, " ", extfs_cmd, archive_name, " ", quoted_file, " ",
quoted_localname, (char *) NULL); quoted_localname, (char *) NULL);
@ -660,7 +660,7 @@ extfs_run (struct vfs_class *me, const char *file)
g_free (p); g_free (p);
archive_name = name_quote (extfs_get_archive_name (archive), 0); archive_name = name_quote (extfs_get_archive_name (archive), 0);
mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR); mc_extfsdir = concat_dir_and_file (mc_home_alt, "extfs" PATH_SEP_STR);
cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype], cmd = g_strconcat (mc_extfsdir, extfs_prefixes[archive->fstype],
" run ", archive_name, " ", q, (char *) NULL); " run ", archive_name, " ", q, (char *) NULL);
g_free (mc_extfsdir); g_free (mc_extfsdir);

Просмотреть файл

@ -1,7 +1,9 @@
extfsdir = $(pkgdatadir)/extfs extfsdir = $(pkgdatadir)/extfs
EXTFSCONFFILES = extfs.ini sfs.ini
# Files to install and distribute other than extfs scripts # 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 # Scripts hat don't need adaptation to the local system
EXTFS_CONST = bpp rpm trpm srpm u7z EXTFS_CONST = bpp rpm trpm srpm u7z
@ -63,7 +65,10 @@ EXTFS_OUT = \
if USE_VFS if USE_VFS
extfs_DATA = $(EXTFS_MISC) extfs_DATA = $(EXTFS_MISC)
extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT) extfs_SCRIPTS = $(EXTFS_CONST) $(EXTFS_OUT)
extfsconfdir = $(sysconfdir)/@PACKAGE@/extfs
extfsconf_DATA = $(EXTFSCONFFILES)
endif endif
EXTRA_DIST = $(EXTFS_MISC) $(EXTFS_CONST) EXTRA_DIST = $(EXTFS_MISC) $(EXTFS_CONST) $(EXTFSCONFFILES)