Compare commits

..

5 Commits
0.46 ... 0.45.2

Author SHA1 Message Date
William Hubbs
3e5420b911 version 0.45.2 2022-07-03 12:54:05 -05:00
psykose
9666279210 fix quoting of loggers in start-stop-daemon
previously broken in 6034866d1c
caused *_logger options to be passed unquoted, so
`error_logger="logger -t .."` would pass -t to s-s-d and fail to start
the service.

Fixes: #531
2022-07-03 12:50:51 -05:00
William Hubbs
c7032602dd version 0.45.1 2022-06-10 10:40:38 -05:00
William Hubbs
c253eb0412 restore the init symlink for sysvinit mode
This symlink got lost in the transition to meson.

X-Gentoo-Bug: 850754
X-Gentoo-Bug-URL: https://bugs.gentoo.org/850754
2022-06-10 10:35:08 -05:00
William Hubbs
8accc2d780 clean up hostname service script
- use _ throw-away variable to get rid of a shellcheck warning
- remove tests for /etc/hostname and just try to read it
- drop reference to bash HOSTNAME variable.
- make source of host name more accurate

X-Gentoo-Bug: 850577
X-Gentoo-Bug-URL: https://bugs.gentoo.org/850577
2022-06-10 10:35:08 -05:00
14 changed files with 20 additions and 89 deletions

21
NEWS.md
View File

@@ -4,27 +4,6 @@ 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.

View File

@@ -7,7 +7,6 @@ conf_common = [
'localmount',
'netmount',
'swap',
'swclock',
]
conf_net = [

View File

@@ -1,6 +0,0 @@
# 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

View File

@@ -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 -e "--noadjfile"; then
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
echo --noadjfile
fi
fi

View File

@@ -56,10 +56,10 @@ load_modules()
ebegin "Loading module $x"
case "$RC_UNAME" in
FreeBSD) kldload "$x"; rc=$? ;;
Linux) modprobe --first-time --use-blacklist --verbose "$x"; rc=$? ;;
Linux) modprobe --first-time -q --use-blacklist "$x"; rc=$? ;;
*) ;;
esac
eend
eend $rc "Failed to load $x"
done
return 0
}
@@ -80,10 +80,9 @@ FreeBSD_modules()
for x in $modules; do
ebegin "Loading module $x"
kldload "$x"
eend && : $(( cnt += 1 ))
eend $? "Failed to load $x" && : $(( cnt += 1 ))
done
einfo "Autoloaded $cnt module(s)"
return 0
}
Linux_modules()
@@ -123,7 +122,6 @@ Linux_modules()
eval modprobe --first-time --use-blacklist --verbose "$x" "$args"
done
[ -n "$list" ] && eend
return 0
}
start()

View File

@@ -49,7 +49,9 @@ start()
local mountpoint
for mountpoint in $(fstabinfo); do
case "${mountpoint}" in
/*) # Don't remount swap etc.
/)
;;
/*)
mountinfo -q "${mountpoint}" && \
fstabinfo --remount "${mountpoint}"
;;

View File

@@ -10,7 +10,6 @@
# 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()
{
@@ -23,7 +22,7 @@ depend()
start()
{
ebegin "Setting the local clock based on last shutdown time"
if ! swclock "${swclock_file}" 2> /dev/null; then
if ! swclock 2> /dev/null; then
swclock --warn @SBINDIR@/openrc-run
fi
eend $?
@@ -32,6 +31,6 @@ start()
stop()
{
ebegin "Saving the shutdown time"
swclock --save "${swclock_file}"
swclock --save
eend $?
}

View File

@@ -1,5 +1,5 @@
project('OpenRC', 'c',
version : '0.46',
version : '0.45.2',
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', check: true)
r = run_command(uname, '-s')
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', check: false).returncode() != 0
split_usr = run_command('test', '-L', '/bin').returncode() != 0
else
split_usr = get_option('split-usr') == 'true'
endif

View File

@@ -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=$?

View File

@@ -1074,6 +1074,6 @@ rc_deptree_update(void)
}
rc_stringlist_free(config);
free(deptree);
rc_deptree_free(deptree);
return retval;
}

View File

@@ -64,7 +64,8 @@ const struct option longopts[] = {
};
const char * const longopts_help[] = {
"do not stop any services",
"override the next runlevel to change into\nwhen leaving single user or boot runlevels",
"override the next runlevel to change into\n",
"when 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

View File

@@ -354,9 +354,6 @@ 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);
@@ -867,17 +864,12 @@ 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
@@ -886,23 +878,11 @@ 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 &&
@@ -1105,8 +1085,7 @@ int main(int argc, char **argv)
dup2(stderr_fd, STDERR_FILENO);
for (i = getdtablesize() - 1; i >= 3; --i)
if (i != pipefd[1])
close(i);
close(i);
if (scheduler != NULL) {
int scheduler_index;
@@ -1139,6 +1118,7 @@ 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)
@@ -1149,18 +1129,6 @@ 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 */

View File

@@ -391,14 +391,6 @@ 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)

View File

@@ -34,6 +34,7 @@
#include "misc.h"
#include "_usage.h"
#define RC_SHUTDOWNTIME RC_SVCDIR "/shutdowntime"
const char *applet = NULL;
const char *extraopts = "file";
@@ -53,7 +54,7 @@ const char *usagestring = NULL;
int main(int argc, char **argv)
{
int opt, sflag = 0, wflag = 0;
const char *file = NULL;
const char *file = RC_SHUTDOWNTIME;
struct stat sb;
struct timeval tv;
@@ -74,8 +75,6 @@ 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) {