Patch for mergemaster [was Re: RFC: Alternate patch to have true new-style rc.d scripts in ports (without touching localpkg)]

From: Scot Hetzel <swhetzel_at_gmail.com>
Date: Fri, 27 Aug 2004 10:24:39 -0500
On Tue, 17 Aug 2004 17:38:03 -0500, Scot Hetzel <swhetzel_at_gmail.com> wrote:
> On Tue, 17 Aug 2004 15:33:35 -0700, Kevin Oberman <oberman_at_es.net> wrote:
> > > Date: Tue, 17 Aug 2004 17:24:27 -0500
> > > From: Scot Hetzel <swhetzel_at_gmail.com>
> >
> >
> > >
> > > On Tue, 17 Aug 2004 14:58:14 -0700, Kevin Oberman <oberman_at_es.net> wrote:
> > > > > It is best to leave the moving of these scripts up to the individual
> > > > > administrator.
> > > >
> > > > Only if mergemaster is fixed!
> > > >
> > > This could be fixed by adding:
> > >
> > >    # KEYWORD: FreeBSD PORT
> > >
> > > to each startup script.  Then making mergemaster ignore any script
> > > that has PORT in the KEYWORD line.
> >
> > Yes, this would work, although I would prefer:
> >     # KEYWORD: FreeBSD USER
> > since some systems might want to add scripts to rc.local that are not
> > from ports.
> > 
> Another option is to use:
>    # KEYWORD: FreeBSD SYSTEM
> 
> for system startup scripts and only have mergemaster look at scripts
> with SYSTEM as KEYWORD.
> 
Several individuals expressed their concern with mergemaster deleting
scripts from /etc/rc.d.  The main concern is that an administator
could create their own scripts and place them into /etc/rc.d, then
either they forget about their script, or another admin is updating
and they accidently delete the script during the mergemaster process.

Attached is a patch to mergemaster that checks the script files for
"$FreeBSD: src" during the STALE_RC_FILES check.  If a script has such
a header, it is assumed to be a stale rc file.  The old behavior of
checking all scripts is still available when the -s flag is specified
to mergemaster.

I have EXTRA_RC_FILES, but it currently doesn't do anything with them.

Scot

Index: mergemaster.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v
retrieving revision 1.51
diff -u -r1.51 mergemaster.sh
--- mergemaster.sh	7 Mar 2004 10:10:19 -0000	1.51
+++ mergemaster.sh	26 Aug 2004 08:54:54 -0000
_at__at_ -790,7 +790,18 _at__at_
   cd "${DESTDIR}/etc/rc.d" &&
   for file in *; do
     if [ ! -e "${TEMPROOT}/etc/rc.d/${file}" ]; then
-      STALE_RC_FILES="${STALE_RC_FILES} ${file}"
+      case "${STRICT}" in
+      [Yy][Ee][Ss])
+        STALE_RC_FILES="${STALE_RC_FILES} ${file}"
+        ;;
+      '' | [Nn][Oo])
+        if grep -c "[$]${CVS_ID_TAG}: src" ${file} ; then
+          STALE_RC_FILES="${STALE_RC_FILES} ${file}"
+        else
+          EXTRA_RC_FILES="${EXTRA_RC_FILES} ${file}"
+        fi
+        ;;
+      esac
     fi
   done
   case "${STALE_RC_FILES}" in

Received on Fri Aug 27 2004 - 13:24:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:08 UTC