Compare commits
29 Commits
0.32.1
...
funtoo-ope
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d308a781f2 | ||
|
|
888bc07f7b | ||
|
|
8169cd89b1 | ||
|
|
e67ab2da48 | ||
|
|
8137d15c1a | ||
|
|
7447c63e02 | ||
|
|
6b78f4c8e0 | ||
|
|
e8b4dc22cb | ||
|
|
5fb4b03366 | ||
|
|
76581025ea | ||
|
|
a559af4ff9 | ||
|
|
35fe25ab06 | ||
|
|
a2e4cb2f89 | ||
|
|
0490a83134 | ||
|
|
0853c110e5 | ||
|
|
1a43ce11d0 | ||
|
|
46e504b403 | ||
|
|
fc1f3d14f4 | ||
|
|
b8a016aaba | ||
|
|
63f5256b59 | ||
|
|
c420f56856 | ||
|
|
5b0f323da9 | ||
|
|
d86853538a | ||
|
|
f2c0e700c6 | ||
|
|
b1de9d7324 | ||
|
|
5b4886d23e | ||
|
|
2a53efbc07 | ||
|
|
a530722f65 | ||
|
|
661e9cf002 |
@@ -1,3 +1,3 @@
|
|||||||
NAME= openrc
|
NAME= openrc
|
||||||
VERSION= 0.12
|
VERSION= 0.12.4
|
||||||
PKG= ${NAME}-${VERSION}
|
PKG= ${NAME}-${VERSION}
|
||||||
|
|||||||
@@ -1,2 +1,18 @@
|
|||||||
# Set to the hostname of this machine
|
# Set to the fully qualified domain name (e.g. "mybox.example.com") of this
|
||||||
|
# machine, if it has one, otherwise set to the machine name (e.g. "mybox").
|
||||||
|
# This hostname will be automatically added to /etc/hosts for the 127.0.0.1 and
|
||||||
|
# ::1 addresses.
|
||||||
|
|
||||||
hostname="localhost"
|
hostname="localhost"
|
||||||
|
|
||||||
|
# If your local system has other aliases for your local interfaces, you can
|
||||||
|
# add them here. These will also be added to /etc/hosts for 127.0.0.1 and ::1:
|
||||||
|
# Add aliases for other hosts to /etc/hosts directly. The networking scripts
|
||||||
|
# automatically generate the localhost lines only.
|
||||||
|
|
||||||
|
#aliases="mybox server1"
|
||||||
|
|
||||||
|
# Set to the NIS domain name of this machine, if it has one, otherwise leave
|
||||||
|
# commented out.
|
||||||
|
|
||||||
|
#nisdomainname="localdomain.com"
|
||||||
|
|||||||
11
etc/rc.conf.GNU-kFreeBSD
Normal file
11
etc/rc.conf.GNU-kFreeBSD
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
##############################################################################
|
||||||
|
# GNU/kFreeBSD SPECIFIC OPTIONS
|
||||||
|
|
||||||
|
# This is the subsystem type. Valid options on GNU/kFreeBSD:
|
||||||
|
# "" - nothing special
|
||||||
|
# "jail" - FreeBSD jails (not yet implemented)
|
||||||
|
# If this is commented out, automatic detection will be used.
|
||||||
|
#
|
||||||
|
# This should be set to the value representing the environment this file is
|
||||||
|
# PRESENTLY in, not the virtualization the environment is capable of.
|
||||||
|
#rc_sys=""
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
include ../mk/net.mk
|
include ../mk/net.mk
|
||||||
|
|
||||||
DIR= ${INITDIR}
|
DIR= ${INITDIR}
|
||||||
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in loopback.in \
|
SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in \
|
||||||
netmount.in root.in savecache.in swap.in swapfiles.in \
|
netmount.in root.in savecache.in swap.in swapfiles.in \
|
||||||
tmpfiles.setup.in swclock.in sysctl.in urandom.in ${SRCS-${OS}}
|
tmpfiles.setup.in swclock.in sysctl.in urandom.in ${SRCS-${OS}}
|
||||||
BIN= ${OBJS}
|
BIN= ${OBJS}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ migrate_to_run()
|
|||||||
|
|
||||||
clean_run()
|
clean_run()
|
||||||
{
|
{
|
||||||
|
[ "$RC_SYS" = VSERVER ] && return 0
|
||||||
local dir
|
local dir
|
||||||
dir=$(mktemp -d)
|
dir=$(mktemp -d)
|
||||||
mount --bind / $dir
|
mount --bind / $dir
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ _IFS="
|
|||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
use dev clock modules
|
use dev clock modules
|
||||||
keyword -jail -openvz -prefix -timeout -vserver -lxc
|
keyword -jail -openvz -prefix -timeout -vserver -lxc -uml
|
||||||
}
|
}
|
||||||
|
|
||||||
_abort() {
|
_abort() {
|
||||||
|
|||||||
@@ -1,19 +1,43 @@
|
|||||||
#!@SBINDIR@/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
# Copyright (c) 2009-2015 Funtoo Technologies
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Sets the hostname of the machine."
|
description="Sets the hostname of the machine."
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
keyword -prefix -lxc
|
need root
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
# HOSTNAME variable used to be defined in caps in conf.d/hostname.
|
hostname=${hostname-${HOSTNAME-localhost}}
|
||||||
# It is also a magic variable in bash.
|
out=$hostname
|
||||||
hostname=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
|
short=${hostname%%.*}
|
||||||
|
if [ "$short" != "$hostname" ]; then
|
||||||
|
out="$out $short"
|
||||||
|
fi
|
||||||
|
if [ "$nisdomainname" != "" ]; then
|
||||||
|
ebegin "Setting NIS domain name to $nisdomainname"
|
||||||
|
nisdomainname $nisdomainname
|
||||||
|
eend $? "Failed to set the NIS domain name"
|
||||||
|
fi
|
||||||
|
if [ "$short" != "localhost" ]; then
|
||||||
|
out="$out localhost"
|
||||||
|
fi
|
||||||
|
if [ "$hostname" != "localhost.localdomain" ]; then
|
||||||
|
out="$out localhost.localdomain"
|
||||||
|
fi
|
||||||
|
[ -n "$aliases" ] && out="$out $aliases"
|
||||||
|
ebegin "Configuring /etc/hosts"
|
||||||
|
[ -e /etc/hosts ] && sed -i -e '/[[:space:]]*127.0.0.1[[:space:]]/d' -e '/[[:space:]]*::1[[:space:]]/d' /etc/hosts
|
||||||
|
cat <<END >> /etc/hosts
|
||||||
|
127.0.0.1 $out
|
||||||
|
::1 $out
|
||||||
|
END
|
||||||
|
chmod 0644 /etc/hosts
|
||||||
|
eend $?
|
||||||
|
[ "$RC_SYS" = "LXC" ] && return 0
|
||||||
ebegin "Setting hostname to $hostname"
|
ebegin "Setting hostname to $hostname"
|
||||||
hostname "$hostname"
|
hostname "$short"
|
||||||
eend $? "Failed to set the hostname"
|
eend $? "Failed to set the hostname"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ depend()
|
|||||||
need fsck
|
need fsck
|
||||||
use lvm modules mtab
|
use lvm modules mtab
|
||||||
after lvm modules
|
after lvm modules
|
||||||
keyword -jail -openvz -prefix -vserver -lxc
|
keyword -jail -prefix -vserver -lxc
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
#!@SBINDIR@/runscript
|
|
||||||
# Copyright (c) 2013 William Hubbs <w.d.hubbs@gmail.com>
|
|
||||||
# Released under the 2-clause BSD license.
|
|
||||||
|
|
||||||
description="Configures the loopback interface."
|
|
||||||
|
|
||||||
depend()
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
start()
|
|
||||||
{
|
|
||||||
if [ "$RC_UNAME" = Linux ]; then
|
|
||||||
ebegin "Bringing up network interface lo"
|
|
||||||
if type ip > /dev/null 2>&1; then
|
|
||||||
ip addr add 127.0.0.1/8 dev lo brd + scope host
|
|
||||||
ip route add 127.0.0.0/8 dev lo scope host
|
|
||||||
ip link set lo up
|
|
||||||
else
|
|
||||||
ifconfig lo 127.0.0.1 netmask 255.0.0.0
|
|
||||||
route add -net 127.0.0.0 netmask 255.0.0.0 gw 127.0.0.1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
ebegin "Bringing up network interface lo0"
|
|
||||||
ifconfig lo0 127.0.0.1 netmask 255.0.0.0
|
|
||||||
route -q add -inet 127.0.0.0 -netmask 255.0.0.0 127.0.0.1
|
|
||||||
fi
|
|
||||||
eend $?
|
|
||||||
}
|
|
||||||
|
|
||||||
stop()
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,7 @@ depend()
|
|||||||
config /etc/fstab
|
config /etc/fstab
|
||||||
use afc-client amd autofs openvpn
|
use afc-client amd autofs openvpn
|
||||||
use dns
|
use dns
|
||||||
keyword -jail -prefix -vserver
|
keyword -jail -prefix -vserver -lxc
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#!@SBINDIR@/runscript
|
#!@PREFIX@/sbin/runscript
|
||||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
before bootmisc logger
|
before bootmisc logger
|
||||||
keyword -lxc -prefix -vserver
|
keyword -lxc -vserver
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
@@ -15,6 +15,14 @@ start()
|
|||||||
ebegin "Configuring kernel parameters"
|
ebegin "Configuring kernel parameters"
|
||||||
eindent
|
eindent
|
||||||
|
|
||||||
|
# default sysctl System V max shared memory to 1/4 of RAM:
|
||||||
|
mem_bytes=`awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo`
|
||||||
|
mem_max=`expr $mem_bytes / 4`
|
||||||
|
page_size=`getconf PAGE_SIZE`
|
||||||
|
shmall=`expr $mem_bytes / $page_size`
|
||||||
|
sysctl kernel.shmmax=$mem_max > /dev/null
|
||||||
|
sysctl kernel.shmall=$shmall > /dev/null
|
||||||
|
|
||||||
for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do
|
for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do
|
||||||
if [ -r "$conf" ]; then
|
if [ -r "$conf" ]; then
|
||||||
vebegin "applying $conf"
|
vebegin "applying $conf"
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ depend()
|
|||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "setting up tmpfiles.d entries for /dev"
|
ebegin "setting up tmpfiles.d entries for /dev"
|
||||||
@LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create --remove \
|
@LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create ${tmpfiles_opts}
|
||||||
${tmpfiles_opts}
|
|
||||||
eend $?
|
eend $?
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ depend()
|
|||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
ebegin "setting up tmpfiles.d entries"
|
ebegin "setting up tmpfiles.d entries"
|
||||||
@LIBEXECDIR@/sh/tmpfiles.sh --exclude-prefix=/dev --create --remove \
|
@LIBEXECDIR@/sh/tmpfiles.sh --exclude-prefix=/dev --create --remove --boot \
|
||||||
${tmpfiles_opts}
|
${tmpfiles_opts}
|
||||||
eend $?
|
eend $?
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
9
mk/os-GNU-kFreeBSD.mk
Normal file
9
mk/os-GNU-kFreeBSD.mk
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Copyright (c) 2008 Roy Marples <roy@marples.name>
|
||||||
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
|
# Generic definitions
|
||||||
|
|
||||||
|
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700
|
||||||
|
LIBDL= -Wl,-Bdynamic -ldl
|
||||||
|
LIBKVM?=
|
||||||
|
include ${MK}/os-BSD.mk
|
||||||
2
mk/os.mk
2
mk/os.mk
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Generic definitions
|
# Generic definitions
|
||||||
|
|
||||||
_OS_SH= uname -s
|
_OS_SH= uname -s | tr '/' '-'
|
||||||
_OS:= $(shell ${_OS_SH})
|
_OS:= $(shell ${_OS_SH})
|
||||||
OS?= ${_OS}
|
OS?= ${_OS}
|
||||||
include ${MK}/os-${OS}.mk
|
include ${MK}/os-${OS}.mk
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
include ../mk/net.mk
|
include ../mk/net.mk
|
||||||
|
|
||||||
BOOT= bootmisc fsck hostname localmount loopback \
|
BOOT= bootmisc fsck hostname localmount \
|
||||||
root swap swapfiles sysctl urandom ${BOOT-${OS}}
|
root swap swapfiles sysctl urandom ${BOOT-${OS}}
|
||||||
DEFAULT= local netmount
|
DEFAULT= local netmount
|
||||||
SHUTDOWN= savecache ${SHUTDOWN-${OS}}
|
SHUTDOWN= savecache ${SHUTDOWN-${OS}}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ cgroup_set_limits()
|
|||||||
|
|
||||||
cgroup_cleanup()
|
cgroup_cleanup()
|
||||||
{
|
{
|
||||||
yesno "${rc_cgroup_cleanup:-no}" && cgroup_running || return 0
|
cgroup_running || return 0
|
||||||
ebegin "starting cgroups cleanup"
|
ebegin "starting cgroups cleanup"
|
||||||
for sig in TERM QUIT INT; do
|
for sig in TERM QUIT INT; do
|
||||||
cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
|
cgroup_get_pids || { eend 0 "finished" ; return 0 ; }
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ while [ -n "$1" ]; do
|
|||||||
fi
|
fi
|
||||||
[ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" -a \
|
[ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" -a \
|
||||||
"$1" = "stop" ] && \
|
"$1" = "stop" ] && \
|
||||||
|
yesno "${rc_cgroup_cleanup}" && \
|
||||||
cgroup_cleanup
|
cgroup_cleanup
|
||||||
shift
|
shift
|
||||||
continue 2
|
continue 2
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
# Control creation, deletion, and cleaning of volatile and temporary files
|
# Control creation, deletion, and cleaning of volatile and temporary files
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012 Gentoo Foundation
|
# Copyright (c) 2012 Gentoo Foundation
|
||||||
|
# Released under the 2-clause BSD license.
|
||||||
#
|
#
|
||||||
# This instance based on the Arch Linux version:
|
# This instance is a pure-POSIX sh version, written by Robin H Johnson
|
||||||
|
# <robbat2@gentoo.org>, based on the Arch Linux version as of 2012/01/01:
|
||||||
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
|
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
|
||||||
# As of 2012/01/01
|
|
||||||
#
|
#
|
||||||
# See the tmpfiles.d manpage as well:
|
# See the tmpfiles.d manpage as well:
|
||||||
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
|
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
DRYRUN=0
|
DRYRUN=0
|
||||||
|
CHECKPATH="@LIBEXECDIR@/bin/checkpath"
|
||||||
|
|
||||||
checkprefix() {
|
checkprefix() {
|
||||||
n=$1
|
n=$1
|
||||||
@@ -43,19 +45,27 @@ relabel() {
|
|||||||
|
|
||||||
for path in ${paths}; do
|
for path in ${paths}; do
|
||||||
if [ -e "$path" ]; then
|
if [ -e "$path" ]; then
|
||||||
|
[ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
|
||||||
[ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
|
[ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
|
||||||
[ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
|
[ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
|
||||||
[ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
|
[ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
|
||||||
[ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_restorecon() {
|
||||||
|
local path=$1
|
||||||
|
if [ -x /sbin/restorecon ]; then
|
||||||
|
dryrun_or_real restorecon -F "$path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_b() {
|
_b() {
|
||||||
# Create a block device node if it doesn't exist yet
|
# Create a block device node if it doesn't exist yet
|
||||||
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||||
if [ ! -e "$path" ]; then
|
if [ ! -e "$path" ]; then
|
||||||
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
|
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
|
||||||
|
_restorecon "$path"
|
||||||
dryrun_or_real chown $uid:$gid $path
|
dryrun_or_real chown $uid:$gid $path
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -65,10 +75,22 @@ _c() {
|
|||||||
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||||
if [ ! -e "$path" ]; then
|
if [ ! -e "$path" ]; then
|
||||||
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
|
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
|
||||||
|
_restorecon "$path"
|
||||||
dryrun_or_real chown $uid:$gid $path
|
dryrun_or_real chown $uid:$gid $path
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_C() {
|
||||||
|
# recursively copy a file or directory
|
||||||
|
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||||
|
if [ ! -e "$path" ]; then
|
||||||
|
dryrun_or_real cp -r "$arg" "$path"
|
||||||
|
_restorecon "$path"
|
||||||
|
[ $uid != '-' ] && dryrun_or_real chown "$uid" "$path"
|
||||||
|
[ $gid != '-' ] && dryrun_or_real chgrp "$gid" "$path"
|
||||||
|
[ $mode != '-' ] && dryrun_or_real chmod "$mode" "$path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_f() {
|
_f() {
|
||||||
# Create a file if it doesn't exist yet
|
# Create a file if it doesn't exist yet
|
||||||
@@ -77,7 +99,7 @@ _f() {
|
|||||||
[ $CREATE -gt 0 ] || return 0
|
[ $CREATE -gt 0 ] || return 0
|
||||||
|
|
||||||
if [ ! -e "$path" ]; then
|
if [ ! -e "$path" ]; then
|
||||||
dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
|
dryrun_or_real $CHECKPATH -fq -m "$mode" -o "$uid:$gid" "$path"
|
||||||
[ -z "$arg" ] || _w "$@"
|
[ -z "$arg" ] || _w "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -88,7 +110,7 @@ _F() {
|
|||||||
|
|
||||||
[ $CREATE -gt 0 ] || return 0
|
[ $CREATE -gt 0 ] || return 0
|
||||||
|
|
||||||
dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path"
|
dryrun_or_real $CHECKPATH -Fq -m "$mode" -o "$uid:$gid" "$path"
|
||||||
[ -z "$arg" ] || _w "$@"
|
[ -z "$arg" ] || _w "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +121,8 @@ _d() {
|
|||||||
[ $CREATE -gt 0 ] || return 0
|
[ $CREATE -gt 0 ] || return 0
|
||||||
|
|
||||||
if [ ! -d "$path" ]; then
|
if [ ! -d "$path" ]; then
|
||||||
dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
|
dryrun_or_real mkdir -p "$path" 2>/dev/null
|
||||||
|
dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,10 +132,12 @@ _D() {
|
|||||||
|
|
||||||
if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
|
if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
|
||||||
dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
|
dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
|
||||||
|
_restorecon "$path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $CREATE -gt 0 ]; then
|
if [ $CREATE -gt 0 ]; then
|
||||||
dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path"
|
dryrun_or_real mkdir -p "$path" 2>/dev/null
|
||||||
|
dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +145,7 @@ _L() {
|
|||||||
# Create a symlink if it doesn't exist yet
|
# Create a symlink if it doesn't exist yet
|
||||||
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||||
[ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
|
[ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
|
||||||
|
_restorecon "$path"
|
||||||
}
|
}
|
||||||
|
|
||||||
_p() {
|
_p() {
|
||||||
@@ -129,8 +155,7 @@ _p() {
|
|||||||
[ $CREATE -gt 0 ] || return 0
|
[ $CREATE -gt 0 ] || return 0
|
||||||
|
|
||||||
if [ ! -p "$path" ]; then
|
if [ ! -p "$path" ]; then
|
||||||
dryrun_or_real mkfifo -m$mode "$path"
|
dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path"
|
||||||
dryrun_or_real chown "$uid:$gid" "$path"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +239,7 @@ _Z() {
|
|||||||
CHOPTS=-R relabel "$@"
|
CHOPTS=-R relabel "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
|
BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
|
||||||
EXCLUDE=
|
EXCLUDE=
|
||||||
PREFIX=
|
PREFIX=
|
||||||
FILE=
|
FILE=
|
||||||
@@ -230,11 +255,13 @@ tmpfiles_d=''
|
|||||||
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
|
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
|
||||||
for d in ${tmpfiles_dirs} ; do
|
for d in ${tmpfiles_dirs} ; do
|
||||||
[ -d $d ] && for f in ${d}/*.conf ; do
|
[ -d $d ] && for f in ${d}/*.conf ; do
|
||||||
[ "$f" = "$d/systemd.conf" ] && continue
|
case "${f##*/}" in
|
||||||
|
systemd.conf|systemd-*.conf) continue;;
|
||||||
|
esac
|
||||||
[ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
|
[ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}"
|
||||||
done # for f in ${d}
|
done # for f in ${d}
|
||||||
done # for d in ${tmpfiles_dirs}
|
done # for d in ${tmpfiles_dirs}
|
||||||
tmpfiles_basenames="`printf "${tmpfiles_basenames}\n" | sort | uniq`"
|
tmpfiles_basenames="$(printf "${tmpfiles_basenames}\n" | sort -u )"
|
||||||
|
|
||||||
for b in $tmpfiles_basenames ; do
|
for b in $tmpfiles_basenames ; do
|
||||||
real_f=''
|
real_f=''
|
||||||
@@ -247,6 +274,7 @@ done
|
|||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
--boot) BOOT=1 ;;
|
||||||
--create) CREATE=1 ;;
|
--create) CREATE=1 ;;
|
||||||
--remove) REMOVE=1 ;;
|
--remove) REMOVE=1 ;;
|
||||||
--clean) CLEAN=1 ;; # TODO: Not implemented
|
--clean) CLEAN=1 ;; # TODO: Not implemented
|
||||||
@@ -264,7 +292,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CREATE$REMOVE" = '00' ]; then
|
if [ "$CREATE$REMOVE" = '00' ]; then
|
||||||
printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
|
printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -281,21 +309,34 @@ for FILE in $tmpfiles_d ; do
|
|||||||
# Cmd Path Mode UID GID Age Argument
|
# Cmd Path Mode UID GID Age Argument
|
||||||
# d /run/user 0755 root root 10d -
|
# d /run/user 0755 root root 10d -
|
||||||
# Mode, UID, GID, Age, Argument may be omitted!
|
# Mode, UID, GID, Age, Argument may be omitted!
|
||||||
|
# If Cmd ends with !, the line is only processed if --boot is passed
|
||||||
|
|
||||||
# XXX: Upstream says whitespace is NOT permitted in the Path argument.
|
# XXX: Upstream says whitespace is NOT permitted in the Path argument.
|
||||||
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
|
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
|
||||||
while read cmd path mode uid gid age arg; do
|
while read cmd path mode uid gid age arg; do
|
||||||
LINENUM=$(( LINENUM+1 ))
|
LINENUM=$(( LINENUM+1 ))
|
||||||
|
FORCE=0
|
||||||
|
|
||||||
# Unless we have both command and path, skip this line.
|
# Unless we have both command and path, skip this line.
|
||||||
if [ -z "$cmd" -o -z "$path" ]; then
|
if [ -z "$cmd" -o -z "$path" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case $cmd in
|
||||||
|
\#*) continue ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
while [ ${#cmd} -gt 1 ]; do
|
||||||
|
case $cmd in
|
||||||
|
*!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] || continue 2 ;;
|
||||||
|
*+) cmd=${cmd%+}; FORCE=1; ;;
|
||||||
|
*) warninvalid ; continue 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# whine about invalid entries
|
# whine about invalid entries
|
||||||
case $cmd in
|
case $cmd in
|
||||||
f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
|
f|F|w|d|D|p|L|c|C|b|x|X|r|R|z|Z) ;;
|
||||||
\#) continue ;;
|
|
||||||
*) warninvalid ; continue ;;
|
*) warninvalid ; continue ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -304,7 +345,7 @@ for FILE in $tmpfiles_d ; do
|
|||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
p|f|F) mode=0644 ;;
|
p|f|F) mode=0644 ;;
|
||||||
d|D) mode=0755 ;;
|
d|D) mode=0755 ;;
|
||||||
z|Z|x|r|R|L) ;;
|
C|z|Z|x|r|R|L) ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -316,6 +357,13 @@ for FILE in $tmpfiles_d ; do
|
|||||||
|
|
||||||
[ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
|
[ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
|
||||||
[ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
|
[ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
|
||||||
|
|
||||||
|
if [ $FORCE -gt 0 ]; then
|
||||||
|
case $cmd in
|
||||||
|
p|L|c|b) [ -f "$path" ] && dryrun_or_real rm -f "$path"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
|
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
|
||||||
_$cmd "$@"
|
_$cmd "$@"
|
||||||
rc=$?
|
rc=$?
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "librc.h"
|
#include "librc.h"
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__) || defined (__GLIBC__)
|
||||||
static bool
|
static bool
|
||||||
pid_is_exec(pid_t pid, const char *exec)
|
pid_is_exec(pid_t pid, const char *exec)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -856,7 +856,7 @@ rc_deptree_update(void)
|
|||||||
* work for them. This doesn't stop them from being run directly. */
|
* work for them. This doesn't stop them from being run directly. */
|
||||||
if (sys) {
|
if (sys) {
|
||||||
len = strlen(sys);
|
len = strlen(sys);
|
||||||
nosys = xmalloc(len + 1);
|
nosys = xmalloc(len + 2);
|
||||||
nosys[0] = '-';
|
nosys[0] = '-';
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
nosys[i + 1] = (char)tolower((unsigned char)sys[i]);
|
nosys[i + 1] = (char)tolower((unsigned char)sys[i]);
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ file_regex(const char *file, const char *regex)
|
|||||||
str += strlen(str) + 1;
|
str += strlen(str) + 1;
|
||||||
/* len is the size of allocated buffer and we don't
|
/* len is the size of allocated buffer and we don't
|
||||||
want call regexec BUFSIZE times. find next str */
|
want call regexec BUFSIZE times. find next str */
|
||||||
while (*str == '\0' && str < line + len)
|
while (str < line + len && *str == '\0')
|
||||||
str++;
|
str++;
|
||||||
} while (str < line + len);
|
} while (str < line + len);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
# include <sys/statvfs.h>
|
# include <sys/statvfs.h>
|
||||||
# define statfs statvfs
|
# define statfs statvfs
|
||||||
# define F_FLAGS f_flag
|
# define F_FLAGS f_flag
|
||||||
#elif defined (__linux__)
|
#elif defined (__linux__) || defined (__GLIBC__)
|
||||||
# include <mntent.h>
|
# include <mntent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ find_mounts(struct args *args)
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined (__linux__)
|
#elif defined (__linux__) || defined (__GLIBC__)
|
||||||
static struct mntent *
|
static struct mntent *
|
||||||
getmntfile(const char *file)
|
getmntfile(const char *file)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__) || defined(__GLIBC__)
|
||||||
# include <pty.h>
|
# include <pty.h>
|
||||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
# include <util.h>
|
# include <util.h>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__) || defined(__GLIBC__)
|
||||||
# include <pty.h>
|
# include <pty.h>
|
||||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
# include <util.h>
|
# include <util.h>
|
||||||
|
|||||||
@@ -316,14 +316,12 @@ get_pid(const char *pidfile, bool quiet)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((fp = fopen(pidfile, "r")) == NULL) {
|
if ((fp = fopen(pidfile, "r")) == NULL) {
|
||||||
if (!quiet)
|
ewarnv("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
|
||||||
eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fscanf(fp, "%d", &pid) != 1) {
|
if (fscanf(fp, "%d", &pid) != 1) {
|
||||||
if (!quiet)
|
ewarnv("%s: no pid found in `%s'", applet, pidfile);
|
||||||
eerror("%s: no pid found in `%s'", applet, pidfile);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -461,7 +459,7 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
|||||||
{
|
{
|
||||||
if ((nrunning = do_stop(exec, argv,
|
if ((nrunning = do_stop(exec, argv,
|
||||||
pid, uid, 0, true, false,
|
pid, uid, 0, true, false,
|
||||||
true)) == 0)
|
test)) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -1088,7 +1086,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
pid = 0;
|
pid = 0;
|
||||||
|
|
||||||
if (do_stop(exec, (const char * const *)margv, pid, uid,
|
if (do_stop(exec, (const char * const *)margv, pid, uid,
|
||||||
0, true, false, true) > 0)
|
0, true, false, test) > 0)
|
||||||
eerrorx("%s: %s is already running", applet, exec);
|
eerrorx("%s: %s is already running", applet, exec);
|
||||||
|
|
||||||
if (test) {
|
if (test) {
|
||||||
@@ -1366,7 +1364,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
} else
|
} else
|
||||||
pid = 0;
|
pid = 0;
|
||||||
if (do_stop(exec, (const char *const *)margv,
|
if (do_stop(exec, (const char *const *)margv,
|
||||||
pid, uid, 0, true, false, true) > 0)
|
pid, uid, 0, true, false, test) > 0)
|
||||||
alive = true;
|
alive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user