Compare commits
14 Commits
openrc-0.1
...
funtoo-ope
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d308a781f2 | ||
|
|
888bc07f7b | ||
|
|
8169cd89b1 | ||
|
|
e67ab2da48 | ||
|
|
8137d15c1a | ||
|
|
7447c63e02 | ||
|
|
6b78f4c8e0 | ||
|
|
e8b4dc22cb | ||
|
|
5fb4b03366 | ||
|
|
76581025ea | ||
|
|
a559af4ff9 | ||
|
|
35fe25ab06 | ||
|
|
a2e4cb2f89 | ||
|
|
0490a83134 |
@@ -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"
|
||||
|
||||
# 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"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
include ../mk/net.mk
|
||||
|
||||
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 \
|
||||
tmpfiles.setup.in swclock.in sysctl.in urandom.in ${SRCS-${OS}}
|
||||
BIN= ${OBJS}
|
||||
|
||||
@@ -1,19 +1,43 @@
|
||||
#!@SBINDIR@/runscript
|
||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
||||
#!@PREFIX@/sbin/runscript
|
||||
# Copyright (c) 2009-2015 Funtoo Technologies
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
description="Sets the hostname of the machine."
|
||||
|
||||
depend() {
|
||||
keyword -prefix -lxc
|
||||
need root
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
# HOSTNAME variable used to be defined in caps in conf.d/hostname.
|
||||
# It is also a magic variable in bash.
|
||||
hostname=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
|
||||
hostname=${hostname-${HOSTNAME-localhost}}
|
||||
out=$hostname
|
||||
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"
|
||||
hostname "$hostname"
|
||||
hostname "$short"
|
||||
eend $? "Failed to set the hostname"
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
keyword -jail -prefix -vserver
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
#!@SBINDIR@/runscript
|
||||
#!@PREFIX@/sbin/runscript
|
||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
depend()
|
||||
{
|
||||
before bootmisc logger
|
||||
keyword -lxc -prefix -vserver
|
||||
keyword -lxc -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
@@ -15,6 +15,14 @@ start()
|
||||
ebegin "Configuring kernel parameters"
|
||||
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
|
||||
if [ -r "$conf" ]; then
|
||||
vebegin "applying $conf"
|
||||
|
||||
@@ -14,8 +14,7 @@ depend()
|
||||
start()
|
||||
{
|
||||
ebegin "setting up tmpfiles.d entries for /dev"
|
||||
@LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create --remove \
|
||||
${tmpfiles_opts}
|
||||
@LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create ${tmpfiles_opts}
|
||||
eend $?
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ depend()
|
||||
start()
|
||||
{
|
||||
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}
|
||||
eend $?
|
||||
return 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
include ../mk/net.mk
|
||||
|
||||
BOOT= bootmisc fsck hostname localmount loopback \
|
||||
BOOT= bootmisc fsck hostname localmount \
|
||||
root swap swapfiles sysctl urandom ${BOOT-${OS}}
|
||||
DEFAULT= local netmount
|
||||
SHUTDOWN= savecache ${SHUTDOWN-${OS}}
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
# Control creation, deletion, and cleaning of volatile and temporary files
|
||||
#
|
||||
# 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
|
||||
# As of 2012/01/01
|
||||
#
|
||||
# See the tmpfiles.d manpage as well:
|
||||
# http://0pointer.de/public/systemd-man/tmpfiles.d.html
|
||||
@@ -14,6 +15,7 @@
|
||||
#
|
||||
|
||||
DRYRUN=0
|
||||
CHECKPATH="@LIBEXECDIR@/bin/checkpath"
|
||||
|
||||
checkprefix() {
|
||||
n=$1
|
||||
@@ -43,19 +45,27 @@ relabel() {
|
||||
|
||||
for path in ${paths}; do
|
||||
if [ -e "$path" ]; then
|
||||
[ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
|
||||
[ $uid != '-' ] && dryrun_or_real chown $CHOPTS "$uid" "$path"
|
||||
[ $gid != '-' ] && dryrun_or_real chgrp $CHOPTS "$gid" "$path"
|
||||
[ $mode != '-' ] && dryrun_or_real chmod $CHOPTS "$mode" "$path"
|
||||
[ -x /sbin/restorecon ] && dryrun_or_real restorecon $CHOPTS "$path"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_restorecon() {
|
||||
local path=$1
|
||||
if [ -x /sbin/restorecon ]; then
|
||||
dryrun_or_real restorecon -F "$path"
|
||||
fi
|
||||
}
|
||||
|
||||
_b() {
|
||||
# Create a block device node if it doesn't exist yet
|
||||
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||
if [ ! -e "$path" ]; then
|
||||
dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:}
|
||||
_restorecon "$path"
|
||||
dryrun_or_real chown $uid:$gid $path
|
||||
fi
|
||||
}
|
||||
@@ -65,10 +75,22 @@ _c() {
|
||||
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||
if [ ! -e "$path" ]; then
|
||||
dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:}
|
||||
_restorecon "$path"
|
||||
dryrun_or_real chown $uid:$gid $path
|
||||
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() {
|
||||
# Create a file if it doesn't exist yet
|
||||
@@ -77,7 +99,7 @@ _f() {
|
||||
[ $CREATE -gt 0 ] || return 0
|
||||
|
||||
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 "$@"
|
||||
fi
|
||||
}
|
||||
@@ -88,7 +110,7 @@ _F() {
|
||||
|
||||
[ $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 "$@"
|
||||
}
|
||||
|
||||
@@ -99,7 +121,8 @@ _d() {
|
||||
[ $CREATE -gt 0 ] || return 0
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -109,10 +132,12 @@ _D() {
|
||||
|
||||
if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then
|
||||
dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} +
|
||||
_restorecon "$path"
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -120,6 +145,7 @@ _L() {
|
||||
# Create a symlink if it doesn't exist yet
|
||||
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
|
||||
[ ! -e "$path" ] && dryrun_or_real ln -s "$arg" "$path"
|
||||
_restorecon "$path"
|
||||
}
|
||||
|
||||
_p() {
|
||||
@@ -129,8 +155,7 @@ _p() {
|
||||
[ $CREATE -gt 0 ] || return 0
|
||||
|
||||
if [ ! -p "$path" ]; then
|
||||
dryrun_or_real mkfifo -m$mode "$path"
|
||||
dryrun_or_real chown "$uid:$gid" "$path"
|
||||
dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -214,7 +239,7 @@ _Z() {
|
||||
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=
|
||||
PREFIX=
|
||||
FILE=
|
||||
@@ -230,11 +255,13 @@ tmpfiles_d=''
|
||||
# `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf'
|
||||
for d in ${tmpfiles_dirs} ; 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##*/}"
|
||||
done # for f in ${d}
|
||||
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
|
||||
real_f=''
|
||||
@@ -247,6 +274,7 @@ done
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--boot) BOOT=1 ;;
|
||||
--create) CREATE=1 ;;
|
||||
--remove) REMOVE=1 ;;
|
||||
--clean) CLEAN=1 ;; # TODO: Not implemented
|
||||
@@ -264,7 +292,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
@@ -281,21 +309,34 @@ for FILE in $tmpfiles_d ; do
|
||||
# Cmd Path Mode UID GID Age Argument
|
||||
# d /run/user 0755 root root 10d -
|
||||
# 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.
|
||||
# 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
|
||||
LINENUM=$(( LINENUM+1 ))
|
||||
FORCE=0
|
||||
|
||||
# Unless we have both command and path, skip this line.
|
||||
if [ -z "$cmd" -o -z "$path" ]; then
|
||||
continue
|
||||
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
|
||||
case $cmd in
|
||||
f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
|
||||
\#) continue ;;
|
||||
f|F|w|d|D|p|L|c|C|b|x|X|r|R|z|Z) ;;
|
||||
*) warninvalid ; continue ;;
|
||||
esac
|
||||
|
||||
@@ -304,7 +345,7 @@ for FILE in $tmpfiles_d ; do
|
||||
case "$cmd" in
|
||||
p|f|F) mode=0644 ;;
|
||||
d|D) mode=0755 ;;
|
||||
z|Z|x|r|R|L) ;;
|
||||
C|z|Z|x|r|R|L) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -316,6 +357,13 @@ for FILE in $tmpfiles_d ; do
|
||||
|
||||
[ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && 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 "$@"
|
||||
_$cmd "$@"
|
||||
rc=$?
|
||||
|
||||
Reference in New Issue
Block a user