Skip to content
Permalink
Browse files

Add a global switch in ports.conf which controls what kind of startup…

…item

will be generated by default. This may be overridden in particular portfiles
by the startupitem.type key. Legal values are "default", "systemstarter", or "launchd".
In the event of "default", a type appropriate to the platform will be chosen.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@14485 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
jdberry committed Oct 8, 2005
1 parent 6b4b4d0 commit cff765bb426b5b0230d6e9bb4c11fb046aeba4b6
Showing with 38 additions and 21 deletions.
  1. +7 −0 doc/ports.conf.in
  2. +10 −3 src/darwinports1.0/darwinports.tcl
  3. +2 −2 src/port1.0/portdestroot.tcl
  4. +19 −16 src/port1.0/portstartupitem.tcl
@@ -48,3 +48,10 @@ rsync_dir dpupdate1/base/

# Rsync options
rsync_options "-rtzv --delete --delete-after"

# Options for generated startup items
# startupitem_type may be "default", "systemstarter", or "launchd";
# if the option is empty or "default" then a startupitem type appropriate
# to the platform will be chosen. Tiger will default to launchd, while
# older mac ox X systems will default to systemstarter.
startupitem_type default
@@ -1,5 +1,5 @@
# darwinports.tcl
# $Id: darwinports.tcl,v 1.197 2005/10/05 13:32:59 jberry Exp $
# $Id: darwinports.tcl,v 1.198 2005/10/08 21:29:35 jberry Exp $
#
# Copyright (c) 2002 Apple Computer, Inc.
# Copyright (c) 2004 - 2005 Paul Guyot, <pguyot@kallisys.net>.
@@ -37,8 +37,8 @@ package require darwinports_index 1.0

namespace eval darwinports {
namespace export bootstrap_options portinterp_options open_dports ui_priorities
variable bootstrap_options "portdbpath libpath binpath auto_path sources_conf prefix portdbformat portinstalltype portarchivemode portarchivepath portarchivetype portautoclean porttrace portverbose destroot_umask variants_conf rsync_server rsync_options rsync_dir xcodeversion xcodebuildcmd"
variable portinterp_options "portdbpath portpath portbuildpath auto_path prefix portsharepath registry.path registry.format registry.installtype portarchivemode portarchivepath portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server rsync_options rsync_dir"
variable bootstrap_options "portdbpath libpath binpath auto_path sources_conf prefix portdbformat portinstalltype portarchivemode portarchivepath portarchivetype portautoclean porttrace portverbose destroot_umask variants_conf rsync_server rsync_options rsync_dir startupitem_type xcodeversion xcodebuildcmd"
variable portinterp_options "portdbpath portpath portbuildpath auto_path prefix portsharepath registry.path registry.format registry.installtype portarchivemode portarchivepath portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server rsync_options rsync_dir startupitem_type"
# deferred options are only computed when needed.
# they are not exported to the trace thread.
# they are not exported to the interpreter in system_options array.
@@ -179,6 +179,7 @@ proc dportinit {up_ui_options up_options up_variations} {
global darwinports::registry.path
global darwinports::sources
global darwinports::sources_conf
global darwinports::startupitem_type
global darwinports::destroot_umask
global darwinports::libpath
global darwinports::prefix
@@ -416,6 +417,12 @@ proc dportinit {up_ui_options up_options up_variations} {
set env(PATH) "$binpath"
}

# Set startupitem default type (can be overridden by portfile)
if {![info exists startupitem_type]} {
set darwinports::startupitem_type "default"
global darwinports::startupitem_type
}

# ENV cleanup.
set keepenvkeys { DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH
DYLD_FALLBACK_LIBRARY_PATH DYLD_FRAMEWORK_PATH
@@ -1,6 +1,6 @@
# et:ts=4
# portdestroot.tcl
# $Id: portdestroot.tcl,v 1.27 2005/08/27 00:07:30 pguyot Exp $
# $Id: portdestroot.tcl,v 1.28 2005/10/08 21:29:35 jberry Exp $
#
# Copyright (c) 2002 - 2003 Apple Computer, Inc.
# Copyright (c) 2004 - 2005 Robert Shaw <rshaw@opendarwin.org>
@@ -66,7 +66,7 @@ default startupitem.stop ""
default startupitem.restart ""
default startupitem.requires ""
default startupitem.executable ""
default startupitem.type ""
default startupitem.type {$system_options(startupitem_type)}
default startupitem.pidfile ""
default startupitem.logfile ""
default startupitem.logevents no
@@ -1,7 +1,7 @@
# et:ts=4
# portstartupitem.tcl
#
# $Id: portstartupitem.tcl,v 1.18 2005/10/08 20:00:29 jberry Exp $
# $Id: portstartupitem.tcl,v 1.19 2005/10/08 21:29:35 jberry Exp $
#
# Copyright (c) 2004, 2005 Markus W. Weissman <mww@opendarwin.org>,
# Copyright (c) 2005 Robert Shaw <rshaw@opendarwin.org>,
@@ -573,27 +573,30 @@ proc startupitem_create {args} {
global UI_PREFIX
global startupitem.type os.platform

set startupitem.type [string tolower ${startupitem.type}]

# Calculate a default value for startupitem.type
# If the option has already been set, default will do nothing
switch -exact ${os.platform} {
darwin {
set enableLaunchd ${portutil::autoconf::enable_launchd_support}
set haveLaunchd ${portutil::autoconf::have_launchd}

if { [tbool enableLaunchd] && [tbool haveLaunchd] } {
default startupitem.type "launchd"
} else {
default startupitem.type "SystemStarter"
if {${startupitem.type} == "default" || ${startupitem.type} == ""} {
switch -exact ${os.platform} {
darwin {
set enableLaunchd ${portutil::autoconf::enable_launchd_support}
set haveLaunchd ${portutil::autoconf::have_launchd}

if { [tbool enableLaunchd] && [tbool haveLaunchd] } {
set startupitem.type "launchd"
} else {
set startupitem.type "systemstarter"
}
}
default {
set startupitem.type "rcng"
}
}
default {
default startupitem.type "RCng"
}
}

ui_msg "$UI_PREFIX [msgcat::mc "Creating ${startupitem.type} control script"]"

switch -- [string tolower ${startupitem.type}] {
switch -- ${startupitem.type} {
launchd { startupitem_create_darwin_launchd }
systemstarter { startupitem_create_darwin_systemstarter }
rcng { startupitem_create_rcng }

0 comments on commit cff765b

Please sign in to comment.
You can’t perform that action at this time.