From 6b9aeb8ba4a84c423d1c7512e828d65fa626709b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Go=C5=82aszewski?= Date: Sun, 4 Apr 2004 19:05:36 +0000 Subject: [PATCH] - 2.4.6 - basic /etc/env.d support. Simple way to manage system variables. Something quite similar is in gentoo Changed files: Makefile -> 1.5 etc/env.d/EDITOR -> 1.1 etc/env.d/HISTFILESIZE -> 1.1 etc/env.d/HOME_ETC -> 1.1 etc/env.d/NNTPSERVER -> 1.1 etc/env.d/ORGANIZATION -> 1.1 etc/env.d/VISUAL -> 1.1 etc/profile -> 1.37 --- Makefile | 6 +++++- etc/env.d/EDITOR | 1 + etc/env.d/HISTFILESIZE | 1 + etc/env.d/HOME_ETC | 1 + etc/env.d/NNTPSERVER | 1 + etc/env.d/ORGANIZATION | 1 + etc/env.d/VISUAL | 1 + etc/profile | 27 ++++++++++++++++++++------- 8 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 etc/env.d/EDITOR create mode 100644 etc/env.d/HISTFILESIZE create mode 100644 etc/env.d/HOME_ETC create mode 100644 etc/env.d/NNTPSERVER create mode 100644 etc/env.d/ORGANIZATION create mode 100644 etc/env.d/VISUAL diff --git a/Makefile b/Makefile index 240cfa9..ba3d230 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Very basic and very simple Makefile. Maybe it would be nice to make it # in ac/am.... but I'm too lazy ;) # -VERSION = 2.4.5 +VERSION = 2.4.6 CC = gcc OPT_FLAGS = -O2 -g @@ -10,6 +10,7 @@ INSTALL = install SBINDIR = /sbin ETCDIR = /etc PROFILEDIR = $(ETCDIR)/profile.d +ENVDIR = $(ETCDIR)/env.d ######################################### BIN_FILES = joinpasswd @@ -18,6 +19,7 @@ ETC_FILES = filesystems fstab group host.conf hosts motd mtab \ netgroup passwd profile protocols resolv.conf securetty \ services shells PROFILE_FILES = tmp-dir.csh tmp-dir.sh +ENV_FILES = EDITOR HISTFILESIZE HOME_ETC NNTPSERVER ORGANIZATION VISUAL SOURCES = joinpasswd.c CLEAN = $(BIN_FILES) *.o core *.tar.gz *.tar.bz2 *~ *.swp @@ -39,9 +41,11 @@ install: $(INSTALL) -d $(DESTDIR)/$(SBINDIR) $(INSTALL) -d $(DESTDIR)/$(ETCDIR) $(INSTALL) -d $(DESTDIR)/$(PROFILEDIR) + $(INSTALL) -d $(DESTDIR)/$(ENVDIR) $(INSTALL) $(BIN_FILES) $(DESTDIR)/$(SBINDIR) cd etc; $(INSTALL) $(ETC_FILES) $(DESTDIR)/$(ETCDIR) cd etc/profile.d; $(INSTALL) $(PROFILE_FILES) $(DESTDIR)/$(PROFILEDIR) + cd etc/env.d; $(INSTALL) $(ENV_FILES) $(DESTDIR)/$(ENVDIR) dist: clean diff --git a/etc/env.d/EDITOR b/etc/env.d/EDITOR new file mode 100644 index 0000000..5ce22b0 --- /dev/null +++ b/etc/env.d/EDITOR @@ -0,0 +1 @@ +#EDITOR= diff --git a/etc/env.d/HISTFILESIZE b/etc/env.d/HISTFILESIZE new file mode 100644 index 0000000..2abc56a --- /dev/null +++ b/etc/env.d/HISTFILESIZE @@ -0,0 +1 @@ +HISTFILESIZE=1000 diff --git a/etc/env.d/HOME_ETC b/etc/env.d/HOME_ETC new file mode 100644 index 0000000..4c7fb7c --- /dev/null +++ b/etc/env.d/HOME_ETC @@ -0,0 +1 @@ +#HOME_ETC=$HOME/etc diff --git a/etc/env.d/NNTPSERVER b/etc/env.d/NNTPSERVER new file mode 100644 index 0000000..184315f --- /dev/null +++ b/etc/env.d/NNTPSERVER @@ -0,0 +1 @@ +#NNTPSERVER= diff --git a/etc/env.d/ORGANIZATION b/etc/env.d/ORGANIZATION new file mode 100644 index 0000000..2efc659 --- /dev/null +++ b/etc/env.d/ORGANIZATION @@ -0,0 +1 @@ +#ORGANIZATION= diff --git a/etc/env.d/VISUAL b/etc/env.d/VISUAL new file mode 100644 index 0000000..5c8e783 --- /dev/null +++ b/etc/env.d/VISUAL @@ -0,0 +1 @@ +#VISUAL= diff --git a/etc/profile b/etc/profile index 8621dc1..f2247ae 100644 --- a/etc/profile +++ b/etc/profile @@ -20,12 +20,6 @@ LOGNAME=$USER HOSTNAME=`/bin/uname -n` HISTFILE="$HOME/.history" HISTSIZE=1000 -HISTFILESIZE=1000 - -# home_etc user config-dirs -#CONFIG_DIR=etc -#HOME_ETC=$HOME/$CONFIG_DIR -#export CONFIG_DIR HOME_ETC # # Setup the environment for various shells @@ -134,8 +128,27 @@ case "$SH" in esac unset SH -export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE HISTFILESIZE PS1 PS2 +export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE PS1 PS2 + +# Put all of the variables as files in /etc/env.d/ +# example: +# cat /etc/env.d/VARIABLE +# VARIABLE="value" +for i in /etc/env.d/* ; do + NAME=`basename $i` + case $NAME in + *~ | *.bak | *.old | *.rpmnew | *.rpmsave ) + # nothing + ;; + * ) + if [ -r $i ]; then + . $i; export $NAME + fi + ;; + esac +done +# Scripts: for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i -- 2.44.0