#!/bin/sh - # # @(#)$Id: ready_rc_files,v 1.4 2018/12/15 21:22:04 jneitzel Exp $ # # The author of this file, J.A. Neitzel , # hereby grants it to the public domain. # # # Ready .etsh* and etsh* for installation. # ../Makefile runs this script via the exp target. # # usage: $(SHELL) ready_rc_files "$(EBN)" "$(PREFIX)" "$(BINDIR)" "$(SYSCONFDIR)" # # Exit w/ a status of 0 on success. # Exit w/ a status of 1 on error. # -- # Jeffrey Allen Neitzel # if test ! \( $# -eq 4 \) -o \ ! \( -n "$1" -a -n "$2" -a -n "$3" -a -n "$4" \) ; then echo 'usage: $(SHELL) ready_rc_files "$(EBN)" "$(PREFIX)" "$(BINDIR)" "$(SYSCONFDIR)"' >&2 exit 1 fi ebn=$1 prefix=$2 bindir=$3 sysconfdir=$4 rm -rf ../exp mkdir ../exp || exit 1 for rc_file in .etsh* etsh* ; do if test $rc_file = .etsh.prompt ; then cat < .etsh.prompt > ../exp/.etsh.prompt ; continue ; fi sed -e "s|@EBN@|$ebn|g" \ -e "s|@PREFIX@|$prefix|" \ -e "s|@BINDIR@|$bindir|" \ -e "s|@SYSCONFDIR@|$sysconfdir|" < $rc_file \ > ../exp/$rc_file || { echo "$rc_file: error" >&2 ; exit 1 ; } done if test "$ebn" != "etsh" ; then cd ../exp echo -n "Moving .etsh* and etsh* to .${ebn}* and ${ebn}* . . . " >&2 mv .etsh.login .${ebn}.login mv .etsh.logout .${ebn}.logout # note: .etsh.prompt will not function with a changed name. mv .etshrc .${ebn}rc mv etsh.etshrc ${ebn}.${ebn}rc mv etsh.login ${ebn}.login mv etsh.logout ${ebn}.logout echo "Done ." >&2 fi exit 0