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 # 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 # All rights reserved. Released under the 2-clause BSD license. diff --git a/init.d/halt.sh b/init.d/halt.sh.in old mode 100755 new mode 100644 similarity index 99% rename from init.d/halt.sh rename to init.d/halt.sh.in index 044659bc..39dd4f4f --- a/init.d/halt.sh +++ b/init.d/halt.sh.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!@SHELL@ # Copyright 2007-2008 Roy Marples # 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 +_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 old mode 100755 new mode 100644 similarity index 99% rename from sh.BSD/init.sh rename to sh.BSD/init.sh.in index a9797c95..3bc52507 --- a/sh.BSD/init.sh +++ b/sh.BSD/init.sh.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!@SHELL@ # Copyright 2007-2008 Roy Marples # 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 old mode 100755 new mode 100644 similarity index 98% rename from sh.Linux/init-early.sh rename to sh.Linux/init-early.sh.in index 784ddfda..d6cb007d --- 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 # All rights reserved. Released under the 2-clause BSD license. diff --git a/sh.Linux/init.sh b/sh.Linux/init.sh.in old mode 100755 new mode 100644 similarity index 99% rename from sh.Linux/init.sh rename to sh.Linux/init.sh.in index c006d5f1..90dbea82 --- 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 # 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 similarity index 100% rename from sh/functions.in rename to sh/functions.sh.in diff --git a/sh/gendepends.sh b/sh/gendepends.sh.in old mode 100755 new mode 100644 similarity index 99% rename from sh/gendepends.sh rename to sh/gendepends.sh.in index 712d29ff..8e30a648 --- 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 diff --git a/sh/rc-functions.in b/sh/rc-functions.sh.in similarity index 100% rename from sh/rc-functions.in rename to sh/rc-functions.sh.in diff --git a/sh/runscript.sh b/sh/runscript.sh.in old mode 100755 new mode 100644 similarity index 99% rename from sh/runscript.sh rename to sh/runscript.sh.in index 63c780a6..6b8c3db2 --- 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