aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-27 20:29:32 +0000
committerRoy Marples <roy@marples.name>2008-02-27 20:29:32 +0000
commitc2648ca5f539c450b27d35c7c0a3d41c6e193d8f (patch)
tree1de8b046bd8c1029165670c697eace4c89ece8f5
parent143570689bc93c68fa83c3eb56d622b707ec0e18 (diff)
Makefile SH variable now tweaks the default shell used by our scripts.
-rw-r--r--etc.BSD/Makefile8
-rw-r--r--etc.BSD/rc.in2
-rw-r--r--etc.BSD/rc.shutdown.in2
-rw-r--r--[-rwxr-xr-x]init.d/halt.sh.in (renamed from init.d/halt.sh)2
-rw-r--r--mk/scripts.mk11
-rw-r--r--mk/sys.mk1
-rw-r--r--[-rwxr-xr-x]sh.BSD/init.sh.in (renamed from sh.BSD/init.sh)2
-rw-r--r--[-rwxr-xr-x]sh.Linux/init-early.sh.in (renamed from sh.Linux/init-early.sh)2
-rw-r--r--[-rwxr-xr-x]sh.Linux/init.sh.in (renamed from sh.Linux/init.sh)2
-rw-r--r--sh/Makefile9
-rw-r--r--sh/functions.sh.in (renamed from sh/functions.in)0
-rw-r--r--[-rwxr-xr-x]sh/gendepends.sh.in (renamed from sh/gendepends.sh)2
-rw-r--r--sh/rc-functions.sh.in (renamed from sh/rc-functions.in)0
-rw-r--r--[-rwxr-xr-x]sh/runscript.sh.in (renamed from sh/runscript.sh)2
14 files changed, 22 insertions, 23 deletions
diff --git a/etc.BSD/Makefile b/etc.BSD/Makefile
index 083823e4..ec3153cd 100644
--- a/etc.BSD/Makefile
+++ b/etc.BSD/Makefile
@@ -1,8 +1,5 @@
DIR= /etc
-SRCS= rc.in rc.shutdown.in
-OBJS= ${SRCS:.in=}
-CONF= ${OBJS}
-
+CONF= ${CONTENTS}
MK= ../mk
include ${MK}/scripts.mk
@@ -10,5 +7,4 @@ include Makefile.${OS}
.SUFFIXES: .in
.in:
- sed -e s':@TERM@:${DEFTERM}:' $< > $@
-
+ sed -e 's:@SHELL@:${SHELL}:' -e 's:@TERM@:${DEFTERM}:' $< > $@
diff --git a/etc.BSD/rc.in b/etc.BSD/rc.in
index 255ff72e..aab7cbb8 100644
--- a/etc.BSD/rc.in
+++ b/etc.BSD/rc.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
diff --git a/etc.BSD/rc.shutdown.in b/etc.BSD/rc.shutdown.in
index 48abe703..e26e8468 100644
--- a/etc.BSD/rc.shutdown.in
+++ b/etc.BSD/rc.shutdown.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
diff --git a/init.d/halt.sh b/init.d/halt.sh.in
index 044659bc..39dd4f4f 100755..100644
--- a/init.d/halt.sh
+++ b/init.d/halt.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
diff --git a/mk/scripts.mk b/mk/scripts.mk
index 9bee14d1..114d5e2b 100644
--- a/mk/scripts.mk
+++ b/mk/scripts.mk
@@ -1,14 +1,23 @@
# Install rules for our scripts
# Copyright 2007-2008 Roy Marples <roy@marples.name>
+_IN_SH= ls -1 | sed -n -e 's:\.in$$::p' | xargs
+_IN!= ${_IN_SH}
+OBJS+= ${_IN}$(shell ${_IN_SH})
+
# We store the contents of the directory for ease of use in Makefiles
-_CONTENTS_SH= ls -1 | grep -v Makefile | xargs
+_CONTENTS_SH= ls -1 | grep -v "\(Makefile\|.in$$\)" | sed -e 's:\.in$$::g' | xargs
_CONTENTS!= ${_CONTENTS_SH}
CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH})
include ${MK}/sys.mk
include ${MK}/os.mk
+# Tweak our shell scripts
+.SUFFIXES: .sh.in
+.sh.in.sh:
+ sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' $< > $@
+
all: ${OBJS}
realinstall: ${BIN} ${CONF} ${CONF_APPEND}
diff --git a/mk/sys.mk b/mk/sys.mk
index dc70b0a3..7be86426 100644
--- a/mk/sys.mk
+++ b/mk/sys.mk
@@ -5,6 +5,7 @@ AR?= ar
ECHO?= echo
INSTALL?= install
RANLIB?= ranlib
+SH= /bin/sh
PICFLAG?= -fPIC
diff --git a/sh.BSD/init.sh b/sh.BSD/init.sh.in
index a9797c95..3bc52507 100755..100644
--- a/sh.BSD/init.sh
+++ b/sh.BSD/init.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
diff --git a/sh.Linux/init-early.sh b/sh.Linux/init-early.sh.in
index 784ddfda..d6cb007d 100755..100644
--- a/sh.Linux/init-early.sh
+++ b/sh.Linux/init-early.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
diff --git a/sh.Linux/init.sh b/sh.Linux/init.sh.in
index c006d5f1..90dbea82 100755..100644
--- a/sh.Linux/init.sh
+++ b/sh.Linux/init.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
diff --git a/sh/Makefile b/sh/Makefile
index 47f431fa..364a59bc 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -1,7 +1,5 @@
DIR= ${RC_LIB}/sh
-SRCS= functions.in rc-functions.in
-OBJS= ${SRCS:.in=.sh}
-INC= init-common-post.sh rc-mount.sh ${OBJS}
+INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
BIN= gendepends.sh net.sh runscript.sh
INSTALLAFTER= _installafter
@@ -12,11 +10,6 @@ include ${MK}/os.mk
include Makefile.${SUBOS}
include ${MK}/scripts.mk
-# Ensure that the lib name is correct
-.SUFFIXES: .in .sh
-.in.sh:
- sed -e 's:/lib/:/${LIBNAME}/:g' $< > $@
-
_installafter:
${INSTALL} -d ${DESTDIR}/etc/init.d
@# Provide an init script for the loopback interface
diff --git a/sh/functions.in b/sh/functions.sh.in
index effce67d..effce67d 100644
--- a/sh/functions.in
+++ b/sh/functions.sh.in
diff --git a/sh/gendepends.sh b/sh/gendepends.sh.in
index 712d29ff..8e30a648 100755..100644
--- a/sh/gendepends.sh
+++ b/sh/gendepends.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Shell wrapper to list our dependencies
# Copyright 2007-2008 Roy Marples <roy@marples.name>
diff --git a/sh/rc-functions.in b/sh/rc-functions.sh.in
index 2a57709c..2a57709c 100644
--- a/sh/rc-functions.in
+++ b/sh/rc-functions.sh.in
diff --git a/sh/runscript.sh b/sh/runscript.sh.in
index 63c780a6..6b8c3db2 100755..100644
--- a/sh/runscript.sh
+++ b/sh/runscript.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
# Shell wrapper for runscript
# Copyright 2007-2008 Roy Marples <roy@marples.name>