diff options
| author | William Hubbs <w.d.hubbs@gmail.com> | 2014-12-03 10:13:41 -0600 |
|---|---|---|
| committer | William Hubbs <w.d.hubbs@gmail.com> | 2014-12-03 10:13:41 -0600 |
| commit | 1267025fb76af18e31b2c7de16606abbb9b87ea3 (patch) | |
| tree | 8cc3a36b1dd7e1438d05a293cae8eac572126a7c /init.d | |
| parent | 30cc3cdb76a66c7c0f89a52db4e5cff77b570e31 (diff) | |
initial commitorigin/gh-pagesgithub/gh-pages
Diffstat (limited to 'init.d')
59 files changed, 0 insertions, 3537 deletions
diff --git a/init.d/.gitignore b/init.d/.gitignore deleted file mode 100644 index 04f725d1..00000000 --- a/init.d/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -bootmisc -fsck -hostname -local -localmount -loopback -moused -netmount -network -root -savecache -swap -swapfiles -sysctl -urandom -devfs -dmesg -hwclock -consolefont -keymaps -killprocs -modules -mount-ro -mtab -numlock -osclock -procfs -staticroute -sysfs -devdb -hostid -newsyslog -pf -rarpd -rc-enabled -rpcbind -savecore -swap-blk -swclock -syslogd -termencoding -ttys -wscons -tmpfiles.dev -tmpfiles.setup diff --git a/init.d/Makefile b/init.d/Makefile deleted file mode 100644 index 85925b15..00000000 --- a/init.d/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include ../mk/net.mk - -DIR= ${INITDIR} -SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in loopback.in \ - netmount.in osclock.in root.in savecache.in swap.in swapfiles.in \ - tmpfiles.setup.in swclock.in sysctl.in urandom.in ${SRCS-${OS}} -BIN= ${OBJS} - -# Are we installing our network scripts? -ifeq (${MKNET},yes) -SRCS+= network.in staticroute.in -endif - -MK= ../mk -include ${MK}/os.mk - -# Generic BSD scripts -SRCS-FreeBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ - rpcbind.in savecore.in syslogd.in -# These are FreeBSD specific -SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in encswap.in ipfw.in \ - mixer.in nscd.in powerd.in syscons.in - -SRCS-Linux= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \ - killprocs.in modules.in mount-ro.in mtab.in numlock.in \ - procfs.in sysfs.in termencoding.in tmpfiles.dev.in - -# Generic BSD scripts -SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ - rpcbind.in savecore.in syslogd.in -# These are NetBSD specific -SRCS-NetBSD+= devdb.in swap-blk.in ttys.in wscons.in - -%.in: %${SFX} - sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ - -include ${MK}/scripts.mk - -_installafter_: realinstall diff --git a/init.d/adjkerntz.in b/init.d/adjkerntz.in deleted file mode 100644 index 93a200bf..00000000 --- a/init.d/adjkerntz.in +++ /dev/null @@ -1,62 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -extra_commands="save" - -description="Sets the local clock to UTC or Local Time." -description_save="Saves the current time in the BIOS." - -: ${clock:=${CLOCK:-UTC}} -if [ "$clock" = "UTC" ]; then - utc="UTC" -else - utc="Local Time" -fi - -depend() -{ - provide clock - # BSD adjkerntz needs to be able to write to /etc - if [ "$clock" = "UTC" -a -e /etc/wall_cmos_clock ] || - [ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then - need root - fi - keyword -jail -prefix -} - -start() -{ - ebegin "Starting the System Clock Adjuster [${utc}]" - if [ "$clock" != "UTC" ]; then - echo >/etc/wall_cmos_clock - start-stop-daemon --start --exec /sbin/adjkerntz -- -i - else - rm -f /etc/wall_cmos_clock - /sbin/adjkerntz -i - fi - eend $? -} - -save() -{ - ebegin "Setting hardware clock using the system clock [${utc}]" - adjkerntz -a - eend $? -} - -stop() -{ - # Don't tweak the hardware clock on LiveCD halt. - if yesno "${clock_systohc:-$CLOCK_SYSTOHC}"; then - [ -z "$CDBOOT" ] && save - fi - - ebegin "Stopping the System Clock Adjuster" - if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz; then - start-stop-daemon --stop --exec /sbin/adjkerntz - eend $? - else - eend 0 - fi -} diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in deleted file mode 100644 index 2ec075f3..00000000 --- a/init.d/bootmisc.in +++ /dev/null @@ -1,219 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - need localmount - before logger - after clock root sysctl - keyword -prefix -timeout -} - -: ${wipe_tmp:=${WIPE_TMP:-yes}} -: ${log_dmesg:=${LOG_DMESG:-yes}} - -cleanup_tmp_dir() -{ - local dir="$1" - - if ! [ -d "$dir" ]; then - mkdir -p "$dir" || return $? - fi - checkpath -W "$dir" || return 1 - chmod a+rwt "$dir" 2> /dev/null - cd "$dir" || return 1 - if yesno $wipe_tmp; then - ebegin "Wiping $dir directory" - - # Faster than raw find - if ! rm -rf -- [!ajlq\.]* 2>/dev/null ; then - # Blah, too many files - find . -maxdepth 1 -name '[!ajlq\.]*' -exec rm -rf -- {} + - fi - - # pam_mktemp creates a .private directory within which - # each user gets a private directory with immutable - # bit set; remove the immutable bit before trying to - # remove it. - [ -d /tmp/.private ] && chattr -R -a /tmp/.private 2> /dev/null - - # Prune the paths that are left - find . -maxdepth 1 \ - ! -name . \ - ! -name lost+found \ - ! -name quota.user \ - ! -name aquota.user \ - ! -name quota.group \ - ! -name aquota.group \ - ! -name journal \ - -exec rm -rf -- {} + - eend 0 - else - ebegin "Cleaning $dir directory" - rm -rf -- .X*-lock esrv* kio* \ - jpsock.* .fam* .esd* \ - orbit-* ssh-* ksocket-* \ - .*-unix - eend 0 - fi -} - -cleanup_var_run_dir() -{ - ebegin "Cleaning /var/run" - for x in $(find /var/run ! -type d ! -name utmp \ - ! -name random-seed ! -name dev.db \ - ! -name ld-elf.so.hints ! -name ld.so.hints); - do - # Clean stale sockets - if [ -S "$x" ]; then - if command -v fuser >/dev/null 2>&1; then - fuser "$x" >/dev/null 2>&1 || rm -- "$x" - else - rm -- "$x" - fi - fi - [ ! -f "$x" ] && continue - # Do not remove pidfiles of already running daemons - case "$x" in - *.pid) - start-stop-daemon --test --quiet \ - --stop --pidfile "$x" && continue - ;; - esac - rm -f -- "$x" - done - eend 0 -} - -mkutmp() -{ - : >"$1" - # Not all systems have the utmp group - chgrp utmp "$1" 2>/dev/null - chmod 0664 "$1" -} - -migrate_to_run() -{ - src="$1" - dst="$2" - if [ -L $src -a "$(readlink -f $src)" != $dst ]; then - ewarn "$src does not point to $dst." - ewarn "Setting $src to point to $dst." - rm $src - elif [ ! -L $src -a -d $src ]; then - ebegin "Migrating $src to $dst" - cp -a $src/* $dst/ - rm -rf $src - eend $? - fi - # If $src doesn't exist at all, just run this - if [ ! -e $src ]; then - ln -s $dst $src - fi -} - -clean_run() -{ - [ "$RC_SYS" = VSERVER -o "$RC_SYS" = LXC ] && return 0 - local dir - dir=$(mktemp -d) - mount --bind / $dir - rm -rf $dir/run/* - umount $dir - rm -rf $dir -} - -start() -{ - # Remove any added console dirs - if checkpath -W "$RC_LIBEXECDIR"; then - rm -rf "$RC_LIBEXECDIR"/console/* - fi - - local logw=false runw=false extra= - # Ensure that our basic dirs exist - if [ "$RC_UNAME" = Linux ]; then - # Satisfy Linux FHS - extra=/var/lib/misc - if [ ! -d /run ]; then - extra="/var/run $extra" - fi - else - extra=/var/run - fi - for x in /var/log /tmp $extra; do - if ! [ -d $x ]; then - if ! mkdir -p $x; then - eend 1 "failed to create needed directory $x" - return 1 - fi - fi - done - - if [ "$RC_UNAME" = Linux -a -d /run ]; then - migrate_to_run /var/lock /run/lock - migrate_to_run /var/run /run - clean_run - fi - - if checkpath -W /var/run; then - ebegin "Creating user login records" - local xtra= - [ "$RC_UNAME" = NetBSD ] && xtra=x - for x in "" $xtra; do - mkutmp /var/run/utmp$x - done - [ -e /var/log/wtmp ] || mkutmp /var/log/wtmp - eend 0 - - mountinfo -q -f tmpfs /var/run || cleanup_var_run_dir - fi - - # Clean up /tmp directories - local tmp= - for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do - mountinfo -q -f tmpfs "$tmp" || cleanup_tmp_dir "$tmp" - done - - if checkpath -W /tmp; then - # Make sure our X11 stuff have the correct permissions - # Omit the chown as bootmisc is run before network is up - # and users may be using lame LDAP auth #139411 - rm -rf /tmp/.ICE-unix /tmp/.X11-unix - mkdir -p /tmp/.ICE-unix /tmp/.X11-unix - chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix - if [ -x /sbin/restorecon ]; then - restorecon /tmp/.ICE-unix /tmp/.X11-unix - fi - fi - - if yesno $log_dmesg; then - if $logw || checkpath -W /var/log; then - # Create an 'after-boot' dmesg log - if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ -a "$RC_SYS" != LXC ]; then - dmesg > /var/log/dmesg - chmod 640 /var/log/dmesg - fi - fi - fi - - return 0 -} - -stop() -{ - # Write a halt record if we're shutting down - if [ "$RC_RUNLEVEL" = shutdown ]; then - [ "$RC_UNAME" = Linux ] && halt -w - if [ "$RC_SYS" = OPENVZ ]; then - yesno $RC_REBOOT && printf "" >/reboot - fi - fi - - return 0 -} - -# vim: ft=sh diff --git a/init.d/consolefont.in b/init.d/consolefont.in deleted file mode 100644 index 7ec93d66..00000000 --- a/init.d/consolefont.in +++ /dev/null @@ -1,63 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Sets a font for the consoles." - -depend() -{ - need localmount termencoding - after hotplug bootmisc - keyword -openvz -prefix -uml -vserver -xenu -lxc -} - -start() -{ - ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} - consolefont=${consolefont:-${CONSOLEFONT}} - unicodemap=${unicodemap:-${UNICODEMAP}} - consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}} - - if [ -z "$consolefont" ]; then - ebegin "Using the default console font" - eend 0 - return 0 - fi - - if [ "$ttyn" = 0 ]; then - ebegin "Skipping font setup (rc_tty_number == 0)" - eend 0 - return 0 - fi - - local x= param= sf_param= retval=0 ttydev=/dev/tty - - # Get additional parameters - if [ -n "$consoletranslation" ]; then - param="$param -m $consoletranslation" - fi - if [ -n "${unicodemap}" ]; then - param="$param -u $unicodemap" - fi - - # Set the console font - ebegin "Setting console font [$consolefont]" - [ -d /dev/vc ] && ttydev=/dev/vc/ - x=1 - while [ $x -le $ttyn ]; do - if ! setfont $consolefont $param -C $ttydev$x >/dev/null; then - retval=1 - break - fi - : $(( x += 1 )) - done - eend $retval - - # Store the font so we can use it ASAP on boot - if [ $retval -eq 0 ] && checkpath -W "$RC_LIBEXECDIR"; then - mkdir -p "$RC_LIBEXECDIR"/console - setfont -O "$RC_LIBEXECDIR"/console/font - fi - - return $retval -} diff --git a/init.d/devd.in b/init.d/devd.in deleted file mode 100644 index d071911c..00000000 --- a/init.d/devd.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -command=/sbin/devd -command_args=$devd_args -name="Device State Change Daemon" - -depend() { - need localmount - after bootmisc - before net.lo0 - keyword -jail -prefix -} - -start_pre() { - sysctl hw.bus.devctl_disable=0 >/dev/null -} - -stop_post() { - sysctl hw.bus.devctl_disable=1 >/dev/null -} diff --git a/init.d/devdb.in b/init.d/devdb.in deleted file mode 100644 index 3cc08a59..00000000 --- a/init.d/devdb.in +++ /dev/null @@ -1,21 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Creates the dev database" - -depend() -{ - need localmount -} - -start() -{ - ebegin "Building the dev database" - if [ /var/run/dev.db -nt /dev ]; then - : - else - dev_mkdb - fi - eend $? -} diff --git a/init.d/devfs.in b/init.d/devfs.in deleted file mode 100644 index 5af68f91..00000000 --- a/init.d/devfs.in +++ /dev/null @@ -1,121 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Set up the /dev directory" - -depend() -{ - provide dev-mount - before dev - keyword -prefix -vserver -lxc -} - -mount_dev() -{ - local action=--mount devfstype msg=Mounting - # Some devices require exec, Bug #92921 - local mountopts="exec,nosuid,mode=0755" - if yesno ${skip_mount_dev:-no} ; then - einfo "/dev will not be mounted due to user request" - return 0 - fi - if mountinfo -q /dev; then - action=--remount - mountopts="remount,$mountopts" - msg=Remounting - fi - if fstabinfo -q /dev; then - ebegin "$msg /dev according to @SYSCONFDIR@/fstab" - fstabinfo -q $action /dev - eend $? - return 0 - fi - if grep -q devtmpfs /proc/filesystems; then - devfstype=devtmpfs - mountopts="$mountopts,size=10M" - elif grep -q tmpfs /proc/filesystems; then - devfstype=tmpfs - mountopts="$mountopts,size=10M" - fi - if [ -n "$devfstype" ]; then - ebegin "$msg $devfstype on /dev" - mount -n -t $devfstype -o $mountopts dev /dev - eend $? - else - ewarn "This kernel does not have devtmpfs or tmpfs support, and there" - ewarn "is no entry for /dev in fstab." - ewarn "This means /dev will not be mounted." - ewarn "To avoid this message, set CONFIG_DEVTMPFS or CONFIG_TMPFS to y" - ewarn "in your kernel configuration or see @SYSCONFDIR@/conf.d/devfs" - fi - return 0 -} - -seed_dev() -{ - # Seed /dev with some things that we know we need - - # creating /dev/console, /dev/tty and /dev/tty1 to be able to write - # to $CONSOLE with/without bootsplash before udevd creates it - [ -c /dev/console ] || mknod -m 600 /dev/console c 5 1 - [ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1 - [ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0 - - # udevd will dup its stdin/stdout/stderr to /dev/null - # and we do not want a file which gets buffered in ram - [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3 - - # so udev can add its start-message to dmesg - [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11 - - # extra symbolic links not provided by default - [ -e /dev/fd ] || ln -snf /proc/self/fd /dev/fd - [ -e /dev/stdin ] || ln -snf /proc/self/fd/0 /dev/stdin - [ -e /dev/stdout ] || ln -snf /proc/self/fd/1 /dev/stdout - [ -e /dev/stderr ] || ln -snf /proc/self/fd/2 /dev/stderr - [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core - - # Mount required directories as user may not have them in /etc/fstab - for x in \ - "mqueue /dev/mqueue 1777 ,nodev mqueue" \ - "devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \ - "tmpfs /dev/shm 1777 ,nodev,mode=1777 shm" \ - ; do - set -- $x - grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue - mountinfo -q $2 && continue - - if [ ! -d $2 ]; then - mkdir -m $3 -p $2 >/dev/null 2>&1 || \ - ewarn "Could not create $2!" - fi - - if [ -d $2 ]; then - ebegin "Mounting $2" - if ! fstabinfo --mount $2; then - mount -n -t $1 -o noexec,nosuid$4 $5 $2 - fi - eend $? - fi - done -} - -restorecon_dev() -{ - if [ -x /sbin/restorecon ]; then - ebegin "Restoring SELinux contexts in /dev" - restorecon -rF /dev >/dev/null 2>&1 - eend $? - fi - - return 0 -} - -start() -{ - mount_dev - seed_dev - restorecon_dev - return 0 -} diff --git a/init.d/dmesg.in b/init.d/dmesg.in deleted file mode 100644 index 5b001fca..00000000 --- a/init.d/dmesg.in +++ /dev/null @@ -1,18 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Set the dmesg level for a cleaner boot" - -depend() -{ - before dev modules - keyword -lxc -prefix -vserver -} - -start() -{ - if [ -n "$dmesg_level" ]; then - dmesg -n$dmesg_level - fi -} diff --git a/init.d/dumpon.in b/init.d/dumpon.in deleted file mode 100644 index 1e23076b..00000000 --- a/init.d/dumpon.in +++ /dev/null @@ -1,25 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Configures a specific kernel dump device." - -depend() { - need swap - keyword -jail -prefix -} - -start() { - # Setup any user requested dump device - if [ -n "$dump_device" ]; then - ebegin "Activating kernel core dump device ($dump_device)" - dumpon ${dump_device} - eend $? - fi -} - -stop() { - ebegin "Deactivating kernel core dump device" - dumpon off - eend $? -} diff --git a/init.d/encswap.in b/init.d/encswap.in deleted file mode 100644 index 3df4a356..00000000 --- a/init.d/encswap.in +++ /dev/null @@ -1,43 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright 1992-2012 FreeBSD Project -# Released under the 2-clause BSD license - -depend() { - before swap -} - -start() { - while read device mountpoint type options rest ; do - case ":${device}:${type}:${options}" in - :#*) - ;; - *.bde:swap:sw) - passphrase=$(dd if=/dev/random count=1 2>/dev/null | md5 -q) - device="${device%.bde}" - gbde init "${device}" -P "${passphrase}" || return 1 - gbde attach "${device}" -p "${passphrase}" || return 1 - ;; - *.eli:swap:sw) - device="${device%.eli}" - geli onetime ${geli_swap_flags} "${device}" || return 1 - ;; - esac - done < /etc/fstab -} - -stop() { - while read device mountpoint type options rest ; do - case ":${device}:${type}:${options}" in - :#*) - ;; - *.bde:swap:sw) - device="${device%.bde}" - gbde detach "${device}" - ;; - *.eli:swap:sw) - # Nothing here, because geli swap devices should be - # created with the auto-detach-on-last-close option. - ;; - esac - done < /etc/fstab -} diff --git a/init.d/fsck.in b/init.d/fsck.in deleted file mode 100644 index d3b66078..00000000 --- a/init.d/fsck.in +++ /dev/null @@ -1,123 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Check and repair filesystems according to /etc/fstab" -_IFS=" -" - -depend() -{ - use dev clock modules - keyword -jail -openvz -prefix -timeout -vserver -lxc -uml -} - -_abort() { - rc-abort - return 1 -} - -# We should only reboot when first booting -_reboot() { - if [ "$RC_RUNLEVEL" = "$RC_BOOTLEVEL" ]; then - reboot "$@" - _abort || return 1 - fi -} - -_forcefsck() -{ - [ -e /forcefsck ] || get_bootparam forcefsck -} - -start() -{ - local fsck_opts= p= check_extra= - - if [ -e /fastboot ]; then - ewarn "Skipping fsck due to /fastboot" - return 0 - fi - if _forcefsck; then - fsck_opts="$fsck_opts -f" - check_extra="(check forced)" - elif ! yesno ${fsck_on_battery:-YES} && ! on_ac_power; then - ewarn "Skipping fsck due to not being on AC power" - return 0 - fi - - if [ -n "$fsck_passno" ]; then - check_extra="[passno $fsck_passno] $check_extra" - if [ -n "$fsck_mnt" ]; then - eerror "Only 1 of fsck_passno and fsck_mnt must be set!" - return 1 - fi - fi - ebegin "Checking local filesystems $check_extra" - # Append passno mounts - for p in $fsck_passno; do - local IFS="$_IFS" - case "$p" in - [0-9]*) p="=$p";; - esac - set -- "$@" $(fstabinfo --passno "$p") - unset IFS - done - # Append custom mounts - for m in $fsck_mnt ; do - local IFS="$_IFS" - set -- "$@" "$m" - unset IFS - done - - if [ "$RC_UNAME" = Linux ]; then - local skiptypes - skiptypes=$(printf 'no%s,' ${net_fs_list} ${extra_net_fs_list}) - [ "${skiptypes}" = "no," ] && skiptypes="" - fsck_opts="$fsck_opts -C0 -T -t ${skiptypes}noopts=_netdev" - if [ -z "$fsck_passno" -a -z "$fsck_mnt" ]; then - fsck_args=${fsck_args:--A -p} - if echo 2>/dev/null >/.test.$$; then - rm -f /.test.$$ - fsck_opts="$fsck_opts -R" - fi - fi - fi - - trap : INT QUIT - fsck ${fsck_args:--p} $fsck_opts "$@" - case $? in - 0) eend 0; return 0;; - 1) ewend 1 "Filesystems repaired"; return 0;; - 2|3) if [ "$RC_UNAME" = Linux ]; then - ewend 1 "Filesystems repaired, but reboot needed" - _reboot -f - else - ewend 1 "Filesystems still have errors;" \ - "manual fsck required" - _abort - fi;; - 4) if [ "$RC_UNAME" = Linux ]; then - ewend 1 "Fileystem errors left uncorrected, aborting" - _abort - else - ewend 1 "Filesystems repaired, but reboot needed" - _reboot - fi;; - 8) ewend 1 "Operational error"; return 0;; - 12) ewend 1 "fsck interrupted";; - *) eend 2 "Filesystems couldn't be fixed";; - esac - _abort || return 1 -} - -stop() -{ - # Fake function so we always shutdown correctly. - _abort() { return 0; } - _reboot() { return 0; } - _forcefsck() { return 1; } - - yesno $fsck_shutdown && start - return 0 -} diff --git a/init.d/hostid.in b/init.d/hostid.in deleted file mode 100644 index 4495ddf6..00000000 --- a/init.d/hostid.in +++ /dev/null @@ -1,80 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -extra_commands="reset" -: ${hostid_file:=/etc/hostid} - -depend() -{ - use root - before devd net - keyword -jail -prefix -} - -_set() -{ - local id=0 - - if [ -n "$1" ]; then - id=$(echo "$1" | md5) - id="0x${id%????????????????????????}" - fi - ebegin "Setting Host ID: $id" - sysctl -w kern.hostid="$id" >/dev/null - eend $? || return 1 - - if sysctl -n kern.hostuuid >/dev/null 2>&1; then - [ -n "$1" ] && id=$1 - ebegin "Setting Host UUID: $id" - sysctl kern.hostuuid="$id" >/dev/null - eend $? || return 1 - fi - -} - -# First we check to see if there is a system UUID -# If so then we use that and erase the hostid file, -# otherwise we generate a random UUID. -reset() -{ - local uuid= x="[0-9a-f]" y="$x$x$x$x" - - if command -v kenv >/dev/null 2>&1; then - uuid=$(kenv smbios.system.uuid 2>/dev/null) - fi - case "$uuid" in - $y$y-$y-$y-$y-$y$y$y);; - *) uuid=;; - esac - - if [ -n "$uuid" ]; then - rm -f "$hostid_file" - else - uuid=$(uuidgen) - if [ -z "$uuid" ]; then - eerror "Unable to generate a UUID" - return 1 - fi - if ! echo "$uuid" >"$hostid_file"; then - eerror "Failed to store UUID in \`$hostid_file'" - return 1 - fi - fi - - _set "$uuid" -} - -start() -{ - if [ -r "$hostid_file" ]; then - _set $(cat "$hostid_file") - else - reset - fi -} - -stop() -{ - _set -} diff --git a/init.d/hostname.in b/init.d/hostname.in deleted file mode 100644 index eaeb79aa..00000000 --- a/init.d/hostname.in +++ /dev/null @@ -1,19 +0,0 @@ -#!@SBINDIR@/openrc-run -# 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 -} - -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 - ebegin "Setting hostname to $hostname" - hostname "$hostname" - eend $? "Failed to set the hostname" -} diff --git a/init.d/hwclock.in b/init.d/hwclock.in deleted file mode 100644 index 4b0da02c..00000000 --- a/init.d/hwclock.in +++ /dev/null @@ -1,141 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -extra_commands="save show" - -description="Sets the local clock to UTC or Local Time." -description_save="Saves the current time in the BIOS." -description_show="Displays the current time in the BIOS." - -: ${clock_adjfile:=${CLOCK_ADJFILE}} -: ${clock_args:=${CLOCK_OPTS}} -: ${clock_systohc:=${CLOCK_SYSTOHC}} -: ${clock:=${CLOCK:-UTC}} -if [ "$clock" = "UTC" ]; then - utc="UTC" - utc_cmd="--utc" -else - utc="Local Time" - utc_cmd="--localtime" -fi - -depend() -{ - provide clock - if yesno $clock_adjfile; then - use root - else - before * - fi - keyword -openvz -prefix -uml -vserver -xenu -lxc -} - -setupopts() -{ - case "$(uname -m)" in - s390*) - utc="s390" - ;; - *) - if [ -e /proc/devices ] && \ - grep -q " cobd$" /proc/devices - then - utc="coLinux" - fi - ;; - esac - - case "$utc" in - UTC|Local" "Time);; - *) unset utc_cmd;; - esac -} - -# hwclock doesn't always return non zero on error -_hwclock() -{ - local err="$(hwclock "$@" 2>&1 >/dev/null)" - - [ -z "$err" ] && return 0 - echo "${err}" >&2 - return 1 -} - -start() -{ - local retval=0 errstr="" - setupopts - - if [ -z "$utc_cmd" ]; then - ewarn "Not setting clock for $utc system" - return 0 - fi - - ebegin "Setting system clock using the hardware clock [$utc]" - if [ -e /proc/modules ]; then - local rtc= - for rtc in /dev/rtc /dev/rtc[0-9]*; do - [ -e "$rtc" ] && break - done - if [ ! -e "${rtc}" ]; then - modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc - fi - fi - - # Always set the kernel's time zone. - _hwclock --systz $utc_cmd $clock_args - : $(( retval += $? )) - - if [ -e /etc/adjtime ] && yesno $clock_adjfile; then - _hwclock --adjust $utc_cmd - : $(( retval += $? )) - fi - - if yesno ${clock_hctosys:-YES}; then - _hwclock --hctosys $utc_cmd $clock_args - : $(( retval += $? )) - fi - - eend $retval "Failed to set the system clock" - - return 0 -} - -stop() -{ - # Don't tweak the hardware clock on LiveCD halt. - [ -n "$CDBOOT" ] && return 0 - yesno ${clock_systohc:-YES} || return 0 - - local retval=0 errstr="" - setupopts - - [ -z "$utc_cmd" ] && return 0 - - ebegin "Setting hardware clock using the system clock" "[$utc]" - - if ! yesno $clock_adjfile; then - # Some implementations don't handle adjustments - if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then - utc_cmd="$utc_cmd --noadjfile" - fi - fi - - _hwclock --systohc $utc_cmd $clock_args - retval=$? - - eend $retval "Failed to sync clocks" -} - -save() -{ - clock_systohc=yes - stop -} - -show() -{ - setupopts - hwclock --show "$utc_cmd" $clock_args -} diff --git a/init.d/ipfw.in b/init.d/ipfw.in deleted file mode 100644 index df30f3b3..00000000 --- a/init.d/ipfw.in +++ /dev/null @@ -1,159 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -# This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD - -ipfw_ip_in=${ipfw_ip_in-any} -ipfw_ports_in=${ipfw_ports_in-auth ssh} -ipfw_ports_nolog=${ipfw_ports_nolog-135-139,445 1026,1027 1433,1434} - -extra_commands="panic showstatus" - -depend() { - before net - provide firewall - keyword -jail -} - -ipfw() { - /sbin/ipfw -f -q "$@" -} - -have_ip6() { - sysctl net.ipv6 2>/dev/null -} - -init() { - # Load the kernel module - if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>&1; then - if ! kldload ipfw; then - eend 1 "Unable to load firewall module" - return 1 - fi - fi - - # Now all rules and give a good base - ipfw flush - - ipfw add pass all from any to any via lo0 - ipfw add deny all from any to 127.0.0.0/8 - ipfw add deny ip from 127.0.0.0/8 to any - - if have_ip6; then - ipfw add pass ip6 from any to any via lo0 - ipfw add deny ip6 from any to ::1 - ipfw add deny ip6 from ::1 to any - - ipfw add pass ip6 from :: to ff02::/16 proto ipv6-icmp - ipfw add pass ip6 from fe80::/10 to fe80::/10 proto ipv6-icmp - ipfw add pass ip6 from fe80::/10 to ff02::/16 proto ipv6-icmp - fi -} - -start() { - local i= p= log= - ebegin "Starting firewall rules" - if ! init; then - eend 1 "Failed to flush firewall ruleset" - return 1 - fi - - # Use a stateful firewall - ipfw add check-state - ipfw add pass tcp from me to any established - - # Allow any connection out, adding state for each. - ipfw add pass tcp from me to any setup keep-state - ipfw add pass udp from me to any keep-state - ipfw add pass icmp from me to any keep-state - - if have_ip6; then - ipfw add pass tcp from me6 to any setup keep-state - ipfw add pass udp from me6 to any keep-state - ipfw add pass icmp from me6 to any keep-state - fi - - # Allow DHCP. - ipfw add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out - ipfw add pass udp from any 67 to me 68 in - ipfw add pass udp from any 67 to 255.255.255.255 68 in - # Some servers will ping the IP while trying to decide if it's - # still in use. - ipfw add pass icmp from any to any icmptype 8 - - # Allow "mandatory" ICMP in. - ipfw add pass icmp from any to any icmptype 3,4,11 - - if have_ip6; then - # Allow ICMPv6 destination unreach - ipfw add pass ip6 from any to any icmp6types 1 proto ipv6-icmp - - # Allow NS/NA/toobig (don't filter it out) - ipfw add pass ip6 from any to any icmp6types 2,135,136 proto ipv6-icmp - fi - - # Add permits for this workstations published services below - # Only IPs and nets in firewall_allowservices is allowed in. - for i in $ipfw_ip_in; do - for p in $ipfw_ports_in; do - ipfw add pass tcp from $i to me $p - done - done - - # Allow all connections from trusted IPs. - # Playing with the content of firewall_trusted could seriously - # degrade the level of protection provided by the firewall. - for i in $ipfw_ip_trust; do - ipfw add pass ip from $i to me - done - - ipfw add 65000 count ip from any to any - - # Drop packets to ports where we don't want logging - for p in $ipfw_ports_nolog; do - ipfw add deny { tcp or udp } from any to any $p in - done - - # Broadcasts and muticasts - ipfw add deny ip from any to 255.255.255.255 - ipfw add deny ip from any to 224.0.0.0/24 - - # Noise from routers - ipfw add deny udp from any to any 520 in - - # Noise from webbrowsing. - # The stateful filter is a bit aggressive, and will cause some - # connection teardowns to be logged. - ipfw add deny tcp from any 80,443 to any 1024-65535 in - - # Deny and (if wanted) log the rest unconditionally. - if yesno ${ipfw_log_deny:-no}; then - log=log - sysctl net.inet.ip.fw.verbose=1 >/dev/null - fi - ipfw add deny $log ip from any to any - - eend 0 -} - -stop() { - ebegin "Stopping firewall rules" - # We don't unload the kernel module as that action - # can cause memory leaks as of FreeBSD 6.x - sysctl net.inet.ip.fw.enable=0 >/dev/null - eend $? -} - -panic() { - ebegin "Stopping firewall rules - hard" - if ! init; then - eend 1 "Failed to flush firewall ruleset" - return 1 - fi - eend 0 -} - -showstatus() { - ipfw show -} diff --git a/init.d/keymaps.in b/init.d/keymaps.in deleted file mode 100644 index eeed22a2..00000000 --- a/init.d/keymaps.in +++ /dev/null @@ -1,70 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Applies a keymap for the consoles." - -depend() -{ - need localmount termencoding - after bootmisc - keyword -openvz -prefix -uml -vserver -xenu -lxc -} - -start() -{ - ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} - : ${unicode:=$UNICODE} - : ${keymap:=$KEYMAP} - : ${extended_keymaps:=$EXTENDED_KEYMAPS} - : ${windowkeys:=$SET_WINDOWSKEYS} - : ${fix_euro:=$FIX_EURO} - : ${dumpkeys_charset:=${DUMPKEYS_CHARSET}} - - if [ -z "$keymap" ]; then - eerror "You need to setup keymap in /etc/conf.d/keymaps first" - return 1 - fi - - local ttydev=/dev/tty n= - [ -d /dev/vc ] && ttydev=/dev/vc/ - - # Force linux keycodes for PPC. - if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then - echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes - fi - - local wkeys= kmode="-a" msg="ASCII" - if yesno $unicode; then - kmode="-u" - msg="UTF-8" - fi - yesno $windowkeys && wkeys="windowkeys" - - # Set terminal encoding to either ASCII or UNICODE. - # See utf-8(7) for more information. - ebegin "Setting keyboard mode [$msg]" - n=1 - while [ $n -le $ttyn ]; do - kbd_mode $kmode -C $ttydev$n - : $(( n += 1 )) - done - eend 0 - - ebegin "Loading key mappings [$keymap]" - loadkeys -q $wkeys $keymap $extended_keymaps - eend $? "Error loading key mappings" || return $? - - if yesno $fix_euro; then - ebegin "Fixing font for euro symbol" - # Fix some fonts displaying the Euro, #173528. - echo "altgr keycode 18 = U+20AC" | loadkeys -q - - eend $? - fi - - # Save the keymapping for use immediately at boot - if checkpath -W "$RC_LIBEXECDIR"; then - mkdir -p "$RC_LIBEXECDIR"/console - dumpkeys >"$RC_LIBEXECDIR"/console/keymap - fi -} diff --git a/init.d/killprocs.in b/init.d/killprocs.in deleted file mode 100644 index 5cd4fc47..00000000 --- a/init.d/killprocs.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Kill all processes so we can unmount disks cleanly." - -depend() -{ - keyword -prefix -} - -start() -{ - ebegin "Terminating remaining processes" - killall5 -15 ${killall5_opts} - sleep 1 - eend 0 - ebegin "Killing remaining processes" - killall5 -9 ${killall5_opts} - sleep 1 - eend 0 -} diff --git a/init.d/local.in b/init.d/local.in deleted file mode 100644 index 180735de..00000000 --- a/init.d/local.in +++ /dev/null @@ -1,84 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Executes user programs in @SYSCONFDIR@/local.d" - -depend() -{ - after * - keyword -timeout -} - -start() -{ - ebegin "Starting local" - - local file has_errors=0 retval - eindent - for file in @SYSCONFDIR@/local.d/*.start; do - if [ -x "${file}" ]; then - vebegin "Executing \"${file}\"" - "${file}" 2>&1 >/dev/null - retval=$? - if [ ${retval} -ne 0 ]; then - has_errors=1 - fi - veend ${retval} "Execution of \"${file}\" failed." - fi - done - eoutdent - - if command -v local_start >/dev/null 2>&1; then - ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed." - ewarn "Please move the code from the local_start function" - ewarn "to executable scripts with an .start extension" - ewarn "in \"@SYSCONFDIR@/local.d\"" - local_start - fi - - eend ${has_errors} - - # We have to end with a zero exit code, because a failed execution - # of an executable @SYSCONFDIR@/local.d/*.start file shouldn't result in - # marking the local service as failed. Otherwise we are unable to - # execute any executable @SYSCONFDIR@/local.d/*.stop file, because a failed - # marked service cannot be stopped (and the stop function would - # actually call the executable @SYSCONFDIR@/local.d/*.stop file(s)). - return 0 -} - -stop() -{ - ebegin "Stopping local" - - local file has_errors=0 retval - eindent - for file in @SYSCONFDIR@/local.d/*.stop; do - if [ -x "${file}" ]; then - vebegin "Executing \"${file}\"" - "${file}" 2>&1 >/dev/null - retval=$? - if [ ${retval} -ne 0 ]; then - has_errors=1 - fi - veend ${retval} "Execution of \"${file}\" failed." - fi - done - eoutdent - - if command -v local_stop >/dev/null 2>&1; then - ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed." - ewarn "Please move the code from the local_stop function" - ewarn "to executable scripts with an .stop extension" - ewarn "in \"@SYSCONFDIR@/local.d\"" - local_stop - fi - - eend ${has_errors} - - # An executable @SYSCONFDIR@/local.d/*.stop file which failed with a - # non-zero exit status is not a reason to mark this service - # as failed, therefore we have to end with a zero exit code. - return 0 -} diff --git a/init.d/localmount.in b/init.d/localmount.in deleted file mode 100644 index 1335aa94..00000000 --- a/init.d/localmount.in +++ /dev/null @@ -1,112 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Mounts disks and swap according to /etc/fstab." - -depend() -{ - need fsck - use lvm modules mtab - after lvm modules - keyword -jail -prefix -vserver -lxc -} - -start() -{ - # Mount local filesystems in /etc/fstab. - local types="noproc" x= no_netdev= - for x in $net_fs_list $extra_net_fs_list; do - types="${types},no${x}" - done - - if [ "$RC_UNAME" = Linux ]; then - no_netdev="-O no_netdev" - if mountinfo -q /usr; then - touch "$RC_SVCDIR"/usr_premounted - fi - fi - ebegin "Mounting local filesystems" - mount -at "$types" $no_netdev - eend $? "Some local filesystem failed to mount" - - # Always return 0 - some local mounts may not be critical for boot - return 0 -} - -stop() -{ - yesno $RC_GOINGDOWN || return 0 - # We never unmount / or /dev or $RC_SVCDIR - - # Bug 381783 - local rc_svcdir=$(printf '%s\n' "$RC_SVCDIR" | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g') - - local x= no_umounts_r="/|/dev|/dev/.*|${rc_svcdir}" - no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib(32|64)?|/libexec" - # RC_NO_UMOUNTS is an env var that can be set by plugins - local IFS="$IFS:" - for x in $no_umounts $RC_NO_UMOUNTS; do - no_umounts_r="$no_umounts_r|$x" - done - - if [ "$RC_UNAME" = Linux ]; then - no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*" - if [ -e "$rc_svcdir"/usr_premounted ]; then - no_umounts_r="$no_umounts_r|/usr" - fi - fi - no_umounts_r="^($no_umounts_r)$" - - # Flush all pending disk writes now - sync - - . "$RC_LIBEXECDIR"/sh/rc-mount.sh - - if [ "$RC_UNAME" = Linux ] && [ -d /sys/fs/aufs ] ; then - #if / is aufs we remount it noxino during shutdown - if mountinfo -q -f '^aufs$' / ; then - mount -o remount,noxino,rw / - sync - fi - - local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir aufs_si_id - for aufs_si_dir in /sys/fs/aufs/*; do - aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/} - aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')" - aufs_mount_point="$(mountinfo -o ${aufs_si_id})" - for x in $aufs_si_dir/br[0-9][0-9][0-9]; do - aufs_branch=$(sed 's/=.*//g' $x) - eindent - if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then - ewarn "Failed to remove branch $aufs_branch from aufs \ - $aufs_mount_point" - fi - eoutdent - sync - done - done - fi - - # Umount loop devices - einfo "Unmounting loop devices" - eindent - do_unmount "umount -d" --skip-point-regex "$no_umounts_r" \ - --node-regex "^/dev/loop" - eoutdent - - # Now everything else, except network filesystems as the - # network should be down by this point. - einfo "Unmounting filesystems" - eindent - local fs= - for x in $net_fs_list $extra_net_fs_list; do - fs="$fs${fs:+|}$x" - done - [ -n "$fs" ] && fs="^($fs)$" - do_unmount umount --skip-point-regex "$no_umounts_r" \ - "${fs:+--skip-fstype-regex}" $fs --nonetdev - eoutdent - - return 0 -} diff --git a/init.d/loopback.in b/init.d/loopback.in deleted file mode 100644 index ec45a98c..00000000 --- a/init.d/loopback.in +++ /dev/null @@ -1,35 +0,0 @@ -#!@SBINDIR@/openrc-run -# 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 command -v 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 -} diff --git a/init.d/mixer.in b/init.d/mixer.in deleted file mode 100644 index 8bf152b1..00000000 --- a/init.d/mixer.in +++ /dev/null @@ -1,47 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -extra_commands="restore" - -depend() -{ - need localmount - keyword -jail -prefix -} - -restore() -{ - local mixer= retval=0 - ebegin "Restoring mixer settings" - eindent - for mixer in /dev/mixer*; do - if [ -r "/var/db/${mixer#/dev/}-state" ]; then - vebegin "$mixer" - mixer -f "$mixer" \ - $(cat "/var/db/${mixer#/dev/}-state") >/dev/null - veend $? - : $(( retval += $? )) - fi - done -} - -start() -{ - restore -} - -stop() -{ - local mixer= retval=0 - ebegin "Saving mixer settings" - eindent - for mixer in /dev/mixer*; do - vebegin "$mixer" - mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state - veend $? - : $(( retval += $? )) - done - eoutdent - eend $retval -} diff --git a/init.d/modules.in b/init.d/modules.in deleted file mode 100644 index acce97e3..00000000 --- a/init.d/modules.in +++ /dev/null @@ -1,63 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Loads a user defined list of kernel modules." - -depend() -{ - use isapnp - keyword -openvz -prefix -vserver -lxc -} - -start() -{ - # Should not fail if kernel do not have module - # support compiled in ... - [ ! -f /proc/modules ] && return 0 - - local KV x y kv_variant_list - KV=$(uname -r) - # full $KV - kv_variant_list="${KV}" - # remove any KV_EXTRA options to just get the full version - x=${KV%%-*} - # now slowly strip them - while [ -n "$x" ] && [ "$x" != "$y" ]; do - kv_variant_list="${kv_variant_list} $x" - y=$x - x=${x%.*} - done - - local list= x= xx= y= args= mpargs= cnt=0 a= - for x in $kv_variant_list ; do - eval list=\$modules_$(shell_var "$x") - [ -n "$list" ] && break - done - [ -z "$list" ] && list=$modules - - for x in $list; do - a=${x#*:} - if [ "$a" = "$x" ]; then - unset mpargs - ebegin "Loading module $x" - else - x=${x%%:*} - mpargs="-o $a" - ebegin "Loading module $x as $a" - fi - aa=$(shell_var "$a") - xx=$(shell_var "$x") - for y in $kv_variant_list ; do - eval args=\$module_${aa}_args_$(shell_var "$y") - [ -n "${args}" ] && break - eval args=\$module_${xx}_args_$(shell_var "$y") - [ -n "${args}" ] && break - done - [ -z "$args" ] && eval args=\$module_${aa}_args - [ -z "$args" ] && eval args=\$module_${xx}_args - eval modprobe -q "$mpargs" "$x" "$args" - eend $? "Failed to load $x" && : $(( cnt += 1 )) - done - einfo "Autoloaded $cnt module(s)" -} diff --git a/init.d/mount-ro.in b/init.d/mount-ro.in deleted file mode 100644 index a6438b58..00000000 --- a/init.d/mount-ro.in +++ /dev/null @@ -1,49 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Re-mount filesytems read-only for a clean reboot." - -depend() -{ - need killprocs savecache - keyword -openvz -prefix -vserver -lxc -} - -start() -{ - local ret=0 - - # Flush all pending disk writes now - sync - - ebegin "Remounting remaining filesystems read-only" - # We need the do_unmount function - . "$RC_LIBEXECDIR"/sh/rc-mount.sh - eindent - - # Bug 381783 - local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g') - - local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|/run|${rc_svcdir}" x= fs= - m="$m|/bin|/sbin|/lib(32|64)?|/libexec" - # RC_NO_UMOUNTS is an env var that can be set by plugins - local IFS="$IFS:" - for x in $no_umounts $RC_NO_UMOUNTS; do - m="$m|$x" - done - m="^($m)$" - fs= - for x in $net_fs_list $extra_net_fs_list; do - fs="$fs${fs:+|}$x" - done - [ -n "$fs" ] && fs="^($fs)$" - do_unmount "umount -r" \ - --skip-point-regex "$m" \ - "${fs:+--skip-fstype-regex}" $fs --nonetdev - ret=$? - - eoutdent - - eend $ret -} diff --git a/init.d/moused.in b/init.d/moused.in deleted file mode 100644 index 2b63a346..00000000 --- a/init.d/moused.in +++ /dev/null @@ -1,62 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -mouse=${RC_SVCNAME##*.} -if [ -n "$mouse" -a "$mouse" != "moused" ]; then - moused_device=/dev/"$mouse" - pidfile=/var/run/moused-"$mouse".pid -else - pidfile=/var/run/moused.pid -fi -name="Console Mouse Daemon" -[ -n "$moused_device" ] && name="$name ($moused_device)" - -depend() -{ - need localmount - after bootmisc - keyword -jail -prefix -} - -start() -{ - ebegin "Starting $name" - - if [ -z "$moused_device" ]; then - local dev= - for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do - [ -c "$dev" ] || continue - [ -e /var/run/moused-"${dev##*/}".pid ] && continue - moused_device=$dev - eindent - einfo "Using mouse on $moused_device" - eoutdent - break - done - fi - - if [ -z "$moused_device" ]; then - eend 1 "No mouse device found" - return 1 - fi - - local args= - eval args=\$moused_args_${moused_device##*/} - [ -z "$args" ] && args=$moused_args - - start-stop-daemon --start --exec /usr/sbin/moused \ - --pidfile "$pidfile" \ - -- $args -p "$moused_device" -I "$pidfile" - local retval=$? - - if [ $retval = 0 ]; then - local ttyv= - for ttyv in /dev/ttyv*; do - vidcontrol < "$ttyv" -m on - : $(( retval += $? )) - done - fi - - eend $retval "Failed to start moused" -} diff --git a/init.d/mtab.in b/init.d/mtab.in deleted file mode 100644 index e38d33e7..00000000 --- a/init.d/mtab.in +++ /dev/null @@ -1,39 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Update /etc/mtab to match what the kernel knows about" - -depend() -{ - need root - keyword -prefix -} - -start() -{ - if [ -L /etc/mtab ]; then - return 0 - fi - - ebegin "Updating /etc/mtab" - vewarn "The support for updating /etc/mtab as a file is" - vewarn "deprecated and will be removed in the future." - vewarn "Please run the following command as root on your system." - vewarn - vewarn "ln -snf /proc/self/mounts /etc/mtab" - if ! echo 2>/dev/null >/etc/mtab; then - ewend 1 "/etc/mtab is not updateable" - return 0 - fi - - # With / as tmpfs we cannot umount -at tmpfs in localmount as that - # makes / readonly and dismounts all tmpfs even if in use which is - # not good. Luckily, umount uses /etc/mtab instead of /proc/mounts - # which allows this hack to work. - grep -v "^[! ]* / tmpfs " /proc/mounts > /etc/mtab - - # Remove stale backups - rm -f /etc/mtab~ /etc/mtab~~ - eend 0 -} diff --git a/init.d/netmount.in b/init.d/netmount.in deleted file mode 100644 index 4ea0c4cc..00000000 --- a/init.d/netmount.in +++ /dev/null @@ -1,62 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Mounts network shares according to /etc/fstab." - -depend() -{ - config /etc/fstab - use afc-client amd autofs openvpn - use dns - keyword -jail -prefix -vserver -lxc -} - -start() -{ - local x= fs= rc= - for x in $net_fs_list $extra_net_fs_list; do - fs="$fs${fs:+,}$x" - done - - ebegin "Mounting network filesystems" - mount -at $fs - rc=$? - if [ "$RC_UNAME" = Linux ]; then - mount -a -O _netdev - rc=$? - fi - ewend $rc "Could not mount all network filesystems" - return 0 -} - -stop() -{ - local x= fs= - - ebegin "Unmounting network filesystems" - . "$RC_LIBEXECDIR"/sh/rc-mount.sh - - for x in $net_fs_list $extra_net_fs_list; do - fs="$fs${fs:+,}$x" - done - if [ -n "$fs" ]; then - umount -at $fs || eerror "Failed to simply unmount filesystems" - fi - - eindent - fs= - for x in $net_fs_list $extra_net_fs_list; do - fs="$fs${fs:+|}$x" - done - [ -n "$fs" ] && fs="^($fs)$" - do_unmount umount ${fs:+--fstype-regex} $fs --netdev - retval=$? - - eoutdent - if [ "$RC_UNAME" = Linux ]; then - umount -a -O _netdev - retval=$? - fi - eend $retval "Failed to unmount network filesystems" -} diff --git a/init.d/network.in b/init.d/network.in deleted file mode 100644 index 2e9b8974..00000000 --- a/init.d/network.in +++ /dev/null @@ -1,353 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -# This script was inspired by the equivalent rc.d network from NetBSD. - -description="Configures network interfaces." -__nl=" -" - -depend() -{ - need localmount - after bootmisc - if [ -n "$(interfaces)" ]; then - provide net - fi - keyword -jail -prefix -vserver -} - -uniqify() -{ - local result= i= - for i; do - case " $result " in - *" $i "*);; - *) result="$result $i";; - esac - done - echo "${result# *}" -} - -reverse() -{ - local result= i= - for i; do - result="$i $result" - done - echo "${result# *}" -} - -sys_interfaces() -{ - case "$RC_UNAME" in - Linux) - local w= rest= i= cmd=$1 - while read w rest; do - i=${w%%:*} - case "$i" in - "$w") continue ;; - lo|lo0) continue ;; - *) ;; - esac - if [ "$cmd" = u ]; then - ifconfig "$i" | grep -q "[ ]*UP" || continue - fi - printf "%s " "$i" - done </proc/net/dev - ;; - *) - ifconfig -l$1 - ;; - esac -} - -tentative() -{ - local inet= address= rest= - - case "$RC_UNAME" in - Linux) - [ -x /sbin/ip ] || [ -x /bin/ip ] || return 1 - [ -n "$(ip -f inet6 addr show tentative)" ] - ;; - *) - local inet= address= rest= - LC_ALL=C ifconfig -a | while read inet address rest; do - case "${inet}" in - inet6) - case "${rest}" in - *" "tentative*) return 2;; - esac - ;; - esac - done - [ $? = 2 ] - ;; - esac -} - - -auto_interfaces() -{ - local ifs= c= f= - - case "$RC_UNAME" in - NetBSD) - for c in $(ifconfig -C 2>/dev/null); do - for f in /etc/ifconfig.${c}[0-9]*; do - [ -f "$f" ] && printf "%s" "$f{##*.} " - done - done - ;; - *) - for f in /etc/ifconfig.*; do - [ -f "$f" ] && printf "%s" "${f##*.} " - done - for f in /etc/ip.*; do - [ -f "$f" ] && printf "%s" "${f##*.} " - done - ;; - esac - echo -} - -interfaces() -{ - uniqify $(sys_interfaces "$@") $interfaces $(auto_interfaces) -} - -dumpargs() -{ - local f="$1" - - shift - case "$@" in - '') [ -f "$f" ] && cat "$f";; - *"$__nl"*) echo "$@";; - *) - ( - set -o noglob - IFS=';'; set -- $@ - IFS="$__nl"; echo "$*" - );; - esac -} - -intup=false -runip() -{ - local int="$1" err= - shift - - # Ensure we have a valid broadcast address - case "$@" in - *" broadcast "*|*" brd "*) ;; - *:*) ;; # Ignore IPv6 - *) set -- "$@" brd +;; - esac - - err=$(LC_ALL=C ip address add "$@" dev "$int" 2>&1) - if [ -z "$err" ]; then - # ip does not bring up the interface when adding addresses - if ! $intup; then - ip link set "$int" up - intup=true - fi - return 0 - fi - if [ "$err" = "RTNETLINK answers: File exists" ]; then - ip address del "$@" dev "$int" 2>/dev/null - fi - # Localise the error - ip address add "$@" dev "$int" -} - -routeflush() -{ - if [ "$RC_UNAME" = Linux ]; then - if [ -x /sbin/ip ] || [ -x /bin/ip ]; then - ip route flush scope global - ip route delete default 2>/dev/null - else - # Sadly we also delete some link routes, but - # this cannot be helped - local dest= gate= net= flags= rest= - route -n | while read dest gate net flags rest; do - [ -z "$net" ] && continue - case "$dest" in - [0-9]*) ;; - *) continue;; - esac - local xtra= netmask="netmask $net" - case "$flags" in - U) continue;; - *H*) flags=-host; netmask=;; - *!*) flags=-net; xtra=reject;; - *) flags=-net;; - esac - route del $flags $dest $netmask $xtra - done - # Erase any default dev eth0 routes - route del default 2>/dev/null - fi - else - route -qn flush - fi -} - -runargs() -{ - dumpargs "$@" | while read -r args; do - case "$args" in - ''|"#"*) ;; - *) - ( - eval vebegin "${args#*!}" - eval "${args#*!}" - veend $? - );; - esac - done -} - -start() -{ - local cr=0 r= int= intv= cmd= args= upcmd= - - if [ -z "$domainname" -a -s /etc/defaultdomain ]; then - domainname=$(cat /etc/defaultdomain) - fi - if [ -n "$domainname" ]; then - ebegin "Setting NIS domainname: $domainname" - domainname "$domainname" - eend $? - fi - - einfo "Starting network" - routeflush - eindent - for int in $(interfaces); do - local func= cf= - intv=$(shell_var "$int") - eval upcmd=\$ifup_$intv - for func in ip ifconfig; do - eval cmd=\$${func}_$intv - if [ -n "$cmd" -o -f /etc/"$func.$int" ]; then - cf=/etc/"$func.$int" - break - fi - done - [ -n "$cf" -o -n "$upcmd" -o \ - -f /etc/ifup."$int" -o -f "$cf" ] || continue - veinfo "$int" - case "$func" in - ip) func=runip; intup=false;; - esac - eindent - runargs /etc/ifup."$int" "$upcmd" - r=0 - dumpargs "$cf" "$cmd" | while read -r args; do - case "$args" in - ''|"#"*) ;; - "!"*) - ( - eval vebegin "${args#*!}" - eval "${args#*!}" - veend $? - );; - *) - ( - set -o noglob - eval set -- "$args" - vebegin "$@" - $func "$int" "$@" - veend $? - );; - esac - done - eoutdent - done - eoutdent - eend $cr - - # Wait for any inet6 tentative addresses - r=5 - while [ $r -gt 0 ]; do - tentative || break - [ $r = 5 ] && vebegin "Waiting for tentative addresses" - sleep 1 - : $(( r -= 1 )) - done - if [ $r != 5 ]; then - [ $r != 0 ] - veend $? - fi - - if [ -n "$defaultroute" ]; then - ebegin "Setting default route $defaultroute" - route add default $defaultroute - eend $? - elif [ -n "$defaultiproute" ]; then - ebegin "Setting default route $defaultiproute" - ip route add default $defaultiproute - eend $? - fi - - if [ -n "$defaultroute6" ]; then - ebegin "Setting default route $defaultroute6" - if [ "$RC_UNAME" = Linux ]; then - routecmd="route -A inet6 add" - else - routecmd="route -inet6 add" - fi - $routecmd default $defaultroute6 - eend $? - elif [ -n "$defaultiproute6" ]; then - ebegin "Setting default route $defaultiproute6" - ip -f inet6 route add default $defaultiproute6 - eend $? - fi - - return 0 -} - -stop() -{ - # Don't stop the network at shutdown. - # We don't use the noshutdown keyword so that we are started again - # correctly if we go back to multiuser. - yesno ${keep_network:-YES} && yesno $RC_GOINGDOWN && return 0 - - local int= intv= cmd= downcmd= r= - einfo "Stopping network" - routeflush - eindent - for int in $(reverse $(interfaces u)); do - case "$int" in - lo|lo0) continue ;; - *) ;; - esac - intv=$(shell_var "$int") - eval downcmd=\$ifdown_$intv - eval cmd=\$ip_$intv - [ -z "$cmd" ] && eval cmd=\$ifconfig_$intv - if [ -n "$cmd" -o -f /etc/ip."$int" -o \ - -f /etc/ifconfig."$int" -o \ - -n "$downcmd" -o -f /etc/ifdown."$int" ]; - then - veinfo "$int" - runargs /etc/ifdown."$int" "$downcmd" - if [ -x /sbin/ip ] || [ -x /bin/ip ]; then - # We need to do this, otherwise we may - # fail to add things correctly on restart - ip address flush dev "$int" 2>/dev/null - fi - ifconfig "$int" down 2>/dev/null - ifconfig "$int" destroy 2>/dev/null - fi - done - eoutdent - eend 0 -} diff --git a/init.d/newsyslog.in b/init.d/newsyslog.in deleted file mode 100644 index 894b0c07..00000000 --- a/init.d/newsyslog.in +++ /dev/null @@ -1,18 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -required_files="/etc/newsyslog.conf" - -depend() -{ - need localmount - keyword -prefix -} - -start() -{ - ebegin "Creating and/or trimming log files" - newsyslog -s $newsyslog_args - eend $? -} diff --git a/init.d/nscd.in b/init.d/nscd.in deleted file mode 100644 index 670f2066..00000000 --- a/init.d/nscd.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -command=/usr/sbin/nscd -command_args=$nscd_args -pidfile=/var/run/nscd.pid -name="Name Service Cache Daemon" - -extra_started_commands="flush" - -depend() { - need localmount - use net dns ldap ypbind - after bootmisc -} - -flush() { - ebegin "Flushing $name" - nscd -I all >/dev/null - eend $? -} diff --git a/init.d/numlock.in b/init.d/numlock.in deleted file mode 100644 index 1b6d0a59..00000000 --- a/init.d/numlock.in +++ /dev/null @@ -1,42 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Turns numlock on for the consoles." - -ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} - -depend() -{ - need localmount - keyword -openvz -prefix -vserver -lxc -} - -_setleds() -{ - [ -z "$1" ] && return 1 - - local dev=/dev/tty t= i=1 retval=0 - [ -d /dev/vc ] && dev=/dev/vc/ - - while [ $i -le $ttyn ]; do - setleds -D "$1"num < $dev$i || retval=1 - : $(( i += 1 )) - done - - return $retval -} - -start() -{ - ebegin "Enabling numlock on ttys" - _setleds + - eend $? "Failed to enable numlock" -} - -stop() -{ - ebegin "Disabling numlock on ttys" - _setleds - - eend $? "Failed to disable numlock" -} diff --git a/init.d/osclock.in b/init.d/osclock.in deleted file mode 100644 index ce892d20..00000000 --- a/init.d/osclock.in +++ /dev/null @@ -1,12 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2014 Ralph Sennhauser <sera@igentoo.org> -# Released under the 2-clause BSD license. - -# Can be used on OSs that take care of the clock. - -description="Provides clock" - -depend() -{ - provide clock -} diff --git a/init.d/pf.in b/init.d/pf.in deleted file mode 100644 index f4344a93..00000000 --- a/init.d/pf.in +++ /dev/null @@ -1,59 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -name="Packet Filter" -: ${pf_conf:=${pf_rules:-/etc/pf.conf}} -required_files=$pf_conf - -extra_commands="checkconfig showstatus" -extra_started_commands="reload" - -depend() { - need localmount - keyword -jail -prefix -} - -start() -{ - ebegin "Starting $name" - if command -v kldload >/dev/null 2>&1; then - kldload pf 2>/dev/null - fi - pfctl -q -F all - pfctl -q -f "$pf_conf" $pf_args - pfctl -q -e - eend $? -} - -stop() -{ - ebegin "Stopping $name" - pfctl -q -d - eend $? -} - -checkconfig() -{ - ebegin "Checking $name configuration" - pfctl -n -f "$pf_conf" - eend $? -} - -reload() -{ - ebegin "Reloading $name rules." - pfctl -q -n -f "$pf_conf" && \ - { - # Flush everything but existing state entries that way when - # rules are read in, it doesn't break established connections. - pfctl -q -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp - pfctl -q -f "$pf_conf" $pf_args - } - eend $? -} - -showstatus() -{ - pfctl -s info -} diff --git a/init.d/powerd.in b/init.d/powerd.in deleted file mode 100644 index 36d60a7e..00000000 --- a/init.d/powerd.in +++ /dev/null @@ -1,35 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -command=/usr/sbin/powerd -command_args=$powerd_args -pidfile=/var/run/powerd.pid -name="Power Control Daemon" - -depend() -{ - need localmount - use logger - after bootmisc - keyword -jail -prefix -} - -start_pre() -{ - if [ -n "$powerd_battery_mode" ]; then - command_args="$command_args -b $powerd_battery_mode" - fi - if [ -n "${powerd_ac_mode}" ]; then - command_args="$command_args -a $powerd_ac_mode" - fi -} - -stop_post() -{ - local level=$(sysctl -n dev.cpu.0.freq_levels | - sed -e 's:/.*::') - if [ -n "$level" ]; then - sysctl dev.cpu.0.freq="$level" >/dev/null - fi -} diff --git a/init.d/procfs.in b/init.d/procfs.in deleted file mode 100644 index 636cd20b..00000000 --- a/init.d/procfs.in +++ /dev/null @@ -1,73 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Mounts misc filesystems in /proc." - -depend() -{ - use modules devfs - need localmount - keyword -openvz -prefix -vserver -lxc -} - -start() -{ - # Make sure we insert usbcore if it's a module - if [ -f /proc/modules -a ! -d /sys/module/usbcore -a ! -d /proc/bus/usb ]; then - modprobe -q usbcore - fi - - [ -e /proc/filesystems ] || return 0 - - # Setup Kernel Support for miscellaneous Binary Formats - if [ -d /proc/sys/fs/binfmt_misc -a ! -e /proc/sys/fs/binfmt_misc/register ]; then - if grep -qs binfmt_misc /proc/filesystems; then - ebegin "Mounting misc binary format filesystem" - mount -t binfmt_misc -o nodev,noexec,nosuid \ - binfmt_misc /proc/sys/fs/binfmt_misc - if eend $? ; then - local fmts - ebegin "Loading custom binary format handlers" - fmts=$(grep -hsv -e '^[#;]' -e '^[[:space:]]*$' \ - /run/binfmt.d/*.conf \ - /etc/binfmt.d/*.conf \ - ""/usr/lib/binfmt.d/*.conf) - if [ -n "${fmts}" ]; then - echo "${fmts}" > /proc/sys/fs/binfmt_misc/register - fi - eend $? - fi - fi - fi - - [ "$RC_SYS" = "OPENVZ" ] && return 0 - - # Check what USB fs the kernel support. Currently - # 2.5+ kernels, and later 2.4 kernels have 'usbfs', - # while older kernels have 'usbdevfs'. - if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then - local usbfs=$(grep -Fow usbfs /proc/filesystems || - grep -Fow usbdevfs /proc/filesystems) - if [ -n "$usbfs" ]; then - ebegin "Mounting USB device filesystem [$usbfs]" - local usbgid="$(getent group usb | \ - sed -e 's/.*:.*:\(.*\):.*/\1/')" - mount -t $usbfs \ - -o ${usbgid:+devmode=0664,devgid=$usbgid,}noexec,nosuid \ - usbfs /proc/bus/usb - eend $? - fi - fi - - # Setup Kernel Support for SELinux - if [ -d /sys/fs/selinux ] && ! mountinfo -q /sys/fs/selinux; then - if grep -qs selinuxfs /proc/filesystems; then - ebegin "Mounting SELinux filesystem" - mount -t selinuxfs selinuxfs /sys/fs/selinux - eend $? - fi - fi - - return 0 -} diff --git a/init.d/rarpd.in b/init.d/rarpd.in deleted file mode 100644 index e11de6d2..00000000 --- a/init.d/rarpd.in +++ /dev/null @@ -1,23 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -command=/usr/sbin/rarpd -command_args="-f $rarpd_args" -pidfile=/var/run/rarpd.pid -name="Reverse ARP Daemon" -required_files=/etc/ethers - -if [ -z "$rarpd_interface" ]; then - command_args="$command_args -a" -else - command_args="$command_args $rarpd_interface" -fi -command_background=YES - -depend() -{ - need localmount - after bootmisc - need net -} diff --git a/init.d/rc-enabled.in b/init.d/rc-enabled.in deleted file mode 100644 index 50587bce..00000000 --- a/init.d/rc-enabled.in +++ /dev/null @@ -1,53 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - need localmount net - after * - before local - keyword -prefix -} - -start() -{ - ebegin "Starting local rc services" - local svc= enabled= retval=0 service= pkgdir= - [ -n "@PKG_PREFIX@" ] && pkgdir="@PKG_PREFIX@/etc/rc.d/*" - for svc in $(rcorder /etc/rc.d/* $pkgdir 2>/dev/null); do - [ -x "$svc" ] || continue - service=${svc##*/} - - # Skip these services - for s in cleartmp moused; do - [ "$s" = "$service" ] && continue 2 - done - - # If we have an init script for this service, continue - rc-service --exists "$service" && continue - - # Ensure that the users rc.conf will start us - eval enabled=\$${svc##*/}_enable - yesno $enabled || yesno ${svc##*/} || continue - - # Good to go! - "$svc" start && started="$started $svc" - : $(( retval += $? )) - done - service_set_value started "$started" - eend $retval "Some local rc services failed to start" - return 0 -} - -stop() -{ - ebegin "Stopping local rc services" - local svc= retval=0 - for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do - "$svc" stop - : $(( retval += $? )) - done - eend $retval "Some local rc services failed to stop" - return 0 -} diff --git a/init.d/root.in b/init.d/root.in deleted file mode 100644 index 1668368c..00000000 --- a/init.d/root.in +++ /dev/null @@ -1,53 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Mount the root fs read/write" - -depend() -{ - need fsck - keyword -jail -openvz -prefix -vserver -lxc -} - -start() -{ - case ",$(fstabinfo -o /)," in - *,ro,*) - ;; - *) - # Check if the rootfs isn't already writable. - if checkpath -W /; then - rm -f /fastboot /forcefsck - else - ebegin "Remounting root filesystem read/write" - case "$RC_UNAME" in - Linux) - mount -n -o remount,rw / - ;; - *) - mount -u -o rw / - ;; - esac - eend $? "Root filesystem could not be mounted read/write" - if [ $? -eq 0 ]; then - rm -f /fastboot /forcefsck - fi - fi - ;; - esac - - ebegin "Remounting filesystems" - local mountpoint - for mountpoint in $(fstabinfo); do - case "${mountpoint}" in - /) - ;; - /*) - mountinfo -q "${mountpoint}" && \ - fstabinfo --remount "${mountpoint}" - ;; - esac - done - eend 0 -} diff --git a/init.d/rpcbind.in b/init.d/rpcbind.in deleted file mode 100644 index c10deeb1..00000000 --- a/init.d/rpcbind.in +++ /dev/null @@ -1,21 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -command=/usr/sbin/rpcbind -command_args=$rpcbind_args -name="RPC program number mapper" - -depend() -{ - provide rpc - need localmount - use net logger dns - before inetd xinetd ntpd ntp-client -} - -stop_post() -{ - # rpcbind returns too fast, so sleep for a second - sleep 1 -} diff --git a/init.d/savecache.in b/init.d/savecache.in deleted file mode 100644 index dde02ddf..00000000 --- a/init.d/savecache.in +++ /dev/null @@ -1,49 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Saves the caches OpenRC uses to non volatile storage" - -start() -{ - if [ -e "$RC_SVCDIR"/clock-skewed ]; then - ewarn "WARNING: clock skew detected!" - if ! yesno "${RC_GOINGDOWN}"; then - eerror "Not saving deptree cache" - return 1 - fi - fi - if ! checkpath -W "$RC_LIBEXECDIR"/cache; then - ewarn "WARNING: ${RC_LIBEXECDIR}/cache is not writable!" - if ! yesno "${RC_GOINGDOWN}"; then - ewarn "Unable to save deptree cache" - return 1 - fi - return 0 - fi - ebegin "Saving dependency cache" - local rc= - if [ ! -d "$RC_LIBEXECDIR"/cache ]; then - rm -rf "$RC_LIBEXECDIR"/cache - if ! mkdir "$RC_LIBEXECDIR"/cache; then - rc=$? - if yesno "${RC_GOINGDOWN}"; then - rc=0 - fi - eend $rc - return $rc - fi - fi - local save= - for x in deptree depconfig shutdowntime softlevel nettree rc.log; do - [ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x" - done - if [ -n "$save" ]; then - cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null - fi - rc=$? - if yesno "${RC_GOINGDOWN}"; then - rc=0 - fi - eend $rc -} diff --git a/init.d/savecore.in b/init.d/savecore.in deleted file mode 100644 index b1b6ca37..00000000 --- a/init.d/savecore.in +++ /dev/null @@ -1,37 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Saves a kernel dump." - -depend() -{ - need dumpon localmount - before encswap - keyword -jail -prefix -} - -start() -{ - : ${dump_dir:=/var/crash} - if ! [ -d "$dump_dir" ]; then - mkdir -p "$dump_dir" - chmod 700 "$dump_dir" - fi - - if [ "$RC_UNAME" = FreeBSD ]; then - # Don't quote ${dump_device}, so that if it's unset, - # savecore will check on the partitions listed in fstab - # without errors in the output - savecore -C "$dump_dir" $dump_device >/dev/null - else - ls "$dump_dir"/bsd* > /dev/null 2>&1 - fi - [ $? = 0 ] || return 0 - - local sopts="$dump_dir $dump_device" - yesno $dump_compress && sopts="-z $sopts" - ebegin "Saving kernel core dump in $dump_dir" - savecore $sopts >/dev/null - eend $? -} diff --git a/init.d/staticroute.in b/init.d/staticroute.in deleted file mode 100644 index 34214e0f..00000000 --- a/init.d/staticroute.in +++ /dev/null @@ -1,104 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -# This script was inspired by the equivalent rc.d staticroute from NetBSD. - -description="Configures static routes." -__nl=" -" - -depend() -{ - provide net - use network - keyword -jail -prefix -vserver -} - -pre_flight_checks() -{ - route=route - [ -s /etc/route.conf ] && return 0 - - if [ -n "$staticiproute" ]; then - route="ip route" - staticroute="$staticiproute" - fi -} - -dump_args() -{ - # Route configuration file, as used by the NetBSD RC system - if [ -s /etc/route.conf ]; then - cat /etc/route.conf - return $? - fi - - case "$staticroute" in - *"$__nl"*) - echo "$staticroute" - ;; - *) - ( - set -o noglob - IFS=';'; set -- $staticroute - IFS="$__nl"; echo "$*" - ) - ;; - esac -} - -do_routes() -{ - local xtra= family= - [ "$RC_UNAME" != Linux ] && xtra=-q - - ebegin "$1 static routes" - eindent - pre_flight_checks - dump_args | while read args; do - [ -z "$args" ] && continue - case "$args" in - "#"*) - ;; - "+"*) - [ $2 = "add" ] && eval ${args#*+} - ;; - "-"*) - [ $2 = "del" -o $2 = "delete" ] && eval ${args#*-} - ;; - *) - veinfo "$args" - case "$route" in - "ip route") - ip route $2 $args - ;; - *) - # Linux route does cannot work it out ... - if [ "$RC_UNAME" = Linux ]; then - case "$args" in - *:*) family="-A inet6";; - *) family=;; - esac - fi - route $family $xtra $2 -$args - ;; - esac - veend $? - esac - done - eoutdent - eend 0 -} - -start() -{ - do_routes "Adding" "add" -} - -stop() -{ - local cmd="delete" - [ "$RC_UNAME" = Linux ] && cmd="del" - do_routes "Deleting" "$cmd" -} diff --git a/init.d/swap-blk.in b/init.d/swap-blk.in deleted file mode 100644 index 5a140834..00000000 --- a/init.d/swap-blk.in +++ /dev/null @@ -1,23 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - before fsck - keyword -jail -prefix -} - -start() -{ - ebegin "Activating block swap devices" - swapctl -A -t blk >/dev/null - eend 0 # If swapon has nothing todo it errors, so always return 0 -} - -stop() -{ - ebegin "Deactivating block swap devices" - swapctl -U -t blk >/dev/null - eend 0 -} diff --git a/init.d/swap.in b/init.d/swap.in deleted file mode 100644 index a64ea608..00000000 --- a/init.d/swap.in +++ /dev/null @@ -1,36 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - before localmount - keyword -jail -openvz -prefix -vserver -lxc -} - -start() -{ - ebegin "Activating swap devices" - case "$RC_UNAME" in - Linux) swapon -a -e >/dev/null;; - NetBSD|OpenBSD) swapctl -A -t noblk >/dev/null;; - *) swapon -a >/dev/null;; - esac - eend 0 # If swapon has nothing todo it errors, so always return 0 -} - -stop() -{ - ebegin "Deactivating swap devices" - - # Try to unmount all tmpfs filesystems not in use, else a deadlock may - # occur. As $RC_SVCDIR may also be tmpfs we cd to it to lock it - cd "$RC_SVCDIR" - umount -a -t tmpfs 2>/dev/null - - case "$RC_UNAME" in - NetBSD|OpenBSD) swapctl -U -t noblk >/dev/null;; - *) swapoff -a >/dev/null;; - esac - eend 0 -} diff --git a/init.d/swapfiles.in b/init.d/swapfiles.in deleted file mode 100644 index 1c805004..00000000 --- a/init.d/swapfiles.in +++ /dev/null @@ -1,39 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - need localmount - keyword -jail -openvz -prefix -vserver -lxc -} - -start() -{ - ebegin "Activating additional swap space" - case "$RC_UNAME" in - NetBSD|OpenBSD) swapctl -A -t noblk >/dev/null;; - *) swapon -a >/dev/null;; - esac - eend 0 # If swapon has nothing todo it errors, so always return 0 -} - -stop() -{ - ebegin "Deactivating additional swap space" - case "$RC_UNAME" in - Linux) - if [ -e /proc/swaps ]; then - while read filename type rest; do - case "$type" in - file) swapoff $filename >/dev/null;; - esac - case "$filename" in - /dev/loop*) swapoff $filename >/dev/null;; - esac - done < /proc/swaps - fi - ;; - esac - eend 0 -} diff --git a/init.d/swclock.in b/init.d/swclock.in deleted file mode 100644 index b74d49a1..00000000 --- a/init.d/swclock.in +++ /dev/null @@ -1,30 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Sets the local clock to the mtime of a given file." - -depend() -{ - before * - provide clock - keyword -openvz -prefix -uml -vserver -xenu -lxc -} - -# swclock is an OpenRC built in - -start() -{ - ebegin "Setting the local clock based on last shutdown time" - if ! swclock 2> /dev/null; then - swclock --warn @SBINDIR@/openrc-run - fi - eend $? -} - -stop() -{ - ebegin "Saving the shutdown time" - swclock --save - eend $? -} diff --git a/init.d/syscons.in b/init.d/syscons.in deleted file mode 100644 index ce0b5a13..00000000 --- a/init.d/syscons.in +++ /dev/null @@ -1,83 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() { - need localmount - keyword -jail -prefix -} - -start() { - if [ -n "$allscreen_flags" ]; then - ebegin "Setting mode to $allscreen_flags for all screens" - for v in /dev/ttyv*; do - vidcontrol $allscreen_flags <$v - done - eend $? - fi - - if [ -n "$keymap" ]; then - ebegin "Setting keymap to $keymap" - kbdcontrol -l $keymap </dev/console - eend $? - fi - - if [ -n "$keyrate" ]; then - ebegin "Setting keyrate to $keyrate" - kbdcontrol -r $keyrate </dev/console - eend $? - fi - - if [ -n "$keychange" ]; then - ebegin "Changing function keys" - eval set -- "$keychange" - eindent - while [ $# -gt 0 ]; do - veinfo "F$1 -> \`$2'" - kbdcontrol -f "$1" "$2" </dev/console - veend $? - shift; shift - done - eoutdent - fi - - if [ -n "$cursor" ]; then - ebegin "Setting cursor" - vidcontrol -c $cursor - eend $? - fi - - local v= f= - for v in font8x16 font8x14 font8x8; do - eval f=\$$v - if [ -n "$f" ]; then - ebegin "Setting font $f" - vidcontrol -f ${v##font} $f - eend $? - fi - done - - if [ -n "$blanktime" ]; then - ebegin "Setting blanktime" - vidcontrol -t $blanktime - eend $? - fi - - if [ -n "$saver" ]; then - local i= - for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do - kldunload "$i" - done - kldstat -v | grep -q _saver || kldload ${saver}_saver - fi - - if [ -n "$kbdflags" ]; then - ebegin "Setting keyboard flags for all screens" - for v in /dev/ttyv*; do - kbdcontrol $kbdflags <$v - done - eend $? - fi - - return 0 -} diff --git a/init.d/sysctl.BSD.in b/init.d/sysctl.BSD.in deleted file mode 100644 index 92d58680..00000000 --- a/init.d/sysctl.BSD.in +++ /dev/null @@ -1,31 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - before bootmisc logger - keyword -prefix -} - -start() -{ - [ -e /etc/sysctl.conf ] || return 0 - local retval=0 var= comments= conf= - ebegin "Configuring kernel parameters" - eindent - for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do - if [ -r "$conf" ]; then - vebegin "applying $conf" - while read var comments; do - case "$var" in - ""|"#"*) continue;; - esac - sysctl -w "$var" >/dev/null || retval=1 - done < "$conf" - veend $retval - fi - done - eoutdent - eend $retval "Some errors were encountered" -} diff --git a/init.d/sysctl.GNU-kFreeBSD.in b/init.d/sysctl.GNU-kFreeBSD.in deleted file mode 100644 index 92d58680..00000000 --- a/init.d/sysctl.GNU-kFreeBSD.in +++ /dev/null @@ -1,31 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - before bootmisc logger - keyword -prefix -} - -start() -{ - [ -e /etc/sysctl.conf ] || return 0 - local retval=0 var= comments= conf= - ebegin "Configuring kernel parameters" - eindent - for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do - if [ -r "$conf" ]; then - vebegin "applying $conf" - while read var comments; do - case "$var" in - ""|"#"*) continue;; - esac - sysctl -w "$var" >/dev/null || retval=1 - done < "$conf" - veend $retval - fi - done - eoutdent - eend $retval "Some errors were encountered" -} diff --git a/init.d/sysctl.GNU.in b/init.d/sysctl.GNU.in deleted file mode 100644 index 71398246..00000000 --- a/init.d/sysctl.GNU.in +++ /dev/null @@ -1,32 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. -#FIXME: Modify for GNU/Hurd - -depend() -{ - before bootmisc logger - keyword -prefix -} - -start() -{ - [ -e /etc/sysctl.conf ] || return 0 - local retval=0 var= comments= conf= - ebegin "Configuring kernel parameters" - eindent - for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do - if [ -r "$conf" ]; then - vebegin "applying $conf" - while read var comments; do - case "$var" in - ""|"#"*) continue;; - esac - sysctl -w "$var" >/dev/null || retval=1 - done < "$conf" - veend $retval - fi - done - eoutdent - eend $retval "Some errors were encountered" -} diff --git a/init.d/sysctl.Linux.in b/init.d/sysctl.Linux.in deleted file mode 100644 index a1a88977..00000000 --- a/init.d/sysctl.Linux.in +++ /dev/null @@ -1,16 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - before bootmisc logger - keyword -prefix -vserver -} - -start() -{ - ebegin "Configuring kernel parameters" - sysctl --system - eend $? "Unable to configure some kernel parameters" -} diff --git a/init.d/sysfs.in b/init.d/sysfs.in deleted file mode 100644 index bc0d9d3d..00000000 --- a/init.d/sysfs.in +++ /dev/null @@ -1,142 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Mount the sys filesystem." - -sysfs_opts=nodev,noexec,nosuid - -depend() -{ - keyword -lxc -prefix -vserver -} - -mount_sys() -{ - grep -Eq "[[:space:]]+sysfs$" /proc/filesystems || return 1 - mountinfo -q /sys && return 0 - - if [ ! -d /sys ]; then - if ! mkdir -m 0755 /sys; then - ewarn "Could not create /sys!" - return 1 - fi - fi - - ebegin "Mounting /sys" - if ! fstabinfo --mount /sys; then - mount -n -t sysfs -o ${sysfs_opts} sysfs /sys - fi - eend $? -} - -mount_misc() -{ - # Setup Kernel Support for securityfs - if [ -d /sys/kernel/security ] && \ - ! mountinfo -q /sys/kernel/security; then - if grep -qs securityfs /proc/filesystems; then - ebegin "Mounting security filesystem" - mount -n -t securityfs -o ${sysfs_opts} \ - securityfs /sys/kernel/security - eend $? - fi - fi - - # Setup Kernel Support for debugfs - if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then - if grep -qs debugfs /proc/filesystems; then - ebegin "Mounting debug filesystem" - mount -n -t debugfs -o ${sysfs_opts} debugfs /sys/kernel/debug - eend $? - fi - fi - - # Setup Kernel Support for configfs - if [ -d /sys/kernel/config ] && ! mountinfo -q /sys/kernel/config; then - if grep -qs configfs /proc/filesystems; then - ebegin "Mounting config filesystem" - mount -n -t configfs -o ${sysfs_opts} configfs /sys/kernel/config - eend $? - fi - fi - - # set up kernel support for cgroups - if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup; then - if grep -qs cgroup /proc/filesystems; then - ebegin "Mounting cgroup filesystem" - local opts="${sysfs_opts},mode=755,size=${rc_cgroupsize:-10m}" - mount -n -t tmpfs -o ${opts} cgroup_root /sys/fs/cgroup - eend $? - fi - fi - - # set up kernel support for fusectl - if [ -d /sys/fs/fuse/connections ] \ - && ! mountinfo -q /sys/fs/fuse/connections; then - if grep -qs fusectl /proc/filesystems; then - ebegin "Mounting fuse control filesystem" - mount -n -t fusectl -o ${sysfs_opts} \ - fusectl /sys/fs/fuse/connections - eend $? - fi - fi - - # setup up kernel support for efivarfs - # slightly complicated, as if it's build as a module but NOT yet loaded, - # it will NOT appear in /proc/filesystems yet - if [ -d /sys/firmware/efi/efivars ] \ - && ! mountinfo -q /sys/firmware/efi/efivars; then - modprobe -q efivarfs - if grep -qs efivarfs /proc/filesystems; then - ebegin "Mounting efivarfs filesystem" - mount -n -t efivarfs -o ${sysfs_opts} \ - efivarfs /sys/firmware/efi/efivars - eend $? - fi - fi -} - -mount_cgroups() -{ - mountinfo -q /sys/fs/cgroup || return 0 - - if ! mountinfo -q /sys/fs/cgroup/openrc; then - local agent="@LIBEXECDIR@/sh/cgroup-release-agent.sh" - mkdir /sys/fs/cgroup/openrc - mount -n -t cgroup \ - -o none,${sysfs_opts},name=openrc,release_agent="$agent" \ - openrc /sys/fs/cgroup/openrc - echo 1 > /sys/fs/cgroup/openrc/notify_on_release - fi - - yesno ${rc_controller_cgroups:-YES} && [ -e /proc/cgroups ] || return 0 - while read name hier groups enabled rest; do - case "${enabled}" in - 1) mountinfo -q /sys/fs/cgroup/${name} && continue - mkdir /sys/fs/cgroup/${name} - mount -n -t cgroup -o ${sysfs_opts},${name} \ - ${name} /sys/fs/cgroup/${name} - ;; - esac - done < /proc/cgroups -} - -restorecon_sys() -{ - if [ -x /sbin/restorecon ]; then - ebegin "Restoring SELinux contexts in /sys" - restorecon -F /sys/devices/system/cpu/online >/dev/null 2>&1 - restorecon -rF /sys/fs/cgroup >/dev/null 2>&1 - eend $? - fi -} - -start() -{ - mount_sys - mount_misc - mount_cgroups - restorecon_sys - return 0 -} diff --git a/init.d/syslogd.in b/init.d/syslogd.in deleted file mode 100644 index 953742bf..00000000 --- a/init.d/syslogd.in +++ /dev/null @@ -1,20 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -command=/usr/sbin/syslogd -command_args=$syslogd_args -case "$RC_UNAME" in - FreeBSD|DragonFly) pidfile=/var/run/syslog.pid;; - *) pidfile=/var/run/syslogd.pid;; -esac -name="System Logger Daemon" - -depend() -{ - provide logger - use net newsyslog - need localmount - after bootmisc - keyword -prefix -} diff --git a/init.d/termencoding.in b/init.d/termencoding.in deleted file mode 100644 index d3aa0278..00000000 --- a/init.d/termencoding.in +++ /dev/null @@ -1,48 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2008-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -description="Configures terminal encoding." - -ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} -: ${unicode:=${UNICODE}} - -depend() -{ - keyword -lxc -openvz -prefix -uml -vserver -xenu - use root - after bootmisc -} - -start() -{ - local ttydev=/dev/tty n= - [ -d /dev/vc ] && ttydev=/dev/vc/ - - # Set terminal encoding to either ASCII or UNICODE. - # See utf-8(7) for more information. - local termencoding="%@" termmsg="ASCII" - if yesno ${unicode}; then - termencoding="%G" - termmsg="UTF-8" - fi - - ebegin "Setting terminal encoding [$termmsg]" - n=1 - while [ ${n} -le "$ttyn" ]; do - printf "\033%s" "$termencoding" >$ttydev$n - : $(( n += 1 )) - done - - # Save the encoding for use immediately at boot - if checkpath -W "$RC_LIBEXECDIR"; then - mkdir -p "$RC_LIBEXECDIR"/console - if yesno ${unicode:-${UNICODE}}; then - echo "" > "$RC_LIBEXECDIR"/console/unicode - else - rm -f "$RC_LIBEXECDIR"/console/unicode - fi - fi - - eend 0 -} diff --git a/init.d/tmpfiles.dev.in b/init.d/tmpfiles.dev.in deleted file mode 100644 index 35669284..00000000 --- a/init.d/tmpfiles.dev.in +++ /dev/null @@ -1,20 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright 1999-2012 Gentoo Foundation -# Released under the 2-clause BSD license. - -description="set up tmpfiles.d entries" - -depend() -{ - use dev-mount - before dev - keyword -prefix -vserver -} - -start() -{ - ebegin "setting up tmpfiles.d entries for /dev" - @LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create ${tmpfiles_opts} - eend $? - return 0 -} diff --git a/init.d/tmpfiles.setup.in b/init.d/tmpfiles.setup.in deleted file mode 100644 index d5a6ecd9..00000000 --- a/init.d/tmpfiles.setup.in +++ /dev/null @@ -1,19 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright 1999-2012 Gentoo Foundation -# Released under the 2-clause BSD license. - -description="set up tmpfiles.d entries" - -depend() -{ - need localmount -} - -start() -{ - ebegin "setting up tmpfiles.d entries" - @LIBEXECDIR@/sh/tmpfiles.sh --exclude-prefix=/dev --create --remove --boot \ - ${tmpfiles_opts} - eend $? - return 0 -} diff --git a/init.d/ttys.in b/init.d/ttys.in deleted file mode 100644 index 8fdd1696..00000000 --- a/init.d/ttys.in +++ /dev/null @@ -1,23 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2008 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - after fsck - keyword -prefix -} - -start() -{ - ebegin "Setting tty flags" - ttyflags -a - eend $? || return $? - - if [ -c /dev/ttyp0 ]; then - chmod 666 /dev/tty[p-uw-zP-T][0-9a-zA-Z] - fi - if [ -c /dev/ttyv1 ]; then - chmod 666 /dev/ttyv[0-9a-zA-Z] - fi -} diff --git a/init.d/urandom.in b/init.d/urandom.in deleted file mode 100644 index ded41137..00000000 --- a/init.d/urandom.in +++ /dev/null @@ -1,45 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -: ${urandom_seed:=${URANDOM_SEED:-/var/lib/misc/random-seed}} -description="Initializes the random number generator." - -depend() -{ - need localmount - keyword -jail -lxc -openvz -prefix -} - -save_seed() -{ - local psz=1 - - if [ -e /proc/sys/kernel/random/poolsize ]; then - : $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 )) - fi - - ( # sub shell to prevent umask pollution - umask 077 - dd if=/dev/urandom of="$urandom_seed" count=${psz} 2>/dev/null - ) -} - -start() -{ - [ -c /dev/urandom ] || return - if [ -f "$urandom_seed" ]; then - ebegin "Initializing random number generator" - cat "$urandom_seed" > /dev/urandom - eend $? "Error initializing random number generator" - fi - rm -f "$urandom_seed" && save_seed - return 0 -} - -stop() -{ - ebegin "Saving random seed" - save_seed - eend $? "Failed to save random seed" -} diff --git a/init.d/wscons.in b/init.d/wscons.in deleted file mode 100644 index 84671224..00000000 --- a/init.d/wscons.in +++ /dev/null @@ -1,100 +0,0 @@ -#!@SBINDIR@/openrc-run -# Copyright (c) 2008-2009 Roy Marples <roy@marples.name> -# Released under the 2-clause BSD license. - -depend() -{ - need localmount - keyword -prefix -} - -start() -{ - wscfg=/usr/sbin/wsconscfg - wsfld=/usr/sbin/wsfontload - wsctl=/sbin/wsconsctl - config=/etc/wscons.conf - - # args mean: - # screen idx scr emul - # font name width height enc file - while read type arg1 arg2 arg3 arg4 arg5; do - case "$type" in - \#*|"") - continue - ;; - - font) - cmd=$wsfld - [ "$arg2" != "-" ] && cmd="$cmd -w $arg2" - [ "$arg3" != "-" ] && cmd="$cmd -h $arg3" - [ "$arg4" != "-" ] && cmd="$cmd -e $arg4" - cmd="$cmd -N $arg1 $arg5" - eval "$cmd" - ;; - - screen) - cmd=$wscfg - [ "$arg2" != "-" ] && cmd="$cmd -t $arg2" - [ "$arg3" != "-" ] && cmd="$cmd -e $arg3" - cmd="$cmd $arg1" - eval "$cmd" - ;; - - keyboard) - cmd=$wscfg - case "$arg1" in - -|auto) - cmd="$cmd -k" - ;; - *) - cmd="$cmd -k $arg1" - ;; - esac - $cmd - ;; - - encoding) - eval $wsctl -w "\"encoding=$arg1\"" - ;; - - mapfile) - local entry= - while read entry; do - case "$entry" in - \#*|"") - continue - ;; - *) - cmd="$wsctl -w \"map+=$entry\"" - eval "$cmd >/dev/null" - ;; - esac - done < "$arg1" - ;; - - mux) - eval "$wscfg -m $arg1" - ;; - - setvar) - case "$arg1" in - keyboard) - cmd="$wsctl -kw $arg2" - ;; - display) - cmd="$wsctl -dw $arg2" - ;; - mouse) - cmd="$wsctl -mw $arg2" - ;; - *) - cmd="$wsctl -w $arg1" - ;; - esac - eval "$cmd" - ;; - - esac - done < "$config" -} |
