Hi all,
I run Arch linux on notebook and I use multiple network profiles. I needed to 
start some daemons just with certain profile (like ftp server, sshd etc.) so 
I have edited netcfg script to use new variable PROFILE_DAEMONS from network 
profile. It's mostly just copy & paste from initscripts so syntax is same 
like the one of DAEMONS variable in rc.conf.
And it works fine here ;).
Patches are attached

Ota
--- netcfg-old	2007-01-29 23:25:24.000000000 +0100
+++ netcfg	2007-03-06 10:33:47.000000000 +0100
@@ -42,3 +42,3 @@
 
-	unset GATEWAY IFOPTS
+	unset GATEWAY IFOPTS PROFILE_DAEMONS
 	. $STATE_DIR/$INTERFACE
@@ -47,2 +47,11 @@
 
+  # Shutdown daemons
+  let [EMAIL PROTECTED]
+	while [[ i -ge 0 ]]; do
+	  if [[ `echo ${PROFILE_DAEMONS[$i]} | grep '^[^\!]' | wc -l` -eq 1 ]]; then
+	    /etc/rc.d/[EMAIL PROTECTED] stop
+	  fi
+	  let i=i-1
+	done
+
 	# bring down the default route (gateway)
@@ -105,2 +114,3 @@
 	unset GATEWAY HOSTNAME DOMAIN DNS1 DNS2
+	unset PROFILE_DAEMONS
 	. $PROFILE_DIR/$1
@@ -179,2 +189,14 @@
 
+  # Start profile daemons
+  for daemon in "[EMAIL PROTECTED]"; do
+	  if [ "$daemon" = "${daemon#!}" ]; then
+	    if [ "$daemon" = "[EMAIL PROTECTED]" ]; then
+	      /etc/rc.d/$daemon start
+	    else
+	      stat_bkgd "Starting ${daemon:1}"
+	      (/etc/rc.d/${daemon:1} start) &>/dev/null &
+	    fi
+	  fi
+	done
+
 	# Save the info in /var/run so we can shut it down later
--- template-old	2007-03-06 10:14:45.000000000 +0100
+++ template	2007-03-06 10:36:14.000000000 +0100
@@ -19,2 +19,5 @@
 
+# Daemons to start & stop with profile
+PROFILE_DAEMONS=()
+
 # Wireless Settings (optional)

Attachment: pgpzRbiLv3vOS.pgp
Description: PGP signature

_______________________________________________
arch mailing list
arch@archlinux.org
http://www.archlinux.org/mailman/listinfo/arch

Reply via email to