--- b/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -58,7 +58,7 @@ notify 0 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "ethernet"; - action "service dhclient quietstart $subsystem"; + action "service -L dhclient quietstart $subsystem"; }; # @@ -77,7 +77,7 @@ notify 0 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "802.11"; - action "service dhclient quietstart $subsystem"; + action "service -L dhclient quietstart $subsystem"; }; # An entry like this might be in a different file, but is included here @@ -95,11 +95,11 @@ detach 100 { # When a USB Bluetooth dongle appears, activate it attach 100 { device-name "ubt[0-9]+"; - action "service bluetooth quietstart $device-name"; + action "service -L bluetooth quietstart $device-name"; }; detach 100 { device-name "ubt[0-9]+"; - action "service bluetooth quietstop $device-name"; + action "service -L bluetooth quietstop $device-name"; }; # Firmware downloader for Atheros AR3011 based USB Bluetooth devices @@ -112,11 +112,11 @@ detach 100 { # When a USB keyboard arrives, attach it as the console keyboard. attach 100 { device-name "ukbd0"; - action "service syscons setkeyboard /dev/ukbd0"; + action "service -L syscons setkeyboard /dev/ukbd0"; }; detach 100 { device-name "ukbd0"; - action "service syscons setkeyboard /dev/kbd0"; + action "service -L syscons setkeyboard /dev/kbd0"; }; notify 100 { @@ -125,7 +125,7 @@ notify 100 { match "type" "CREATE"; match "cdev" "atp[0-9]+"; - action "service moused quietstart $cdev"; + action "service -L moused quietstart $cdev"; }; notify 100 { @@ -134,7 +134,7 @@ notify 100 { match "type" "CREATE"; match "cdev" "ums[0-9]+"; - action "service moused quietstart $cdev"; + action "service -L moused quietstart $cdev"; }; notify 100 { @@ -143,7 +143,7 @@ notify 100 { match "type" "CREATE"; match "cdev" "wsp[0-9]+"; - action "service moused quietstart $cdev"; + action "service -L moused quietstart $cdev"; }; notify 100 { @@ -152,7 +152,7 @@ notify 100 { match "type" "DESTROY"; match "cdev" "ums[0-9]+"; - action "service moused stop $cdev"; + action "service -L moused stop $cdev"; }; # This entry starts the ColdSync tool in daemon mode. Make sure you have an up @@ -219,7 +219,7 @@ nomatch 10 { notify 10 { match "system" "ACPI"; match "subsystem" "ACAD"; - action "service power_profile $notify"; + action "service -L power_profile $notify"; }; # Notify all users before beginning emergency shutdown when we get @@ -300,7 +300,7 @@ notify 10 { notify 0 { match "system" "RCTL"; match "rule" "user:770:swap:.*"; - action "service postgresql restart"; + action "service -L postgresql restart"; }; # Discard autofs caches, useful for the -media special map. --- b/sbin/devd/devmatch.conf +++ b/sbin/devd/devmatch.conf @@ -9,7 +9,7 @@ # # Generic NOMATCH event nomatch 100 { - action "service devmatch quietstart '?'$_"; + action "service -L devmatch quietstart '?'$_"; }; # Add the following to devd.conf to prevent this from running: --- b/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -44,17 +44,19 @@ usage () { echo '-e Show services that are enabled' echo "-R Stop and start enabled $local_startup services" echo "-l List all scripts in /etc/rc.d and $local_startup" + echo "-L Disable environment variable definitions from login.conf" echo '-r Show the results of boot time rcorder' echo '-v Verbose' echo '' } -while getopts 'j:ehlrRv' COMMAND_LINE_ARGUMENT ; do +while getopts 'j:ehlLrRv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in j) JAIL="${OPTARG}" ;; e) ENABLED=eopt ;; h) usage ; exit 0 ;; l) LIST=lopt ;; + L) DISABLE_LOGIN=1 ;; r) RCORDER=ropt ;; R) RESTART=Ropt ;; v) VERBOSE=vopt ;; @@ -165,7 +167,11 @@ cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - exec env -i -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" + if [ -n "${DISABLE_LOGIN}" ]; then + exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" + else + exec env -i -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" + fi fi done