Subject: misc/4413: rc.lkm should be tidier
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthias Scheler <tron@lyssa.owl.de>
List: netbsd-bugs
Date: 11/02/1997 17:40:53
>Number:         4413
>Category:       misc
>Synopsis:       rc.lkm should be tidier
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Nov  2 08:50:01 1997
>Last-Modified:
>Originator:     Matthias Scheler
>Organization:
Mario Kemper Maintenance Project
>Release:        971026
>Environment:
System: NetBSD lyssa 1.3_ALPHA NetBSD 1.3_ALPHA (LYSSA) #1: Thu Oct 30 10:36:30 MET 1997 tron@lyssa:/src/src/sys/arch/i386/compile/LYSSA i386

>Description:
Loading modules via "rc.lkm" leaves several linked module files behind which
are (at least in most cases) not required any more. Even worse they are
created in the directory in which the module resides per default. The
included patch allows to specify "TEMP" as output in "lkm.conf". In this
case the linked image will be created in "/tmp" and removed afterwards.

>How-To-Repeat:
Boot a 1.3 system which loads several modules via "rc.lkm".

>Fix:
*** src/etc/rc.lkm.orig	Sat Nov  1 18:20:32 1997
--- src/etc/rc.lkm	Sun Nov  2 17:07:52 1997
***************
*** 18,24 ****
  			elif [ -f "/usr/lkm/$path" ]; then
  				path="/usr/lkm/$path"
  			else
! 				echo "couldn't find module $path";
  			fi
  			;;
  		esac
--- 18,24 ----
  			elif [ -f "/usr/lkm/$path" ]; then
  				path="/usr/lkm/$path"
  			else
! 				echo "couldn't find module $path"
  			fi
  			;;
  		esac
***************
*** 51,57 ****
  		-)
  			;;
  		*)
! 			cmd="$cmd -o $output"
  			;;
  		esac
  
--- 51,61 ----
  		-)
  			;;
  		*)
! 			if [ "$output" = TEMP ]; then
! 				cmd="$cmd -o /tmp/lkm.$$"
! 			else
! 				cmd="$cmd -o $output"
! 			fi
  			;;
  		esac
  
***************
*** 60,66 ****
  			when=BEFORENET
  			;;
  		[A-Z]*)
! 			;;
  		*)
  			echo "invalid \"when\" field in /etc/lkm.conf - $path not loaded!"
  			continue
--- 64,70 ----
  			when=BEFORENET
  			;;
  		[A-Z]*)
! 				;;
  		*)
  			echo "invalid \"when\" field in /etc/lkm.conf - $path not loaded!"
  			continue
***************
*** 73,78 ****
--- 77,83 ----
  
  		echo -n "`basename $path .o`: "
  		$cmd $path
+ 		rm -f /tmp/lkm.$$
  	done
  
  ) < /etc/lkm.conf
>Audit-Trail:
>Unformatted: