migrate fully to meson build system

- drop old build system
- move shared include and source files to common directory
- drop "rc-" prefix from shared include and source files
- move executable-specific code to individual directories under src
- adjust top-level .gitignore file for new build system

This closes #489.
This commit is contained in:
William Hubbs
2022-04-06 10:51:55 -05:00
parent 0efc1b133e
commit 391d12db48
154 changed files with 430 additions and 2027 deletions

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
SUBDIR= libeinfo librc rc
MK= ../mk
include ${MK}/subdir.mk

View File

@@ -33,8 +33,8 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-selinux.h"
#include "misc.h"
#include "selinux.h"
#include "_usage.h"
typedef enum {

View File

@@ -0,0 +1,9 @@
executable('checkpath',
['checkpath.c', misc_c, usage_c, selinux_c,
version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
dependencies: [audit_dep, pam_dep, pam_misc_dep, selinux_dep, crypt_dep],
install: true,
install_dir: rc_bindir)

View File

@@ -1,6 +0,0 @@
version_h = vcs_tag(
input : 'version.h.in',
output : 'version.h')
version_f = vcs_tag(
input : 'version.in',
output : 'version')

32
src/einfo/meson.build Normal file
View File

@@ -0,0 +1,32 @@
einfo_execs = [
'einfon',
'einfo',
'ewarnn',
'ewarn',
'eerrorn',
'eerror',
'ebegin',
'eend',
'ewend',
'eindent',
'eoutdent',
'esyslog',
'eval_ecolors',
'ewaitfile',
'veinfo',
'vewarn',
'vebegin',
'veend',
'vewend',
'veindent',
'veoutdent',
]
foreach exec: einfo_execs
executable(exec,
['einfo.c', version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
endforeach

View File

@@ -58,7 +58,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
const char *applet = NULL;

View File

@@ -0,0 +1,7 @@
executable('fstabinfo',
['fstabinfo.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

29
src/halt/halt.in Normal file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
option_arg=
poweroff_arg=
while getopts :nwdfiph opt; do
case "$opt" in
n) ;;
w) poweroff_arg=--write-only ;;
d) option_arg=--no-write ;;
f) ;;
i) ;;
p) poweroff_arg=--poweroff ;;
[?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--poweroff
fi
script_args="$@"
if [ -z "${script_args}" ]; then
script_args=now
fi
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"

7
src/halt/meson.build Normal file
View File

@@ -0,0 +1,7 @@
if os == 'Linux' and get_option('sysvinit')
configure_file(input : 'halt.in',
output : '@BASENAME@',
configuration : script_conf_data,
install_dir: sbindir,
install_mode: 'rwxr-xr-x')
endif

View File

@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
int main(int argc, char **argv)
{

View File

@@ -0,0 +1,6 @@
executable('is_newer_than',
['is_newer_than.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

View File

@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
int main(int argc, char **argv)
{

View File

@@ -0,0 +1,6 @@
executable('is_older_than',
['is_older_than.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

View File

@@ -31,7 +31,7 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
const char *applet = NULL;

9
src/kill_all/meson.build Normal file
View File

@@ -0,0 +1,9 @@
if os == 'Linux'
executable('kill_all',
['kill_all.c', usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_bindir)
endif

View File

@@ -1 +0,0 @@
libeinfo.so.1

View File

@@ -1,12 +0,0 @@
LIB= einfo
SHLIB_MAJOR= 1
SRCS= libeinfo.c
INCS= einfo.h
VERSION_MAP= einfo.map
LOCAL_CPPFLAGS+= -I../includes
MK= ../../mk
include ${MK}/lib.mk
include ${MK}/cc.mk
include ${MK}/termcap.mk

View File

@@ -1,2 +0,0 @@
librc.so.1
rc.h

View File

@@ -1,48 +0,0 @@
LIB= rc
SHLIB_MAJOR= 1
SRCS= librc.c librc-daemon.c librc-depend.c librc-misc.c \
librc-stringlist.c
INCS= rc.h
VERSION_MAP= rc.map
LDADD+= ${LIBKVM}
LOCAL_CPPFLAGS+= -I../includes
MK= ../../mk
include ${MK}/lib.mk
include ${MK}/cc.mk
# Massage our header file for our dirs
SED_CMD= -e 's:@PREFIX@:${PREFIX}:g'
SED_CMD+= -e 's:@LIB@:${LIBNAME}:g'
SED_CMD+= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
SED_CMD+= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
SED_CMD+= -e 's:@BINDIR@:${BINDIR}:g'
SED_CMD+= -e 's:@SBINDIR@:${SBINDIR}:g'
_PKG_PREFIX= -e 's:.*@PKG_PREFIX@.*:\#undef RC_PKG_PREFIX:g'
ifneq (${PKG_PREFIX},)
ifneq (${PKG_PREFIX},/)
ifneq (${PKG_PREFIX},${PREFIX})
_PKG_PREFIX= -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'
endif
endif
endif
SED_CMD+= ${_PKG_PREFIX}
_LCL_PREFIX= -e 's:@LOCAL_PREFIX@::g'
ifneq (${LOCAL_PREFIX},)
ifneq (${LOCAL_PREFIX},/)
ifneq (${LOCAL_PREFIX},${PREFIX})
_LCL_PREFIX= -e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'
endif
endif
endif
SED_CMD+= ${_LCL_PREFIX}
%.h: %.h.in
${SED} ${SED_CMD} $< > $@
${SRCS}: rc.h
CLEANFILES+= rc.h

View File

@@ -54,6 +54,6 @@
#endif
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#endif

View File

@@ -27,7 +27,7 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
const char *applet = NULL;

View File

@@ -0,0 +1,20 @@
mark_service_execs = [
'mark_service_starting',
'mark_service_started',
'mark_service_stopping',
'mark_service_stopped',
'mark_service_inactive',
'mark_service_wasinactive',
'mark_service_hotplugged',
'mark_service_failed',
'mark_service_crashed',
]
foreach exec : mark_service_execs
executable(exec,
['mark_service.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_sbindir)
endforeach

View File

@@ -1,4 +1,36 @@
subdir('common')
script_conf_data = configuration_data()
script_conf_data.set('SBINDIR', sbindir)
subdir('shared')
subdir('libeinfo')
subdir('librc')
subdir('rc')
subdir('checkpath')
subdir('einfo')
subdir('fstabinfo')
subdir('halt')
subdir('is_newer_than')
subdir('is_older_than')
subdir('kill_all')
subdir('mark_service')
subdir('mountinfo')
subdir('on_ac_power')
subdir('openrc')
subdir('openrc-init')
subdir('openrc-run')
subdir('openrc-shutdown')
subdir('poweroff')
subdir('rc-abort')
subdir('rc-depend')
subdir('rc-service')
subdir('rc-sstat')
subdir('rc-status')
subdir('rc-update')
subdir('reboot')
subdir('service')
subdir('seedrng')
subdir('shell_var')
subdir('shutdown')
subdir('start-stop-daemon')
subdir('supervise-daemon')
subdir('swclock')
subdir('value')

View File

@@ -0,0 +1,7 @@
executable('mountinfo',
['mountinfo.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

View File

@@ -42,7 +42,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
const char *applet = NULL;

View File

@@ -0,0 +1,3 @@
install_data('on_ac_power',
install_dir : rc_bindir,
install_mode: 'rwxr-xr-x')

View File

@@ -0,0 +1,47 @@
#!/bin/sh
# Detect AC power or not in a portable way
# Exit 0 if on AC power, 1 if not and 255 if we don't know how to work it out
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
if [ -f /proc/acpi/ac_adapter/*/state ]; then
cat /proc/acpi/ac_adapter/*/state | while read line; do
case "$line" in
"state:"*"off-line") exit 128;;
esac
done
elif [ -d /sys/class/power_supply ]; then
for dir in /sys/class/power_supply/*/; do
[ "$(cat "${dir}/type")" != "Mains" ] && continue
[ "$(cat "${dir}/online")" = 0 ] && exit 128
done
elif [ -f /proc/pmu/info ]; then
cat /proc/pmu/info | while read line; do
case "$line" in
"AC Power"*": 0") exit 128;;
esac
done
elif command -v envstat >/dev/null 2>&1; then
# NetBSD has envstat
envstat -d acpiacad0 2>/dev/null | while read line; do
case "$line" in
"connected:"*"OFF") exit 128;;
esac
done
elif sysctl -q hw.acpi.acline >/dev/null 2>/dev/null; then
case $(sysctl -n hw.acpi.acline) in
0) exit 1;;
*) exit 0;;
esac
else
exit 255
fi
[ $? != 128 ]

View File

@@ -0,0 +1,10 @@
if os == 'Linux'
executable('openrc-init',
['openrc-init.c', plugin_c, wtmp_c, version_h],
c_args : cc_selinux_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
dependencies: [dl_dep, selinux_dep],
install: true,
install_dir: sbindir)
endif

View File

@@ -38,8 +38,8 @@
#include "helpers.h"
#include "rc.h"
#include "rc-plugin.h"
#include "rc-wtmp.h"
#include "plugin.h"
#include "wtmp.h"
#include "version.h"
static const char *path_default = "/sbin:/usr/sbin:/bin:/usr/bin";

View File

@@ -0,0 +1,17 @@
executable('openrc-run',
['openrc-run.c', misc_c, plugin_c, selinux_c, usage_c, version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep, crypt_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('runscript',
['openrc-run.c', misc_c, plugin_c, selinux_c, usage_c, version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep, crypt_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)

View File

@@ -50,9 +50,9 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"
#include "rc-selinux.h"
#include "misc.h"
#include "plugin.h"
#include "selinux.h"
#include "_usage.h"
#define PREFIX_LOCK RC_SVCDIR "/prefix.lock"

View File

@@ -0,0 +1,10 @@
if os == 'Linux'
executable('openrc-shutdown',
['openrc-shutdown.c', 'broadcast.c', 'rc-sysvinit.c', misc_c,
usage_c, wtmp_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: sbindir)
endif

View File

@@ -34,9 +34,9 @@
#include "einfo.h"
#include "rc.h"
#include "helpers.h"
#include "rc-misc.h"
#include "misc.h"
#include "rc-sysvinit.h"
#include "rc-wtmp.h"
#include "wtmp.h"
#include "_usage.h"
const char *applet = NULL;

17
src/openrc/meson.build Normal file
View File

@@ -0,0 +1,17 @@
executable('openrc',
['rc.c', 'rc-logger.c', misc_c, plugin_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
dependencies: [dl_dep, util_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('rc',
['rc.c', 'rc-logger.c', misc_c, plugin_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
dependencies: [dl_dep, util_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)

View File

@@ -44,7 +44,7 @@
#include "rc-logger.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#define TMPLOG RC_SVCDIR "/rc.log"
#define DEFAULTLOG "/var/log/rc.log"

View File

@@ -47,8 +47,8 @@
#include "queue.h"
#include "rc.h"
#include "rc-logger.h"
#include "rc-misc.h"
#include "rc-plugin.h"
#include "misc.h"
#include "plugin.h"
#include "version.h"
#include "_usage.h"

7
src/poweroff/meson.build Normal file
View File

@@ -0,0 +1,7 @@
if os == 'Linux' and get_option('sysvinit')
configure_file(input : 'poweroff.in',
output : '@BASENAME@',
configuration : script_conf_data,
install_dir: sbindir,
install_mode: 'rwxr-xr-x')
endif

28
src/poweroff/poweroff.in Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
option_arg=
poweroff_arg=
while getopts :nwdfiph opt; do
case "$opt" in
n) ;;
w) poweroff_arg=--write-only ;;
d) option_arg=--no-write ;;
f) ;;
i) ;;
[?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--poweroff
fi
script_args="$@"
if [ -z "${script_args}" ]; then
script_args=now
fi
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"

6
src/rc-abort/meson.build Normal file
View File

@@ -0,0 +1,6 @@
executable('rc-abort',
'rc-abort.c',
include_directories: [einfo_incdir],
link_with: [libeinfo],
install: true,
install_dir: rc_sbindir)

View File

@@ -0,0 +1,7 @@
executable('rc-depend',
['rc-depend.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

View File

@@ -34,7 +34,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
const char *applet = NULL;

View File

@@ -0,0 +1,7 @@
executable('rc-service',
['rc-service.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)

View File

@@ -24,7 +24,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
const char *applet = NULL;

5
src/rc-sstat/meson.build Normal file
View File

@@ -0,0 +1,5 @@
if os == 'Linux'
install_data('rc-sstat',
install_dir: sbindir,
install_mode: 'rwxr-xr-x')
endif

149
src/rc-sstat/rc-sstat Normal file
View File

@@ -0,0 +1,149 @@
#!/bin/sh
# Copyright (c) 2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
# Define variables
scandir="/run/openrc/s6-scan"
statfile=/dev/shm/s6-svstat.${USER}
color_red='\E[01;31m'
color_green='\E[32m'
color_yellow='\E[01;33m'
# Time Modules
uptimeModules() {
# Given a single integer argument representing seconds of uptime...
# convert uptime to a friendly human readable string: '2d 16h 58m 46s'
# define a variable to keep track of the longest length uptime string
uSec=${1:-0}
uDay=$(( $uSec / 86400 ))
uSec=$(( $uSec % 86400 ))
uHour=$(( $uSec / 3600 ))
uSec=$(( $uSec % 3600 ))
uMin=$(( $uSec / 60 ))
uSec=$(( $uSec % 60 ))
[ $uDay -ne 0 ] && pDay="${uDay}d " || pDay=""
[ $uHour -ne 0 ] && pHour="${uHour}h " || pHour=""
[ $uMin -ne 0 ] && pMin="${uMin}m " || pMin=""
[ $uSec -ne 0 ] && pSec="${uSec}s " || pSec=""
parsedUptime="$( echo ${pDay}${pHour}${pMin}${pSec} | sed 's#[ \t]*$##' )"
uCharCount=${#parsedUptime}
}
# Make sure we are running as root
if [ $(id -u) != 0 ]; then
printf "This command must be run as root\n"
exit 1
fi
# Make sure scandir exists
if [ ! -d $scandir ]; then
printf "%s\n" "$scandir does not exist"
exit 1
fi
# Make sure s6-svscan is running
if ! pgrep s6-svscan >/dev/null ; then
printf "s6-svscan is not running\n"
exit 1
fi
# If TERM is undefined (launching sstat through an ssh command) then make it vt100
if [ -z $TERM -o $TERM = "dumb" ]; then
export TERM=vt100
fi
# Gather list of candidate services s6-supervise may be supervising
# filter for folders and symlinks at /run/openrc/s6-scan/* ommiting output starting with '.'
services="$(find $scandir -maxdepth 1 -mindepth 1 \( -type d -or -type l \) | awk -F'/' '{ if ( $NF !~ "^\\." ) print $NF}')"
if [ -z "$services" ]; then
printf "s6 found no services configured for supervision\n"
exit 1
fi
# Gather status for each service from s6-svstat
# write to tmp file in memory for non I/O bound repeatative access
rm -f $statfile 2>/dev/null
for service in $services ; do
echo "$service $(s6-svstat ${scandir}/${service})" >> $statfile
done
# Define longest string from parsed uptime (default to 7 to match string length of 'Up Time')
timeStringLength=7
for uptime in $(awk '$2 == "up" {print $5}' $statfile | sort -run)
do
uptimeModules $uptime
[ ${uCharCount} -gt $timeStringLength ] && timeStringLength=$uCharCount
done
# Print the status header like so...
# Service Name State PID Up Time Start Time
#---------------------------- ----- ----- -------------- -------------------
printf "\n"
printf "%28s %5s %5s %${timeStringLength}s %19s\n" "Service Name" "State" "PID" "Up Time" "Start Time"
for dashes in 28 5 5 $timeStringLength 19 ; do
printf "%0.s-" $(seq 1 $dashes) ; echo -n ' '
done && printf "\n"
# sshd up (pid 26300) 80373 seconds
cat $statfile | \
while read line
do
set $line
service=$1
state=$2
pid=${4/)/}
time=$5
# call function to convert time in seconds and define additional variables
uptimeModules $time
if [ "$state" = up ]; then
if [ $time -lt 30 ]; then
# uptime < 30 seconds, color the whole line yellow
echo -en "$color_yellow"
# 1st 4 columns are printed with printf for space padding
printf "%28s %5s %5s %${timeStringLength}s" $service $state $pid "$parsedUptime"
# 4th column is output from date -d
echo -e " $(date -d "${time} seconds ago" "+%F %T")"
# reset terminal colors
tput sgr0
else
printf "%28s" $service
# uptime > 30 seconds, color just the "state" value green
echo -en "$color_green"
printf " %5s" $state
# reset terminal colors
tput sgr0
printf " %5s" $pid
printf " %${timeStringLength}s" "$parsedUptime"
echo -e " $(date -d "${time} seconds ago" "+%F %T")"
fi
else
printf "%28s" $service
echo -en "$color_red"
printf " %5s" $state
tput sgr0
echo ""
fi
done
# Cleanup
rm -f $statfile 2>/dev/null
printf "\n\n"
rc-status

View File

@@ -0,0 +1,8 @@
executable('rc-status',
['rc-status.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
dependencies: [util_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: bindir)

View File

@@ -25,7 +25,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
enum format_t {

View File

@@ -0,0 +1,7 @@
executable('rc-update',
['rc-update.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)

View File

@@ -27,7 +27,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
const char *applet = NULL;

66
src/rc/.gitignore vendored
View File

@@ -1,66 +0,0 @@
version.h
rc-status
rc-service
rc-update
runscript
service
start-stop-daemon
supervise-daemon
einfon
einfo
ewarnn
ewarn
eerrorn
eerror
ebegin
eend
ewend
eindent
eoutdent
esyslog
eval_ecolors
ewaitfile
veinfo
vewarn
vebegin
veend
vewend
veindent
veoutdent
service_starting
service_started
service_stopping
service_stopped
service_inactive
service_wasinactive
service_hotplugged
service_started_daemon
service_crashed
checkpath
fstabinfo
mountinfo
swclock
rc-depend
service_get_value
service_set_value
get_options
save_options
shell_var
is_newer_than
is_older_than
mark_service_starting
mark_service_started
mark_service_stopping
mark_service_stopped
mark_service_inactive
mark_service_wasinactive
mark_service_hotplugged
mark_service_failed
mark_service_crashed
rc-abort
rc
openrc
openrc-init
openrc-run
openrc-shutdown
kill_all

View File

@@ -1,186 +0,0 @@
include ../../Makefile.inc
MK= ../../mk
include ${MK}/os.mk
SRCS= checkpath.c do_e.c do_mark_service.c do_service.c \
do_value.c fstabinfo.c is_newer_than.c is_older_than.c \
mountinfo.c openrc-run.c rc-abort.c rc.c \
rc-depend.c rc-logger.c rc-misc.c rc-pipes.c \
rc-plugin.c rc-service.c rc-status.c rc-update.c \
shell_var.c start-stop-daemon.c supervise-daemon.c swclock.c _usage.c
ifeq (${MKSELINUX},yes)
SRCS+= rc-selinux.c
endif
ifeq (${OS},Linux)
SRCS+= kill_all.c openrc-init.c openrc-shutdown.c rc-sysvinit.c broadcast.c \
rc-wtmp.c seedrng.c
endif
CLEANFILES= version.h rc-selinux.o
BINDIR= ${PREFIX}/bin
SBINDIR= ${PREFIX}/sbin
LINKDIR= ${LIBEXECDIR}
BINPROGS= rc-status
SBINPROGS = openrc openrc-run rc rc-service rc-update runscript \
start-stop-daemon supervise-daemon
RC_BINPROGS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
eindent eoutdent esyslog eval_ecolors ewaitfile \
veinfo vewarn vebegin veend vewend veindent veoutdent \
checkpath fstabinfo mountinfo rc-depend \
is_newer_than is_older_than \
service_get_value service_set_value get_options save_options \
service_starting service_started \
service_stopping service_stopped \
service_inactive service_wasinactive \
service_hotplugged service_started_daemon service_crashed \
shell_var
RC_SBINPROGS= mark_service_starting mark_service_started \
mark_service_stopping mark_service_stopped \
mark_service_inactive mark_service_wasinactive \
mark_service_hotplugged mark_service_failed \
mark_service_crashed \
rc-abort swclock
ifeq (${OS},Linux)
RC_BINPROGS+= kill_all
RC_SBINPROGS+= seedrng
SBINPROGS+= openrc-init openrc-shutdown
endif
ALL_PROGS= ${BINPROGS} ${SBINPROGS} ${RC_BINPROGS} ${RC_SBINPROGS}
CLEANFILES+= ${ALL_PROGS}
LOCAL_CPPFLAGS=-I../includes -I../librc -I../libeinfo
LOCAL_LDFLAGS=-L../librc -L../libeinfo
LDADD+= -lutil -lrc -leinfo
include ${MK}/prog.mk
include ${MK}/gitver.mk
include ${MK}/cc.mk
include ${MK}/termcap.mk
LDADD+= ${LIBDL} ${LIBKVM}
include ${MK}/pam.mk
${SRCS}: version.h
.PHONY: version.h.tmp
version.h.tmp:
echo "#define VERSION \"${VERSION}${GITVER}\"" >$@
if test -n "${BRANDING}"; then \
echo "#define BRANDING \"${BRANDING}\"" >> $@; \
fi
version.h: version.h.tmp
cmp -s $@.tmp $@ && rm $@.tmp || mv $@.tmp $@
install: all
${INSTALL} -d ${DESTDIR}${SBINDIR}
${INSTALL} -m ${BINMODE} ${SBINPROGS} ${DESTDIR}${SBINDIR}
${INSTALL} -d ${DESTDIR}${BINDIR}
${INSTALL} -m ${BINMODE} ${BINPROGS} ${DESTDIR}${BINDIR}
${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
${INSTALL} -m ${BINMODE} ${RC_BINPROGS} ${DESTDIR}${LINKDIR}/bin
${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
${INSTALL} -m ${BINMODE} ${RC_SBINPROGS} ${DESTDIR}${LINKDIR}/sbin
if test "${MKPAM}" = pam; then \
${INSTALL} -d ${DESTDIR}${PAMDIR}; \
${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
${INSTALL} -m ${PAMMODE} supervise-daemon.pam ${DESTDIR}${PAMDIR}/supervise-daemon; \
fi
check test::
all: ${ALL_PROGS}
checkpath: checkpath.o _usage.o rc-misc.o
ifeq (${MKSELINUX},yes)
checkpath: rc-selinux.o
endif
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
kill_all: kill_all.o _usage.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
eindent eoutdent esyslog eval_ecolors ewaitfile \
veinfo vewarn vebegin veend vewend veindent veoutdent: do_e.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
fstabinfo: fstabinfo.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
openrc-init: openrc-init.o rc-plugin.o rc-wtmp.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
is_newer_than: is_newer_than.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
is_older_than: is_older_than.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
mark_service_starting mark_service_started \
mark_service_stopping mark_service_stopped \
mark_service_inactive mark_service_wasinactive \
mark_service_hotplugged mark_service_failed \
mark_service_crashed: do_mark_service.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
mountinfo: mountinfo.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
openrc rc: rc.o rc-logger.o rc-misc.o rc-plugin.o _usage.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
openrc-shutdown: openrc-shutdown.o rc-misc.o _usage.o broadcast.o rc-wtmp.o rc-sysvinit.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
openrc-run runscript: openrc-run.o _usage.o rc-misc.o rc-plugin.o
ifeq (${MKSELINUX},yes)
openrc-run runscript: rc-selinux.o
endif
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
rc-abort: rc-abort.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ -leinfo
rc-depend: rc-depend.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
rc-status: rc-status.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
rc-service: rc-service.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
rc-update: rc-update.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
start-stop-daemon: start-stop-daemon.o _usage.o rc-misc.o rc-pipes.o rc-schedules.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
supervise-daemon: supervise-daemon.o _usage.o rc-misc.o rc-plugin.o rc-schedules.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
service_get_value service_set_value get_options save_options: do_value.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
service_starting service_started \
service_stopping service_stopped \
service_inactive service_wasinactive \
service_hotplugged service_started_daemon \
service_crashed: do_service.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
shell_var: shell_var.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^
swclock: swclock.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
seedrng: seedrng.o _usage.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}

View File

@@ -1,320 +0,0 @@
rc_misc_c = files([
'rc-misc.c',
])
rc_plugin_c = files([
'rc-plugin.c',
])
rc_schedules_c = files([
'rc-schedules.c',
])
usage_c = files([
'_usage.c',
])
if selinux_dep.found()
rc_selinux_c = files([
'rc-selinux.c',
])
else
rc_selinux_c = []
endif
rc_wtmp_c = files([
'rc-wtmp.c',
])
executable('rc-status',
['rc-status.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
dependencies: [util_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: bindir)
executable('openrc',
['rc.c', 'rc-logger.c', rc_misc_c, rc_plugin_c, usage_c,
version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
dependencies: [dl_dep, util_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('openrc-run',
['openrc-run.c', rc_misc_c, rc_plugin_c, usage_c,
rc_selinux_c, version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep, crypt_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('rc',
['rc.c', 'rc-logger.c', rc_misc_c, rc_plugin_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
dependencies: [dl_dep, util_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('rc-service',
['rc-service.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('rc-update',
['rc-update.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
link_with: [libeinfo, librc],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('runscript',
['openrc-run.c', rc_misc_c, usage_c, 'rc-plugin.c',
rc_selinux_c, version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, util_dep, selinux_dep, crypt_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
executable('start-stop-daemon',
['start-stop-daemon.c', 'rc-pipes.c', rc_misc_c, rc_schedules_c,
rc_selinux_c, usage_c, version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [audit_dep, dl_dep, pam_dep, cap_dep, pam_misc_dep, util_dep, selinux_dep, crypt_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
if get_option('pam')
install_data('start-stop-daemon.pam',
rename : 'start-stop-daemon',
install_dir : pamdir)
endif
executable('supervise-daemon',
['supervise-daemon.c', rc_misc_c, rc_plugin_c, rc_schedules_c,
usage_c, version_h],
c_args : [cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [dl_dep, pam_dep, cap_dep, util_dep, selinux_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
if get_option('pam')
install_data('supervise-daemon.pam',
rename : 'supervise-daemon',
install_dir : pamdir)
endif
if os == 'Linux'
executable('openrc-init',
['openrc-init.c', rc_plugin_c, rc_wtmp_c, version_h],
c_args : cc_selinux_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
dependencies: [dl_dep, selinux_dep],
install: true,
install_dir: sbindir)
executable('openrc-shutdown',
['openrc-shutdown.c', 'broadcast.c', 'rc-sysvinit.c', rc_misc_c,
usage_c, rc_wtmp_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: sbindir)
endif
einfo_execs = [
'einfon',
'einfo',
'ewarnn',
'ewarn',
'eerrorn',
'eerror',
'ebegin',
'eend',
'ewend',
'eindent',
'eoutdent',
'esyslog',
'eval_ecolors',
'ewaitfile',
'veinfo',
'vewarn',
'vebegin',
'veend',
'vewend',
'veindent',
'veoutdent',
]
foreach exec: einfo_execs
executable(exec,
['do_e.c', rc_misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
endforeach
executable('checkpath',
['checkpath.c', rc_misc_c, usage_c, rc_selinux_c,
version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
dependencies: [audit_dep, pam_dep, pam_misc_dep, selinux_dep, crypt_dep],
install: true,
install_dir: rc_bindir)
executable('fstabinfo',
['fstabinfo.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
executable('mountinfo',
['mountinfo.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
executable('rc-depend',
['rc-depend.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
executable('is_newer_than',
['is_newer_than.c', rc_misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
executable('is_older_than',
['is_older_than.c', rc_misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
service_execs = [
'service_starting',
'service_started',
'service_stopping',
'service_stopped',
'service_inactive',
'service_wasinactive',
'service_hotplugged',
'service_started_daemon',
'service_crashed',
]
foreach exec : service_execs
executable(exec,
['do_service.c', rc_misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
endforeach
value_execs = [
'service_get_value',
'service_set_value',
'get_options',
'save_options',
]
foreach exec : value_execs
executable(exec,
['do_value.c', rc_misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
endforeach
if os == 'Linux'
executable('kill_all',
['kill_all.c', usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_bindir)
executable('seedrng',
['seedrng.c', usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_sbindir)
endif
executable('shell_var',
['shell_var.c'],
install: true,
install_dir: rc_bindir)
mark_service_execs = [
'mark_service_starting',
'mark_service_started',
'mark_service_stopping',
'mark_service_stopped',
'mark_service_inactive',
'mark_service_wasinactive',
'mark_service_hotplugged',
'mark_service_failed',
'mark_service_crashed',
]
foreach exec : mark_service_execs
executable(exec,
['do_mark_service.c', rc_misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_sbindir)
endforeach
executable('rc-abort',
'rc-abort.c',
include_directories: [einfo_incdir],
link_with: [libeinfo],
install: true,
install_dir: rc_sbindir)
executable('swclock',
['swclock.c', rc_misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_sbindir)

7
src/reboot/meson.build Normal file
View File

@@ -0,0 +1,7 @@
if os == 'Linux' and get_option('sysvinit')
configure_file(input : 'reboot.in',
output : '@BASENAME@',
configuration : script_conf_data,
install_dir: sbindir,
install_mode: 'rwxr-xr-x')
endif

30
src/reboot/reboot.in Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
option_arg=
poweroff_arg=
while getopts :nwdfhik opt; do
case "$opt" in
n) ;;
w) poweroff_arg=--write-only ;;
d) option_arg=--no-write ;;
f) ;;
h) ;;
i) ;;
k) poweroff_arg=--kexec ;;
[?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "${poweroff_arg}" ]; then
poweroff_arg=--reboot
fi
script_args="$@"
if [ -z "${script_args}" ]; then
script_args=now
fi
exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}"

9
src/seedrng/meson.build Normal file
View File

@@ -0,0 +1,9 @@
if os == 'Linux'
executable('seedrng',
['seedrng.c', usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_sbindir)
endif

20
src/service/meson.build Normal file
View File

@@ -0,0 +1,20 @@
service_execs = [
'service_starting',
'service_started',
'service_stopping',
'service_stopped',
'service_inactive',
'service_wasinactive',
'service_hotplugged',
'service_started_daemon',
'service_crashed',
]
foreach exec : service_execs
executable(exec,
['service.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
endforeach

View File

@@ -27,7 +27,7 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
const char *applet = NULL;

View File

@@ -14,7 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
#include "version.h"

35
src/shared/meson.build Normal file
View File

@@ -0,0 +1,35 @@
misc_c = files([
'misc.c',
])
plugin_c = files([
'plugin.c',
])
schedules_c = files([
'schedules.c',
])
if selinux_dep.found()
selinux_c = files([
'selinux.c',
])
else
selinux_c = []
endif
wtmp_c = files([
'wtmp.c',
])
usage_c = files([
'_usage.c',
])
version_h = vcs_tag(
input : 'version.h.in',
output : 'version.h')
version_f = vcs_tag(
input : 'version.in',
output : 'version')

View File

@@ -1,6 +1,6 @@
/*
* rc-misc.c
* rc misc functions
* misc.c
* misc functions
*/
/*
@@ -38,7 +38,7 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "version.h"
extern char **environ;

View File

@@ -1,5 +1,5 @@
/*
* rc-misc.h
* misc.h
* This is private to us and not for user consumption
*/

View File

@@ -1,5 +1,5 @@
/*
* rc-plugin.c
* plugin.c
* Simple plugin handler
*/
@@ -32,8 +32,8 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"
#include "misc.h"
#include "plugin.h"
#define RC_PLUGIN_HOOK "rc_plugin_hook"

View File

@@ -1,5 +1,5 @@
/*
* rc-plugin.h
* plugin.h
* Private instructions to use plugins
*/

View File

@@ -39,8 +39,8 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-schedules.h"
#include "misc.h"
#include "schedules.h"
#include "helpers.h"
typedef struct scheduleitem {

View File

@@ -1,5 +1,5 @@
/*
* rc-selinux.c
* selinux.c
* SELinux helpers to get and set contexts.
*/
@@ -34,9 +34,9 @@
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"
#include "rc-selinux.h"
#include "misc.h"
#include "plugin.h"
#include "selinux.h"
/* the context files for selinux */
#define INITRC_FILE "initrc_context"

View File

@@ -1,5 +1,5 @@
/*
* rc-wtmp.c
* wtmp.c
* This file contains routines to deal with the wtmp file.
*/
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <sys/utsname.h>
#include "rc-wtmp.h"
#include "wtmp.h"
void log_wtmp(const char *user, const char *id, pid_t pid, int type,
const char *line)

View File

@@ -0,0 +1,4 @@
executable('shell_var',
['shell_var.c'],
install: true,
install_dir: rc_bindir)

7
src/shutdown/meson.build Normal file
View File

@@ -0,0 +1,7 @@
if os == 'Linux' and get_option('sysvinit')
configure_file(input : 'shutdown.in',
output : '@BASENAME@',
configuration : script_conf_data,
install_dir: sbindir,
install_mode: 'rwxr-xr-x')
endif

46
src/shutdown/shutdown.in Normal file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
do_halt=false
while getopts :akrhPHfFnct: opt; do
case "$opt" in
a) ;;
k) ;;
r)
shutdown_arg=--reboot
;;
h)
do_halt=true
shutdown_arg=--poweroff
;;
P)
if ! ${do_halt}; then
printf "%s\n" "The -P flag requires the -h flag" >&2
exit 1
fi
shutdown_arg=--poweroff
;;
H)
if ! ${do_halt}; then
printf "%s\n" "The -H flag requires the -h flag" >&2
exit 1
fi
shutdown_arg=--halt
;;
f) ;;
F) ;;
n) ;;
c) ;;
t) ;;
[?]) printf "%s\n" "${0##*/}: invalid command line option" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "${shutdown_arg}" ]; then
shutdown_arg=--single
fi
printf "%s %s\n" "@SBINDIR@/openrc-shutdown ${shutdown_arg}" "$@"
exec @SBINDIR@/openrc-shutdown ${shutdown_arg} "$@"

View File

@@ -0,0 +1,15 @@
executable('start-stop-daemon',
['start-stop-daemon.c', 'rc-pipes.c', misc_c, schedules_c,
selinux_c, usage_c, version_h],
c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [audit_dep, dl_dep, pam_dep, cap_dep, pam_misc_dep, util_dep, selinux_dep, crypt_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
if get_option('pam')
install_data('start-stop-daemon.pam',
rename : 'start-stop-daemon',
install_dir : pamdir)
endif

View File

@@ -70,9 +70,9 @@ static struct pam_conv conv = { NULL, NULL};
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "rc-pipes.h"
#include "rc-schedules.h"
#include "schedules.h"
#include "_usage.h"
#include "helpers.h"

View File

@@ -0,0 +1,14 @@
executable('supervise-daemon',
['supervise-daemon.c', misc_c, plugin_c, schedules_c, usage_c, version_h],
c_args : [cc_branding_flags, cc_pam_flags, cc_cap_flags, cc_selinux_flags],
link_with: [libeinfo, librc],
dependencies: [dl_dep, pam_dep, cap_dep, util_dep, selinux_dep],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
install_dir: sbindir)
if get_option('pam')
install_data('supervise-daemon.pam',
rename : 'supervise-daemon',
install_dir : pamdir)
endif

View File

@@ -65,9 +65,9 @@ static struct pam_conv conv = { NULL, NULL};
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"
#include "rc-schedules.h"
#include "misc.h"
#include "plugin.h"
#include "schedules.h"
#include "_usage.h"
#include "helpers.h"

7
src/swclock/meson.build Normal file
View File

@@ -0,0 +1,7 @@
executable('swclock',
['swclock.c', misc_c, usage_c, version_h],
c_args : cc_branding_flags,
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_sbindir)

View File

@@ -31,7 +31,7 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
#include "_usage.h"
#define RC_SHUTDOWNTIME RC_SVCDIR "/shutdowntime"

15
src/value/meson.build Normal file
View File

@@ -0,0 +1,15 @@
value_execs = [
'service_get_value',
'service_set_value',
'get_options',
'save_options',
]
foreach exec : value_execs
executable(exec,
['value.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
endforeach

View File

@@ -29,7 +29,7 @@
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "misc.h"
const char *applet = NULL;