mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-21 01:03:42 +00:00
back out the localkg changes until things have settled.
Discussed with: mtm
This commit is contained in:
parent
efc7f75e5a
commit
e193a85e5b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132716
13
UPDATING
13
UPDATING
|
@ -23,19 +23,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 5.x IS SLOW:
|
||||||
modules implementing network interfaces must be recompiled as
|
modules implementing network interfaces must be recompiled as
|
||||||
a result.
|
a result.
|
||||||
|
|
||||||
20040724:
|
|
||||||
The rc.d/localpkg script now "does the right thing" with respect
|
|
||||||
to ports rc.d scripts. The most disruptive change is that scripts
|
|
||||||
ending in *.sh are sourced in the same shell as rc.d/localpkg (as
|
|
||||||
opposed to a subshell) and may cause the script to end prematurely
|
|
||||||
if a script calls exit. Some broken scripts may not recognize the
|
|
||||||
'fast' prefix to a command. The first problem can be fixed by simply
|
|
||||||
renaming the script so that it doesn't have a '.sh' ending. Another
|
|
||||||
temporary work-arround is to completely remove the 'PROVIDE' line
|
|
||||||
from the script. If you notice a broken ports rc.d script please
|
|
||||||
notify the maintainer. Legacy scripts should not be affected.
|
|
||||||
__FreeBSD_version bumped to 502124.
|
|
||||||
|
|
||||||
20040716:
|
20040716:
|
||||||
The sound device drivers are renamed. `sound' is always required,
|
The sound device drivers are renamed. `sound' is always required,
|
||||||
while `snd_*' should be configured accordingly to your hardware.
|
while `snd_*' should be configured accordingly to your hardware.
|
||||||
|
|
|
@ -11,120 +11,31 @@
|
||||||
. /etc/rc.subr
|
. /etc/rc.subr
|
||||||
|
|
||||||
name="localpkg"
|
name="localpkg"
|
||||||
_arg1="$1"
|
start_cmd="pkg_start"
|
||||||
|
stop_cmd="pkg_stop"
|
||||||
# script_is_rcd script
|
|
||||||
# Checks that script is an rc.d style script.
|
|
||||||
# Returns 0 if it is, otherwise, it returns 1.
|
|
||||||
#
|
|
||||||
script_is_rcd()
|
|
||||||
{
|
|
||||||
local _s match
|
|
||||||
_s="$1"
|
|
||||||
|
|
||||||
[ -z "$_s" ] && return 1
|
|
||||||
match=`grep -I -c -m1 '^# PROVIDE:' "$_s" 2> /dev/null`
|
|
||||||
[ "$match" = "1" ] && return 0
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# cooked_scriptlist type
|
|
||||||
# Uses values from rc.conf(5) to prepare a list of scripts to
|
|
||||||
# execute. It assumes the global variable script_name_sep and IFS are set
|
|
||||||
# properly. If type is set to the string "rcd" the list will contain only
|
|
||||||
# rc.d style scripts and they will be ordered according to thier
|
|
||||||
# dependencies. If it is set to "rcOG" then it will contain
|
|
||||||
# only old style ports startup scripts. The list is echoed on stdout.
|
|
||||||
#
|
|
||||||
cooked_scriptlist()
|
|
||||||
{
|
|
||||||
local _type slist fpattern skip
|
|
||||||
|
|
||||||
slist=""
|
|
||||||
_type="$1"
|
|
||||||
case "$_type" in
|
|
||||||
rcd)
|
|
||||||
fpattern="*"
|
|
||||||
;;
|
|
||||||
rcOG)
|
|
||||||
fpattern="*.sh"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
for dir in ${local_startup}; do
|
|
||||||
if [ -d "${dir}" ]; then
|
|
||||||
for script in ${dir}/${fpattern}; do
|
|
||||||
|
|
||||||
# Weed out scripts that don't belong in the
|
|
||||||
# category that we are preparing.
|
|
||||||
#
|
|
||||||
if [ "$_type" = "rcd" ]; then
|
|
||||||
case "$script" in
|
|
||||||
*.sample|*-dist)
|
|
||||||
continue;;
|
|
||||||
esac
|
|
||||||
script_is_rcd "$script" || continue
|
|
||||||
else
|
|
||||||
script_is_rcd "$script" && continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
slist="${slist}${script_name_sep}${script}"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# If this is an rc.d list put the scripts in the right order.
|
|
||||||
#
|
|
||||||
if [ "$_type" = "rcd" ]; then
|
|
||||||
skip="-s nostart"
|
|
||||||
[ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && \
|
|
||||||
skip="$skip -s nojail"
|
|
||||||
|
|
||||||
# Some scripts do not define a FreeBSD keyword, so we can't
|
|
||||||
# specify it in a keep list.
|
|
||||||
slist=`/sbin/rcorder ${skip} ${slist} 2>/dev/null`
|
|
||||||
|
|
||||||
# Substitute the newlines used by rcorder(8) with the
|
|
||||||
# script separator.
|
|
||||||
slist=`echo $slist | /usr/bin/tr "\n" "$script_name_sep"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n $slist
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_start()
|
pkg_start()
|
||||||
{
|
{
|
||||||
local slist
|
# For each dir in $local_startup, search for init scripts matching *.sh
|
||||||
|
#
|
||||||
case ${local_startup} in
|
case ${local_startup} in
|
||||||
[Nn][Oo] | '')
|
[Nn][Oo] | '')
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
echo -n 'Local package initialization:'
|
||||||
slist=""
|
slist=""
|
||||||
if [ -z "${script_name_sep}" ]; then
|
if [ -z "${script_name_sep}" ]; then
|
||||||
script_name_sep=" "
|
script_name_sep=" "
|
||||||
fi
|
fi
|
||||||
|
for dir in ${local_startup}; do
|
||||||
# Do rc.d style scripts.
|
if [ -d "${dir}" ]; then
|
||||||
#
|
for script in ${dir}/*.sh; do
|
||||||
script_save_sep="$IFS"
|
slist="${slist}${script_name_sep}${script}"
|
||||||
IFS="${script_name_sep}"
|
done
|
||||||
slist=`cooked_scriptlist rcd`
|
fi
|
||||||
debug "localpkg rc.d scripts: $slist"
|
|
||||||
for script in ${slist}; do
|
|
||||||
run_rc_script "$script" "$_arg1"
|
|
||||||
done
|
done
|
||||||
IFS="${script_save_sep}"
|
|
||||||
|
|
||||||
# Do old-style ports startup scripts.
|
|
||||||
#
|
|
||||||
echo -n 'Local package initialization:'
|
|
||||||
script_save_sep="$IFS"
|
script_save_sep="$IFS"
|
||||||
IFS="${script_name_sep}"
|
IFS="${script_name_sep}"
|
||||||
slist=`cooked_scriptlist rcOG`
|
|
||||||
debug "localpkg rcOG scripts: $slist"
|
|
||||||
for script in ${slist}; do
|
for script in ${slist}; do
|
||||||
if [ -x "${script}" ]; then
|
if [ -x "${script}" ]; then
|
||||||
(set -T
|
(set -T
|
||||||
|
@ -142,24 +53,26 @@ pkg_start()
|
||||||
|
|
||||||
pkg_stop()
|
pkg_stop()
|
||||||
{
|
{
|
||||||
local slist
|
echo -n 'Shutting down daemon processes:'
|
||||||
|
|
||||||
# For each dir in $local_startup, search for init scripts matching *.sh
|
# For each dir in $local_startup, search for init scripts matching *.sh
|
||||||
case ${local_startup} in
|
case ${local_startup} in
|
||||||
[Nn][Oo] | '')
|
[Nn][Oo] | '')
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
slist=""
|
||||||
if [ -z "${script_name_sep}" ]; then
|
if [ -z "${script_name_sep}" ]; then
|
||||||
script_name_sep=" "
|
script_name_sep=" "
|
||||||
fi
|
fi
|
||||||
|
for dir in ${local_startup}; do
|
||||||
# Do old-style scripts
|
if [ -d "${dir}" ]; then
|
||||||
#
|
for script in ${dir}/*.sh; do
|
||||||
|
slist="${slist}${script_name_sep}${script}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
script_save_sep="$IFS"
|
script_save_sep="$IFS"
|
||||||
IFS="${script_name_sep}"
|
IFS="${script_name_sep}"
|
||||||
slist=`cooked_scriptlist rcOG`
|
|
||||||
debug "localpkg rcOG scripts: $slist"
|
|
||||||
echo -n 'Shutting down local packages:'
|
|
||||||
for script in `reverse_list ${slist}`; do
|
for script in `reverse_list ${slist}`; do
|
||||||
if [ -x "${script}" ]; then
|
if [ -x "${script}" ]; then
|
||||||
(set -T
|
(set -T
|
||||||
|
@ -169,35 +82,9 @@ pkg_stop()
|
||||||
done
|
done
|
||||||
IFS="${script_save_sep}"
|
IFS="${script_save_sep}"
|
||||||
echo '.'
|
echo '.'
|
||||||
|
|
||||||
# Do rc.d style scripts
|
|
||||||
#
|
|
||||||
script_save_sep="$IFS"
|
|
||||||
IFS="${script_name_sep}"
|
|
||||||
slist=`cooked_scriptlist rcd`
|
|
||||||
debug "localpkg rc.d scripts: $slist"
|
|
||||||
for script in `reverse_list ${slist}`; do
|
|
||||||
run_rc_script "$script" $_arg1
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
load_rc_config $name
|
load_rc_config $name
|
||||||
|
run_rc_command "$1"
|
||||||
# We can't use the normal rc.subr(8) start/stop plumbing
|
|
||||||
# because we call run_rc_script(), which unsets all the
|
|
||||||
# global variables that said plumbing needs.
|
|
||||||
#
|
|
||||||
case "$1" in
|
|
||||||
start|faststart)
|
|
||||||
pkg_start
|
|
||||||
;;
|
|
||||||
stop|faststop)
|
|
||||||
pkg_stop
|
|
||||||
;;
|
|
||||||
restart|fastrestart)
|
|
||||||
pkg_stop
|
|
||||||
pkg_start
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
* scheme is: <major><two digit minor><0 if release branch, otherwise 1>xx
|
* scheme is: <major><two digit minor><0 if release branch, otherwise 1>xx
|
||||||
*/
|
*/
|
||||||
#undef __FreeBSD_version
|
#undef __FreeBSD_version
|
||||||
#define __FreeBSD_version 502124 /* Master, propagated to newvers */
|
#define __FreeBSD_version 502123 /* Master, propagated to newvers */
|
||||||
|
|
||||||
#ifndef LOCORE
|
#ifndef LOCORE
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
Loading…
Reference in a new issue