Commit 2f5d0f5d authored by John P. Willis's avatar John P. Willis
Browse files

Updates for pkgsrc, split out installation from initial configuration

parent 6fdb6a16
Pipeline #546 failed with stage
in 8 seconds
......@@ -433,3 +433,8 @@ VERSION 0.27.4
VERSION 0.27.5
Further fixes for pkgsrc
********************************************************************************
VERSION 0.28.0
Updates for pkgsrc, split out installation from initial configuration
......@@ -37,8 +37,7 @@
#
#
SUBDIRS = src doc etc
dist_sysconf_DATA = etc/freem.conf
SUBDIRS = src doc
dist_doc_DATA = README.md doc/freem.1 doc/gcompact.8 doc/gfix.8 doc/grestore.8
man1_MANS = doc/freem.1
......@@ -68,13 +67,13 @@ install-exec-hook:
chmod 755 $(DESTDIR)$(bindir)/freem
install-data-hook:
sed -i "s:%DATAROOT%:$(localstatedir):g" $(DESTDIR)$(sysconfdir)/freem.conf
chmod -R 777 $(DESTDIR)$(journaldir) $(DESTDIR)$(systemgbldir) $(DESTDIR)$(usergbldir) $(DESTDIR)$(userrtndir)
chmod -R 755 $(DESTDIR)$(systemrtndir)
@echo
@echo "============================================================================"
@echo
@echo " FreeM has been installed."
@echo " You must run \"fmadm configure\" before using FreeM."
@echo
@echo "============================================================================"
......@@ -37,7 +37,7 @@
#
#
AC_INIT(freem, 0.27.5, jpw@coherent-logic.com)
AC_INIT(freem, 0.28.0, jpw@coherent-logic.com)
AC_CONFIG_HEADERS([src/config.h])
AC_CHECK_LIB([readline], [readline])
AC_CHECK_LIB([readline], [history_list])
......
......@@ -4,7 +4,7 @@
@settitle The FreeM Manual
@copying
This manual is for FreeM, (version 0.27.5), which is a free and open-source implementation of the M programming language and database system.
This manual is for FreeM, (version 0.28.0), which is a free and open-source implementation of the M programming language and database system.
Copyright @copyright{} 2020 Coherent Logic Development LLC
......@@ -18,7 +18,7 @@ Permission is granted to copy, distribute and/or modify this document under the
@title The FreeM Manual
@subtitle @sc{The Official Manual of FreeM}
@subtitle Version 0.27.5
@subtitle Version 0.28.0
@c@vskip 10pt
@c@center @image{freem-logo-sm,,,,.png}
@author John P. Willis
......@@ -279,7 +279,7 @@ The FreeM direct-mode environment is the mode entered when FreeM is loaded witho
@example
Coherent Logic Development FreeM
Version 0.27.5-x86_64-Linux (commit 4ececff; jpw AT pasithea Tue 13 Oct 2020 09:03:27 AM MDT)
Version 0.28.0-x86_64-Linux (commit 4ececff; jpw AT pasithea Tue 13 Oct 2020 09:03:27 AM MDT)
*
* *
......@@ -1291,7 +1291,7 @@ In the above @emph{inclusive} form, @code{KVALUE} will kill the data values at e
@cartouche
@quotation
@emph{Note}
The below @emph{argumentless} and @emph{exclusive} forms of @code{KVALUE} are not implemented in FreeM, as of version 0.27.5, but are planned for a future release.
The below @emph{argumentless} and @emph{exclusive} forms of @code{KVALUE} are not implemented in FreeM, as of version 0.28.0, but are planned for a future release.
@end quotation
@end cartouche
......
#
# *
# * *
# * *
# ***************
# * * * *
# * MUMPS *
# * * * *
# ***************
# * *
# * *
# *
#
# Makefile.am (etc)
# freem /etc files automake rules
#
#
# Author: John P. Willis <jpw@coherent-logic.com>
# Copyright (C) 1998 MUG Deutschland
# Copyright (C) 2020 Coherent Logic Development LLC
#
#
# This file is part of FreeM.
#
# FreeM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FreeM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero Public License for more details.
#
# You should have received a copy of the GNU Affero Public License
# along with FreeM. If not, see <https://www.gnu.org/licenses/>.
#
#
sysconf_DATA = freem.conf
[SYSTEM]
root=%DATAROOT%/freem/SYSTEM
routines_path=%DATAROOT%/freem/SYSTEM/routines
globals_path=%DATAROOT%/freem/SYSTEM/globals
locktable_file=%DATAROOT%/freem/SYSTEM/locktab
zalloctab_file=%DATAROOT%/freem/SYSTEM/zalloctab
journal_file=%DATAROOT%/freem/journals/journal
journal_mode=on
journal_host_id=DEFAULT
hardcopy_file=%DATAROOT%/freem/SYSTEM/hardcopy
[USER]
root=%DATAROOT%/freem/USER
routines_path=%DATAROOT%/freem/USER/routines
globals_path=%DATAROOT%/freem/USER/globals
locktable_file=%DATAROOT%/freem/USER/locktab
hardcopy_file=%DATAROOT%/freem/USER/hardcopy
......@@ -38,7 +38,7 @@
#
AM_CFLAGS = -fsigned-char #-Wall -Wno-format-truncation -Wno-format-overflow -Wno-parentheses -Wno-char-subscripts -Wno-unused-but-set-variable -Wno-stringop-truncation
AM_CPPFLAGS = -DHACK_NOXLATE -DSYSCONFDIR=\"${sysconfdir}\" -DPREFIX=\"${prefix}\" -DDATADIR=\"${datadir}\"
AM_CPPFLAGS = -DHACK_NOXLATE -DSYSCONFDIR=\"${sysconfdir}\" -DPREFIX=\"${prefix}\" -DDATADIR=\"${datadir}\" -DLOCALSTATEDIR=\"${localstatedir}\"
freem_headers = config.h elsymbiont.h errmsg.h events.h fmadm.h fma_globals.h fma_jobs.h \
fma_journals.h fma_locks.h fma_routines.h freem.h iftab.h iniconf.h \
......
......@@ -37,10 +37,12 @@
*
**/
#include <sys/stat.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "fmadm.h"
#include "errmsg.h"
......@@ -63,6 +65,9 @@ char obj_str[STRLEN];
extern char config_file[4096];
void fm_configure(void);
void fm_write (FILE *file, char *buf);
int main (int argc, char **argv)
{
char action[STRLEN];
......@@ -76,6 +81,11 @@ int main (int argc, char **argv)
int i = 0;
int j = 1;
strncpy (config_file, SYSCONFDIR"/freem.conf", 4096);
/* override for fmadm configure */
if (strcmp (argv[1], "configure") == 0) fm_configure ();
/* need at least command, action, object, namespace */
if (argc < 4) return fmadm_usage();
......@@ -107,7 +117,6 @@ int main (int argc, char **argv)
strncpy (action, argv[1], STRLEN - 1);
strncpy (obj_str, argv[2], STRLEN - 1);
strncpy (fma_namespace, argv[3], STRLEN - 1);
strncpy (config_file, SYSCONFDIR"/freem.conf", 4096);
if (strncmp (action, "list", STRLEN - 1) == 0) act = ACT_LIST;
else if (strncmp (action, "examine", STRLEN - 1) == 0) act = ACT_EXAMINE;
......@@ -438,5 +447,145 @@ int fm_edit (short object, int optc, char **options)
} /* fm_edit() */
void fm_configure (void)
{
char sysrtn[4096];
char sysgbl[4096];
char usrrtn[4096];
char usrgbl[4096];
char locktab[4096];
char zalloctab[4096];
char jnlfile[4096];
char hcpyfile[4096];
char jnlmode[4];
char jnlhostid[4096];
char jnlcut[4096];
char buf[4096];
FILE *fp;
snprintf (sysrtn, 4095, "%s/freem/SYSTEM/routines", LOCALSTATEDIR);
snprintf (sysgbl, 4095, "%s/freem/SYSTEM/globals", LOCALSTATEDIR);
snprintf (usrrtn, 4095, "%s/freem/USER/routines", LOCALSTATEDIR);
snprintf (usrgbl, 4095, "%s/freem/USER/globals", LOCALSTATEDIR);
snprintf (locktab, 4095, "%s/freem/locktab", LOCALSTATEDIR);
snprintf (zalloctab, 4095, "%s/freem/zalloctab", LOCALSTATEDIR);
snprintf (jnlfile, 4095, "/tmp/freem_journal.dat", LOCALSTATEDIR);
snprintf (hcpyfile, 4095, "/tmp/freem_hardcopy.dat", LOCALSTATEDIR);
snprintf (jnlmode, 3, "on");
snprintf (jnlhostid, 4095, "DEFAULT");
snprintf (jnlcut, 4095, "4294967000");
if (geteuid () != 0) {
fprintf (stderr, "fmadm: not superuser\n");
exit (1);
}
if (file_exists (config_file)) {
fprintf (stderr, "fmadm: '%s' already exists.\n\n", config_file);
fprintf (stderr, "'fmadm configure' may only be used on a fresh installation of FreeM.\n");
exit (1);
}
fp = fopen (config_file, "a+");
printf ("\nFreeM Initial Configuration\n");
printf ("---------------------------\n\n");
printf ("This utility will create the initial configuration file for ");
printf ("FreeM in %s.\n\n", config_file);
printf ("Creating %s... ", config_file);
snprintf (buf, 4095, "[SYSTEM]");
fm_write (fp, buf);
snprintf (buf, 4095, "root=%s/freem/SYSTEM", LOCALSTATEDIR);
fm_write (fp, buf);
snprintf (buf, 4095, "routines_path=%s", sysrtn);
fm_write (fp, buf);
snprintf (buf, 4095, "globals_path=%s", sysgbl);
fm_write (fp, buf);
snprintf (buf, 4095, "locktable_file=%s", locktab);
fm_write (fp, buf);
snprintf (buf, 4095, "zalloctab_file=%s", zalloctab);
fm_write (fp, buf);
snprintf (buf, 4095, "journal_file=%s", jnlfile);
fm_write (fp, buf);
snprintf (buf, 4095, "journal_mode=%s", jnlmode);
fm_write (fp, buf);
snprintf (buf, 4095, "journal_host_id=%s", jnlhostid);
fm_write (fp, buf);
snprintf (buf, 4095, "journal_cut_threshold=%s", jnlcut);
fm_write (fp, buf);
snprintf (buf, 4095, "hardcopy_file=%s", hcpyfile);
fm_write (fp, buf);
snprintf (buf, 4095, "\n[USER]");
fm_write (fp, buf);
snprintf (buf, 4095, "root=%s/freem/USER", LOCALSTATEDIR);
fm_write (fp, buf);
snprintf (buf, 4095, "routines_path=%s", usrrtn);
fm_write (fp, buf);
snprintf (buf, 4095, "globals_path=%s", usrgbl);
fm_write (fp, buf);
fclose (fp);
printf ("[OK]\n\n");
/*
printf ("Setting USER namespace permissions... ");
snprintf (buf, 4095, "%s/freem/USER/globals", LOCALSTATEDIR);
chmod (buf, 0777);
snprintf (buf, 4095, "%s/freem/USER/routines", LOCALSTATEDIR);
chmod (buf, 0777);
printf ("[OK]\n");
printf ("Setting SYSTEM namespace permissions... ");
snprintf (buf, 4095, "%s/freem/SYSTEM/globals", LOCALSTATEDIR);
chmod (buf, 0755);
snprintf (buf, 4095, "%s/freem/SYSTEM/routines", LOCALSTATEDIR);
chmod (buf, 0755);
printf ("[OK]\n\n\n");
*/
printf ("FreeM initial configuration is complete.\n\n");
printf (" USER globals: %s\n", usrgbl);
printf (" USER routines: %s\n", usrrtn);
printf (" SYSTEM globals: %s\n", sysgbl);
printf (" SYSTEM routines: %s\n", sysrtn);
printf (" After-image journal: %s [%s]\n", jnlfile, jnlmode);
printf (" Journal cut threshold: %s bytes\n", jnlcut);
printf (" Distributed journaling host ID: %s\n", jnlhostid);
printf (" Hardcopy mode output file: %s\n\n", hcpyfile);
exit (0);
} /* fm_configure */
void fm_write (FILE *file, char *buf)
{
fprintf (file, "%s\n", buf);
}
......@@ -336,7 +336,16 @@ int main (int argc, char **argv, char **envp)
#ifdef __EMSCRIPTEN__
fprintf (stderr, "EMSCRIPTEN CHECK PRE-INIT\n");
#endif
if (!file_exists (config_file)) {
set_io (UNIX);
fprintf (stderr, "\nFreeM has not been configured. Please run 'fmadm configure'.\n\n\n\n");
exit (2);
}
/* initialize FreeM environment */
if (init (nsnbuf) == FALSE) {
......@@ -353,7 +362,7 @@ int main (int argc, char **argv, char **envp)
snprintf (version, 256, "Coherent Logic Development FreeM\r\nVersion %s\r\n\r\n\201", FREEM_VERSION_ID);
write_m (version);
write_m (" *\r\n\201");
write_m ("\r\n\r\n *\r\n\201");
write_m (" * *\r\n\201");
write_m (" * *\r\n\201");
write_m (" ***************\r\n\201");
......
#ifndef FREEM_VERSION_H
#define FREEM_VERSION_H
#define FREEM_VERSION_ID PACKAGE_VERSION
#define FREEM_VERSION_STR PACKAGE_VERSION
#define FREEM_VERSION_ID PACKAGE_VERSION"\201"
#define FREEM_VERSION_STR PACKAGE_VERSION"\201"
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment