Try to autodiscover the OS; annotate README accordingly.

This commit is contained in:
Steven Bakker 2021-04-13 18:23:42 +00:00
parent f5c3d7717c
commit 0cd69b50bc
3 changed files with 55 additions and 29 deletions

View File

@ -41,19 +41,20 @@ Depending on your O/S distribution and version of Perl, some or all of these may
### DEBIAN
1. Edit config.mk (see below)
1. Edit config.mk if necessary (see below)
2. Run `make dpkg`
3. `dpkg --install *.deb`
### OTHER SYSTEMS
1. Look at the start of `config.mk` and pick the correct value for `DISTRO`; this will pick sane defaults for the variables below.
2. Override (or delete) `DFL_SOCK_GROUP` in the `OVERRIDES` section.
3. Make sure the following variables are set correctly, either by the `DISTRO` selection or by overriding them.
1. The `config.mk` should be able to detect your OS/distro automatically. If not, you may need to edit `config.mk` and set an explicit value.
2. Make sure the following variables are set correctly, either by the `DISTRO` selection or by overriding them.
* `PERL`
* `IFCONFIG`
* `SPONGE_VAR`
4. If you want, you can override any of the variables below:
* `RUNDIR`
* `ETC_DEFAULT`
3. If you want, you can override any of the variables below:
* `DIRPREFIX`
* `BINPREFIX`
* `DOCPREFIX`

View File

@ -27,18 +27,40 @@
#DISTRO := fedora
#DISTRO := redhat
#DISTRO := ubuntu
DISTRO = debian
#DISTRO := debian
ifeq (${DISTRO}, freebsd)
ifeq (${DISTRO},)
$(info Detecting DISTRO and OS...)
OS := $(shell uname -s | tr [:upper:] [:lower:])
DISTRO := ?
ifeq (${OS}, linux)
DISTRO := $(shell grep -E "^ID =" /etc/os-release | awk "{ print $2 }")
$(info DISTRO = ${DISTRO})
else
_is_bsd := $(shell echo ${OS} | grep -E bsd)
ifneq (${_is_bsd},)
DISTRO := ${OS}
DISTRO_FLAVOR := ${OS}
OS := bsd
endif
endif
$(info OS = ${OS})
$(info DISTRO = ${DISTRO})
endif
# Defaults apply for Linux
PERL = /usr/bin/perl
LIBROOT = $(DIRPREFIX)/lib/perl5
IFCONFIG = /sbin/ifconfig
OWNER = root
GROUP = root
DFL_SOCK_GROUP = adm
RUNDIR = /run
ETC_DEFAULT = /etc/default
ifeq (${DISTRO},freebsd)
OS = bsd
DISTRO_FLAVOR = freebsd
PERL = /usr/local/bin/perl
LIBROOT = $(DIRPREFIX)/lib/perl5/site_perl
IFCONFIG = /sbin/ifconfig
OWNER = root
GROUP = wheel
DFL_SOCK_GROUP = wheel
ETC_DEFAULT = /etc/defaults
else ifneq (, $(filter ${DISTRO},fedora redhat))
OS = linux
DISTRO_FLAVOR = redhat
@ -49,16 +71,21 @@ else
$(error unknown DISTRO "${DISTRO}")
endif
ifeq (${OS}, linux)
PERL = /usr/bin/perl
LIBROOT = $(DIRPREFIX)/lib/perl5
IFCONFIG = /sbin/ifconfig
OWNER = root
GROUP = root
ifeq (${OS},bsd)
PERL = /usr/local/bin/perl
LIBROOT = $(DIRPREFIX)/lib/perl5/site_perl
GROUP = wheel
DFL_SOCK_GROUP = wheel
ETC_DEFAULT = /etc/default
RUNDIR = /var/run
ifeq (${DISTRO},openbsd)
# OpenBSD has no /etc/default or /etc/defaults :-(
ETC_DEFAULT = /etc
else
ETC_DEFAULT = /etc/defaults
endif
else ifeq (${OS},linux)
ifeq (${DISTRO_FLAVOR},debian)
LIBROOT = $(DIRPREFIX)/lib/site_perl
LIBROOT = $(DIRPREFIX)/lib/site_perl
endif
endif
@ -66,8 +93,6 @@ endif
# OVERRIDES
# ---------------------------------------------------------------------------
DFL_SOCK_GROUP = noc
# ---------------------------------------------------------------------------
# SPONGE DEFAULTS
# ---------------------------------------------------------------------------

View File

@ -187,11 +187,11 @@ auto/$(AUTO1)/%/autosplit.ix : $(AUTO1)/%.pm
@PERLLIB=$$PERLLIB:$(TOPDIR)/lib; export PERLLIB; \
$(TOOLDIR)/autosplit ./auto $<
%-all : ; cd $* ; $(MAKE) all
%-install : ; cd $* ; $(MAKE) install
%-uninstall : ; cd $* ; $(MAKE) uninstall
%-autosplit : ; cd $* ; $(MAKE) autosplit
%-clean : ; cd $* ; $(MAKE) clean
%-all : ; cd $* ; $(MAKE) DISTRO=${DISTRO} all
%-install : ; cd $* ; $(MAKE) DISTRO=${DISTRO} install
%-uninstall : ; cd $* ; $(MAKE) DISTRO=${DISTRO} uninstall
%-autosplit : ; cd $* ; $(MAKE) DISTRO=${DISTRO} autosplit
%-clean : ; cd $* ; $(MAKE) DISTRO=${DISTRO} clean
all : $(TARGETS)