Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ef74594df | ||
|
|
59e9637647 | ||
|
|
35077afb68 | ||
|
|
02b064a591 | ||
|
|
839083bb52 | ||
|
|
1364e6631c | ||
|
|
953172c6c6 | ||
|
|
0525de4f18 | ||
|
|
9380347f04 | ||
|
|
112b69860f | ||
|
|
d21dde73ba | ||
|
|
9b08de926b | ||
|
|
f60d42e901 | ||
|
|
9e5ce59a21 | ||
|
|
95dc83bfbc | ||
|
|
14b153c1a4 | ||
|
|
3cc4c01485 | ||
|
|
414f398498 | ||
|
|
107b23819d | ||
|
|
d2b3144070 |
21
NEWS.md
21
NEWS.md
@@ -4,6 +4,27 @@ OpenRC NEWS
|
||||
This file will contain a list of notable changes for each release. Note
|
||||
the information in this file is in reverse order.
|
||||
|
||||
## OpenRC 0.46
|
||||
|
||||
The path for the reference file for the swclock service is now
|
||||
configurable in conf.d/swclock.
|
||||
|
||||
In the past, if supervise_daemon_args was not set *or empty*, it defaulted to
|
||||
`start_stop_daemon_args`. This was bad because supervise-daemon doesn't
|
||||
accept the same options as `start-stop-daemon`. So if we set e.g.
|
||||
`start_stop_daemon_args="--wait 50"`, but not `supervise_daemon_args`,
|
||||
and the user adds `supervisor=supervise-daemon` to the corresponding
|
||||
conf.d/<service> file, the service will fail to start due to
|
||||
unrecognized option "wait".
|
||||
It would be best to remove this fallback, but that might break some
|
||||
existing scripts that depend on it. So we are changing it to
|
||||
use `start_stop_daemon_args` as the default for `supervise_daemon_args`
|
||||
only if `supervise_daemon_args` is not set at all, but not if it's
|
||||
empty.
|
||||
|
||||
This fallback will be dropped in a future release.
|
||||
|
||||
|
||||
## OpenRC 0.45
|
||||
|
||||
The old make-based build system is removed in this release.
|
||||
|
||||
@@ -7,6 +7,7 @@ conf_common = [
|
||||
'localmount',
|
||||
'netmount',
|
||||
'swap',
|
||||
'swclock',
|
||||
]
|
||||
|
||||
conf_net = [
|
||||
|
||||
6
conf.d/swclock
Normal file
6
conf.d/swclock
Normal file
@@ -0,0 +1,6 @@
|
||||
# This is the location of the reference file swclock uses to set the
|
||||
# system date and time.
|
||||
# This is the default path. If you are using it, you do not need to
|
||||
# uncomment it. If you are using the default and have /var on its own
|
||||
# file system, you need to add the appropriate rc_after setting.
|
||||
# swclock_file=/var/lib/misc/openrc-shutdowntime
|
||||
@@ -19,20 +19,18 @@ depend()
|
||||
|
||||
start()
|
||||
{
|
||||
local h source x
|
||||
if [ -s /etc/hostname ] && [ -r /etc/hostname ]; then
|
||||
read h x </etc/hostname
|
||||
source="from /etc/hostname"
|
||||
else
|
||||
# HOSTNAME variable used to be defined in caps in conf.d/hostname.
|
||||
# It is also a magic variable in bash.
|
||||
h=${hostname:-${HOSTNAME}} # checkbashisms: false positive (HOSTNAME var)
|
||||
local h source
|
||||
if read -r h _ 2> /dev/null < @SYSCONFDIR@/hostname; then
|
||||
source="@SYSCONFDIR@/hostname"
|
||||
elif [ -n "${hostname}" ]; then
|
||||
h=${hostname}
|
||||
source="@SYSCONFDIR@/conf.d/${RC_SVCNAME}"
|
||||
fi
|
||||
if [ -z "$h" ]; then
|
||||
einfo "Using default system hostname"
|
||||
return 0
|
||||
fi
|
||||
ebegin "Setting hostname to $h $source"
|
||||
ebegin "Setting hostname to $h from $source"
|
||||
hostname "$h"
|
||||
eend $? "Failed to set the hostname"
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ get_noadjfile()
|
||||
{
|
||||
if ! yesno $clock_adjfile; then
|
||||
# Some implementations don't handle adjustments
|
||||
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
|
||||
if LC_ALL=C hwclock --help 2>&1 | grep -q -e "--noadjfile"; then
|
||||
echo --noadjfile
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -56,10 +56,10 @@ load_modules()
|
||||
ebegin "Loading module $x"
|
||||
case "$RC_UNAME" in
|
||||
FreeBSD) kldload "$x"; rc=$? ;;
|
||||
Linux) modprobe --first-time -q --use-blacklist "$x"; rc=$? ;;
|
||||
Linux) modprobe --first-time --use-blacklist --verbose "$x"; rc=$? ;;
|
||||
*) ;;
|
||||
esac
|
||||
eend $rc "Failed to load $x"
|
||||
eend
|
||||
done
|
||||
return 0
|
||||
}
|
||||
@@ -80,9 +80,10 @@ FreeBSD_modules()
|
||||
for x in $modules; do
|
||||
ebegin "Loading module $x"
|
||||
kldload "$x"
|
||||
eend $? "Failed to load $x" && : $(( cnt += 1 ))
|
||||
eend && : $(( cnt += 1 ))
|
||||
done
|
||||
einfo "Autoloaded $cnt module(s)"
|
||||
return 0
|
||||
}
|
||||
|
||||
Linux_modules()
|
||||
@@ -122,6 +123,7 @@ Linux_modules()
|
||||
eval modprobe --first-time --use-blacklist --verbose "$x" "$args"
|
||||
done
|
||||
[ -n "$list" ] && eend
|
||||
return 0
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -49,9 +49,7 @@ start()
|
||||
local mountpoint
|
||||
for mountpoint in $(fstabinfo); do
|
||||
case "${mountpoint}" in
|
||||
/)
|
||||
;;
|
||||
/*)
|
||||
/*) # Don't remount swap etc.
|
||||
mountinfo -q "${mountpoint}" && \
|
||||
fstabinfo --remount "${mountpoint}"
|
||||
;;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
description="Sets the local clock to the mtime of a given file."
|
||||
swclock_file="${swclock_file:-/var/lib/misc/openrc-shutdowntime}"
|
||||
|
||||
depend()
|
||||
{
|
||||
@@ -22,7 +23,7 @@ depend()
|
||||
start()
|
||||
{
|
||||
ebegin "Setting the local clock based on last shutdown time"
|
||||
if ! swclock 2> /dev/null; then
|
||||
if ! swclock "${swclock_file}" 2> /dev/null; then
|
||||
swclock --warn @SBINDIR@/openrc-run
|
||||
fi
|
||||
eend $?
|
||||
@@ -31,6 +32,6 @@ start()
|
||||
stop()
|
||||
{
|
||||
ebegin "Saving the shutdown time"
|
||||
swclock --save
|
||||
swclock --save "${swclock_file}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
10
meson.build
10
meson.build
@@ -1,5 +1,5 @@
|
||||
project('OpenRC', 'c',
|
||||
version : '0.45',
|
||||
version : '0.46',
|
||||
license: 'BSD-2',
|
||||
default_options : [
|
||||
'c_std=c99',
|
||||
@@ -36,7 +36,7 @@ endif
|
||||
option_os = get_option('os')
|
||||
if option_os == ''
|
||||
uname = find_program('uname')
|
||||
r = run_command(uname, '-s')
|
||||
r = run_command(uname, '-s', check: true)
|
||||
os = r.stdout().strip()
|
||||
os = '-'.join(os.split('/'))
|
||||
else
|
||||
@@ -84,7 +84,7 @@ else
|
||||
endif
|
||||
|
||||
if get_option('split-usr') == 'auto'
|
||||
split_usr = run_command('test', '-L', '/bin').returncode() != 0
|
||||
split_usr = run_command('test', '-L', '/bin', check: false).returncode() != 0
|
||||
else
|
||||
split_usr = get_option('split-usr') == 'true'
|
||||
endif
|
||||
@@ -226,4 +226,6 @@ meson.add_install_script('tools/meson_runlevels.sh',
|
||||
get_option('sysvinit') ? 'yes' : 'no')
|
||||
meson.add_install_script('tools/meson_final.sh',
|
||||
rc_libexecdir,
|
||||
os)
|
||||
sbindir,
|
||||
os,
|
||||
get_option('sysvinit') ? 'yes' : 'no')
|
||||
|
||||
@@ -47,8 +47,8 @@ ssd_start()
|
||||
${directory:+--chdir} $directory \
|
||||
${output_log+--stdout} $output_log \
|
||||
${error_log+--stderr} $error_log \
|
||||
${output_logger:+--stdout-logger} "$output_logger" \
|
||||
${error_logger:+--stderr-logger} "$error_logger" \
|
||||
${output_logger:+--stdout-logger \"$output_logger\"} \
|
||||
${error_logger:+--stderr-logger \"$error_logger\"} \
|
||||
${capabilities+--capabilities} "$capabilities" \
|
||||
${secbits:+--secbits} "$secbits" \
|
||||
${no_new_privs:+--no-new-privs} \
|
||||
|
||||
@@ -41,7 +41,7 @@ supervise_start()
|
||||
${no_new_privs:+--no_new_privs} \
|
||||
${command_user+--user} $command_user \
|
||||
${umask+--umask} $umask \
|
||||
${supervise_daemon_args:-${start_stop_daemon_args}} \
|
||||
${supervise_daemon_args-${start_stop_daemon_args}} \
|
||||
$command \
|
||||
-- $command_args $command_args_foreground
|
||||
rc=$?
|
||||
|
||||
@@ -1074,6 +1074,6 @@ rc_deptree_update(void)
|
||||
}
|
||||
|
||||
rc_stringlist_free(config);
|
||||
rc_deptree_free(deptree);
|
||||
free(deptree);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ const struct option longopts[] = {
|
||||
};
|
||||
const char * const longopts_help[] = {
|
||||
"do not stop any services",
|
||||
"override the next runlevel to change into\n",
|
||||
"when leaving single user or boot runlevels",
|
||||
"override the next runlevel to change into\nwhen leaving single user or boot runlevels",
|
||||
"runs the service specified with the rest\nof the arguments",
|
||||
"output the RC system type, if any",
|
||||
longopts_help_COMMON
|
||||
|
||||
@@ -354,6 +354,9 @@ int main(int argc, char **argv)
|
||||
#ifdef PR_SET_NO_NEW_PRIVS
|
||||
bool no_new_privs = false;
|
||||
#endif
|
||||
int pipefd[2];
|
||||
char readbuf[1];
|
||||
ssize_t ss;
|
||||
|
||||
applet = basename_c(argv[0]);
|
||||
atexit(cleanup);
|
||||
@@ -864,12 +867,17 @@ int main(int argc, char **argv)
|
||||
if (background)
|
||||
signal_setup(SIGCHLD, handle_signal);
|
||||
|
||||
/* Use a pipe to sync the parent/child processes. */
|
||||
if (pipe2(pipefd, O_CLOEXEC) == -1)
|
||||
eerrorx("%s: pipe2: %s", applet, strerror(errno));
|
||||
|
||||
if ((pid = fork()) == -1)
|
||||
eerrorx("%s: fork: %s", applet, strerror(errno));
|
||||
|
||||
/* Child process - lets go! */
|
||||
if (pid == 0) {
|
||||
pid_t mypid = getpid();
|
||||
close(pipefd[0]); /* Close the read end of the pipe. */
|
||||
umask(numask);
|
||||
|
||||
#ifdef TIOCNOTTY
|
||||
@@ -878,11 +886,23 @@ int main(int argc, char **argv)
|
||||
|
||||
devnull_fd = open("/dev/null", O_RDWR);
|
||||
|
||||
/* Must call setsid() before setting autogroup nicelevel
|
||||
* but after opening tty_fd. */
|
||||
setsid();
|
||||
|
||||
if (nicelevel != INT_MIN) {
|
||||
if (setpriority(PRIO_PROCESS, mypid, nicelevel) == -1)
|
||||
eerrorx("%s: setpriority %d: %s",
|
||||
applet, nicelevel,
|
||||
strerror(errno));
|
||||
/* Open in "r+" mode to avoid creating if non-existent. */
|
||||
fp = fopen("/proc/self/autogroup", "r+");
|
||||
if (fp) {
|
||||
fprintf(fp, "%d\n", nicelevel);
|
||||
fclose(fp);
|
||||
} else if (errno != ENOENT)
|
||||
eerrorx("%s: autogroup nice %d: %s", applet,
|
||||
nicelevel, strerror(errno));
|
||||
}
|
||||
|
||||
if (ionicec != -1 &&
|
||||
@@ -1085,7 +1105,8 @@ int main(int argc, char **argv)
|
||||
dup2(stderr_fd, STDERR_FILENO);
|
||||
|
||||
for (i = getdtablesize() - 1; i >= 3; --i)
|
||||
close(i);
|
||||
if (i != pipefd[1])
|
||||
close(i);
|
||||
|
||||
if (scheduler != NULL) {
|
||||
int scheduler_index;
|
||||
@@ -1118,7 +1139,6 @@ int main(int argc, char **argv)
|
||||
eerrorx("Failed to set scheduler parameters: %s", strerror(errno));
|
||||
}
|
||||
|
||||
setsid();
|
||||
execvp(exec, argv);
|
||||
#ifdef HAVE_PAM
|
||||
if (changeuser != NULL && pamr == PAM_SUCCESS)
|
||||
@@ -1129,6 +1149,18 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Parent process */
|
||||
|
||||
close(pipefd[1]); /* Close the write end of the pipe. */
|
||||
|
||||
/* The child never writes to the pipe, so this read will block until
|
||||
* the child calls exec or exits. */
|
||||
while ((ss = read(pipefd[0], readbuf, 1)) == -1 && errno == EINTR);
|
||||
if (ss == -1)
|
||||
eerrorx("%s: failed to read from pipe: %s",
|
||||
applet, strerror(errno));
|
||||
|
||||
close(pipefd[0]);
|
||||
|
||||
if (!background) {
|
||||
/* As we're not backgrounding the process, wait for our pid
|
||||
* to return */
|
||||
|
||||
@@ -391,6 +391,14 @@ static void child_process(char *exec, char **argv)
|
||||
if (setpriority(PRIO_PROCESS, getpid(), nicelevel) == -1)
|
||||
eerrorx("%s: setpriority %d: %s", applet, nicelevel,
|
||||
strerror(errno));
|
||||
/* Open in "r+" mode to avoid creating if non-existent. */
|
||||
fp = fopen("/proc/self/autogroup", "r+");
|
||||
if (fp) {
|
||||
fprintf(fp, "%d\n", nicelevel);
|
||||
fclose(fp);
|
||||
} else if (errno != ENOENT)
|
||||
eerrorx("%s: autogroup nice %d: %s", applet,
|
||||
nicelevel, strerror(errno));
|
||||
}
|
||||
|
||||
if (ionicec != -1 && ioprio_set(1, getpid(), ionicec | ioniced) == -1)
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "misc.h"
|
||||
#include "_usage.h"
|
||||
|
||||
#define RC_SHUTDOWNTIME RC_SVCDIR "/shutdowntime"
|
||||
|
||||
const char *applet = NULL;
|
||||
const char *extraopts = "file";
|
||||
@@ -54,7 +53,7 @@ const char *usagestring = NULL;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt, sflag = 0, wflag = 0;
|
||||
const char *file = RC_SHUTDOWNTIME;
|
||||
const char *file = NULL;
|
||||
struct stat sb;
|
||||
struct timeval tv;
|
||||
|
||||
@@ -75,6 +74,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (optind < argc)
|
||||
file = argv[optind++];
|
||||
else
|
||||
eerrorx("swclock: Reference file was not specified");
|
||||
|
||||
if (sflag) {
|
||||
if (stat(file, &sb) == -1) {
|
||||
|
||||
@@ -4,10 +4,15 @@ set -e
|
||||
set -u
|
||||
|
||||
rc_libexecdir="$1"
|
||||
os="$2"
|
||||
sbindir="$2"
|
||||
os="$3"
|
||||
sysvinit="$4"
|
||||
|
||||
if [ ${os} != Linux ]; then
|
||||
if [ "${os}" != Linux ]; then
|
||||
install -d "${DESTDIR}/${rc_libexecdir}"/init.d
|
||||
fi
|
||||
install -d "${DESTDIR}/${rc_libexecdir}"/tmp
|
||||
install -m 644 "${MESON_BUILD_ROOT}/src/shared/version" "${DESTDIR}/${rc_libexecdir}"
|
||||
if [ "${os}" = Linux ] && [ "${sysvinit}" = yes ]; then
|
||||
ln -s openrc-init "${DESTDIR}/${sbindir}"/init
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user