Compare commits

...

24 Commits

Author SHA1 Message Date
Dantrell B
7447c63e02 Replace space with tab in conf.d/hostname 2014-08-16 02:23:49 -04:00
Dantrell B
6b78f4c8e0 FL-227: Change how /etc/hosts is generated 2014-08-13 18:09:34 -04:00
Dantrell B
e8b4dc22cb FL-227: Add comment to conf.d/hostname about setting aliases 2014-08-13 18:09:06 -04:00
Dantrell B
5fb4b03366 FL-28: Add comment to conf.d/hostname about setting nisdomainname 2014-08-13 12:44:39 -04:00
Dantrell B
76581025ea FL-967: Improve comment in conf.d/hostname about setting hostname 2014-08-13 12:15:51 -04:00
Daniel Robbins
a559af4ff9 remove trailing whitespace in sysctl.Linux.in, which produces a warning during build 2014-08-12 13:35:09 -04:00
Daniel Robbins
35fe25ab06 FL-786: funtoo hostname changes 2014-08-12 13:35:09 -04:00
Daniel Robbins
a2e4cb2f89 FL-786: sysctl.Linux.in: set System V SHM to 25% of RAM 2014-08-12 13:35:09 -04:00
Oleg Vinichenko
0490a83134 FL-786: openrc: remove loopback interface 2014-08-12 13:35:08 -04:00
Steven Chamberlain
0853c110e5 Begin port to GNU/kFreeBSD
This is just a minimal port to get Debian up and running; the rest will
be done later.
2013-10-30 15:00:40 -05:00
William Hubbs
1a43ce11d0 bootmisc: do not run clean_run on VSERVER systems
X-Gentoo-Bug: 489370
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489370
2013-10-28 15:40:47 -05:00
William Hubbs
46e504b403 loopback: do not run in a prefix or vserver
X-Gentoo-Bug: 489370
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489370
2013-10-28 15:40:16 -05:00
William Hubbs
fc1f3d14f4 start 0.12.4 2013-10-28 15:39:19 -05:00
Alexander V Vershilov
b8a016aaba Add uml keyword to fsck service.
Fix relevant an issue mentioned by Toralf Förster.

X-Gentoo-Bug: 481096.
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=481096
2013-10-18 15:22:24 -05:00
William Hubbs
63f5256b59 start work on OpenRC-0.12.3 2013-10-18 15:19:52 -05:00
Daniel Robbins
c420f56856 FL-786: localmount: support filesystem mounting on openvz 2013-10-08 12:06:09 -05:00
Natanael Copa
5b0f323da9 librc: fix off-by-one bug
We need allocate space for both the added leading '-' and the trailing
'\0'.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-10-08 12:06:09 -05:00
Natanael Copa
d86853538a librc: fix a read off-by-one bug
We should first check if we are within bounds and then read rather than
the opposite.

This makes valgrind happy.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-10-08 12:06:09 -05:00
William Hubbs
f2c0e700c6 netmount: add -lxc keyword
Netmount should not run on lxc, thanks to Mark van Dijk <funtoo@internecto.net>.
2013-10-08 12:06:09 -05:00
William Hubbs
b1de9d7324 start-stop-daemon: fix do_stop calls
Several calls to do_stop were forcing the test parameter to be true,
which was causing extra output to the terminal, such as:

* Would send signal 0 to pid xxxxx

This should only happen if the --test command line option was used.

Conflicts:
	src/rc/start-stop-daemon.c
2013-10-08 12:06:09 -05:00
William Hubbs
5b4886d23e start-stop-daemon: fix eerorr calls in get_pid
The eerror calls in this function make it too verbose, so change them to
ewarnv() calls instead. This means that they will only print if the
--verbose option is used or EINFO_VERBOSE=yes is set in the environment.
2013-10-08 12:06:09 -05:00
William Hubbs
2a53efbc07 start work on OpenRC-0.12.2 2013-10-08 12:03:47 -05:00
William Hubbs
a530722f65 fix cgroup_cleanup function
The yesno test for rc_cgroup_cleanup belongs at the point where this
function is called from runscript, not in the function itself.

X-Gentoo-Bug: 486210
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=486210
2013-10-02 05:43:51 -05:00
William Hubbs
661e9cf002 start work on OpenRC 0.12.1 2013-10-02 05:40:18 -05:00
24 changed files with 111 additions and 66 deletions

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.12
VERSION= 0.12.4
PKG= ${NAME}-${VERSION}

View File

@@ -1,2 +1,15 @@
# 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").
hostname="localhost"
# Set to the NIS domain name of this machine, if it has one, otherwise
# leave commented out.
#nisdomainname="localdomain.com"
# Set other alias-to-address mappings, if needed, otherwise leave
# commented out.
#aliases="127.0.0.1 mybox
#10.0.0.1 mylaptop
#172.16.0.1 myserver
#192.168.0.1 myworkstation"

11
etc/rc.conf.GNU-kFreeBSD Normal file
View 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=""

View File

@@ -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}

View File

@@ -117,6 +117,7 @@ migrate_to_run()
clean_run()
{
[ "$RC_SYS" = VSERVER ] && return 0
local dir
dir=$(mktemp -d)
mount --bind / $dir

View File

@@ -9,7 +9,7 @@ _IFS="
depend()
{
use dev clock modules
keyword -jail -openvz -prefix -timeout -vserver -lxc
keyword -jail -openvz -prefix -timeout -vserver -lxc -uml
}
_abort() {

View File

@@ -1,18 +1,57 @@
#!@SBINDIR@/runscript
#!@PREFIX@/sbin/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# 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" ] && out2="$aliases"
ebegin "Configuring /etc/hosts"
cat << END > /etc/hosts
# Local Host Database
#
# This AUTOMATICALLY-GENERATED file describes a number of aliases-to-address
# mappings for the local hosts that share this file.
#
# In the presence of the domain name service or NIS, this file may not be
# consulted at all; see /etc/host.conf for the resolution order.
#
# DO NOT EDIT THIS FILE BY HAND; YOUR CHANGES WILL BE OVERWRITTEN
#
# Define alias-to-address mappings in /etc/conf.d/hostname
# IPv4 and IPv6 localhost aliases
127.0.0.1 $out
::1 $out
# Other aliases
$out2
END
chmod 0644 /etc/hosts
eend $?
[ "$RC_SYS" = "LXC" ] && return 0
ebegin "Setting hostname to $hostname"
hostname "$hostname"
eend $? "Failed to set the hostname"

View File

@@ -9,7 +9,7 @@ depend()
need fsck
use lvm modules mtab
after lvm modules
keyword -jail -openvz -prefix -vserver -lxc
keyword -jail -prefix -vserver -lxc
}
start()

View File

@@ -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
}

View File

@@ -12,7 +12,7 @@ depend()
config /etc/fstab
use afc-client amd autofs openvpn
use dns
keyword -jail -prefix -vserver
keyword -jail -prefix -vserver -lxc
}
start()

View File

@@ -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"

View File

@@ -1 +1 @@
MKNET?= yes
MKNET?= no

9
mk/os-GNU-kFreeBSD.mk Normal file
View 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

View File

@@ -3,7 +3,7 @@
# Generic definitions
_OS_SH= uname -s
_OS_SH= uname -s | tr '/' '-'
_OS:= $(shell ${_OS_SH})
OS?= ${_OS}
include ${MK}/os-${OS}.mk

View File

@@ -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}}

View File

@@ -116,7 +116,7 @@ cgroup_set_limits()
cgroup_cleanup()
{
yesno "${rc_cgroup_cleanup:-no}" && cgroup_running || return 0
cgroup_running || return 0
ebegin "starting cgroups cleanup"
for sig in TERM QUIT INT; do
cgroup_get_pids || { eend 0 "finished" ; return 0 ; }

View File

@@ -308,6 +308,7 @@ while [ -n "$1" ]; do
fi
[ "$(command -v cgroup_cleanup)" = "cgroup_cleanup" -a \
"$1" = "stop" ] && \
yesno "${rc_cgroup_cleanup}" && \
cgroup_cleanup
shift
continue 2

View File

@@ -30,7 +30,7 @@
#include "librc.h"
#if defined(__linux__)
#if defined(__linux__) || defined (__GLIBC__)
static bool
pid_is_exec(pid_t pid, const char *exec)
{

View File

@@ -856,7 +856,7 @@ rc_deptree_update(void)
* work for them. This doesn't stop them from being run directly. */
if (sys) {
len = strlen(sys);
nosys = xmalloc(len + 1);
nosys = xmalloc(len + 2);
nosys[0] = '-';
for (i = 0; i < len; i++)
nosys[i + 1] = (char)tolower((unsigned char)sys[i]);

View File

@@ -193,7 +193,7 @@ file_regex(const char *file, const char *regex)
str += strlen(str) + 1;
/* len is the size of allocated buffer and we don't
want call regexec BUFSIZE times. find next str */
while (*str == '\0' && str < line + len)
while (str < line + len && *str == '\0')
str++;
} while (str < line + len);
}

View File

@@ -39,7 +39,7 @@
# include <sys/statvfs.h>
# define statfs statvfs
# define F_FLAGS f_flag
#elif defined (__linux__)
#elif defined (__linux__) || defined (__GLIBC__)
# include <mntent.h>
#endif
@@ -265,7 +265,7 @@ find_mounts(struct args *args)
return list;
}
#elif defined (__linux__)
#elif defined (__linux__) || defined (__GLIBC__)
static struct mntent *
getmntfile(const char *file)
{

View File

@@ -44,7 +44,7 @@
#include <time.h>
#include <unistd.h>
#ifdef __linux__
#if defined(__linux__) || defined(__GLIBC__)
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>

View File

@@ -52,7 +52,7 @@
#include <time.h>
#include <unistd.h>
#ifdef __linux__
#if defined(__linux__) || defined(__GLIBC__)
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>

View File

@@ -316,14 +316,12 @@ get_pid(const char *pidfile, bool quiet)
return -1;
if ((fp = fopen(pidfile, "r")) == NULL) {
if (!quiet)
eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
ewarnv("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
return -1;
}
if (fscanf(fp, "%d", &pid) != 1) {
if (!quiet)
eerror("%s: no pid found in `%s'", applet, pidfile);
ewarnv("%s: no pid found in `%s'", applet, pidfile);
fclose(fp);
return -1;
}
@@ -461,7 +459,7 @@ run_stop_schedule(const char *exec, const char *const *argv,
{
if ((nrunning = do_stop(exec, argv,
pid, uid, 0, true, false,
true)) == 0)
test)) == 0)
return 0;
@@ -1088,7 +1086,7 @@ start_stop_daemon(int argc, char **argv)
pid = 0;
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);
if (test) {
@@ -1366,7 +1364,7 @@ start_stop_daemon(int argc, char **argv)
} else
pid = 0;
if (do_stop(exec, (const char *const *)margv,
pid, uid, 0, true, false, true) > 0)
pid, uid, 0, true, false, test) > 0)
alive = true;
}