[gentoo-commits] proj/openrc:master commit in: conf.d/, init.d/

2018-06-29 Thread William Hubbs
commit: a571a42421b337380b6f5751635c55906bb8b508
Author: William Hubbs  gmail  com>
AuthorDate: Fri Jun 29 20:29:46 2018 +
Commit: William Hubbs  gentoo  org>
CommitDate: Fri Jun 29 20:29:46 2018 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a571a424

modules: remove the ability to rename modules on the fly

Kmod doesn't support the -o switch, so if you have been using this your
module loads have been failing.

 conf.d/modules|  5 -
 init.d/modules.in | 15 ++-
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/conf.d/modules b/conf.d/modules
index c35b9edf..d13ff895 100644
--- a/conf.d/modules
+++ b/conf.d/modules
@@ -8,11 +8,6 @@
 #modules_2="ipv6"
 #modules="ohci1394"
 
-# Linux users can give modules a different name when they load - the new name
-# will also be used to pick arguments below.
-# This is not supported on FreeBSD.
-#modules="dummy:dummy1"
-
 # Linux users can give the modules some arguments if needed, per version
 # if necessary.
 # Again, the most specific versioned variable will take precedence.

diff --git a/init.d/modules.in b/init.d/modules.in
index d6dd7a29..08abae3d 100644
--- a/init.d/modules.in
+++ b/init.d/modules.in
@@ -103,7 +103,7 @@ Linux_modules()
x=${x%.*}
done
 
-   local list= x= xx= y= args= mpargs= a=
+   local list= x= xx= y= args=
for x in $kv_variant_list ; do
eval list=\$modules_$(shell_var "$x")
[ -n "$list" ] && break
@@ -112,24 +112,13 @@ Linux_modules()
 
[ -n "$list" ] && ebegin "Loading kernel modules"
for x in $list; do
-   a=${x#*:}
-   if [ "$a" = "$x" ]; then
-   unset mpargs
-   else
-   x=${x%%:*}
-   mpargs="-o $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 --use-blacklist --verbose "$mpargs" "$x" "$args"
+   eval modprobe --use-blacklist --verbose "$x" "$args"
done
[ -n "$list" ] && eend
 }



[gentoo-commits] proj/openrc:master commit in: conf.d/, init.d/, /

2017-11-14 Thread William Hubbs
commit: 318e87348168e37d78f433d3ff06288ad8ccf15c
Author: William Hubbs  gmail  com>
AuthorDate: Tue Nov 14 20:11:57 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Nov 14 21:41:03 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=318e8734

strongly encourage Linux users to not make  /etc/mtab a flat file

The OpenRC team does not currently know of any modern linux tools that
require /etc/mtab to be a flat file, so this puts users on notice that
the mtab service will be removed in the future.

 NEWS.md| 15 +++
 conf.d/mtab| 14 +++---
 init.d/mtab.in |  4 
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 1a98da2a..9982e9bd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,6 +3,21 @@
 This file will contain a list of notable changes for each release. Note
 the information in this file is in reverse order.
 
+## OpenRC 0.35
+
+Consider this your second notification with regard to /etc/mtab being a
+file instead of a symbolic link.
+
+In this version, the mtab service will complain loudly if you have
+mtab_is_file set to yes and recommend that you change this to no and
+restart the mtab service to migrate /etc/mtab to a symbolic link.
+
+If there is a valid technical reason to keep /etc/mtab as a flat file
+instead of a symbolic link to /proc/self/mounts, we are interested and
+we will keep the support in that case. Please open an issue and let us
+know however. Otherwise, consider this your final notice that the mtab
+service will be removed in the future.
+
 ## OpenRC 0.33
 
 This version removes the "service" binary which was just a copy of

diff --git a/conf.d/mtab b/conf.d/mtab
index 9e16d9b3..f58fad6c 100644
--- a/conf.d/mtab
+++ b/conf.d/mtab
@@ -1,5 +1,13 @@
+# As far as we are aware, there are no modern linux tools or use cases
+# which require /etc/mtab to be a separate file from /proc/self/mounts,
+# so this setting should be commented out.
+# If it is set to yes, please comment it out and run this command:
+# # rc-service mtab restart
+# In the future, the mtab service will be removed since we are not aware
+# of any need to manipulate /etc/mtab as a separate file from
+# /proc/self/mounts.
+# If you have a technical reason we should keep this support, please
+# open an issue at https://github.com/openrc/openrc/issues and let us
+# know about your situation.
 # This setting controls whether /etc/mtab is a file or symbolic link.
-# Most of the time, you shouldn't touch this. However, if the default
-# breaks your system in some way, please see the NEWS.md file that comes
-# with OpenRC for the actions to take.
 # mtab_is_file=no

diff --git a/init.d/mtab.in b/init.d/mtab.in
index 9e0c1a6e..bac8230f 100644
--- a/init.d/mtab.in
+++ b/init.d/mtab.in
@@ -31,6 +31,10 @@ start()
einfo "Creating mtab symbolic link"
ln -snf /proc/self/mounts /etc/mtab
else
+   ewarn "The ${RC_SVCNAME} service will be removed in the future."
+   ewarn "Please change the mtab_is_file setting to no and run"
+   ewarn "# rc-service mtab restart"
+   ewarn "to create the mtab symbolic link."
[ -L /etc/mtab ] && ewarn "Removing /etc/mtab symbolic link"
rm -f /etc/mtab
einfo "Creating mtab file"



[gentoo-commits] proj/openrc:master commit in: conf.d/, init.d/

2017-05-31 Thread William Hubbs
commit: 44bac3c3798f7eb9186c3ea8774552aa191bfae7
Author: William Hubbs  gmail  com>
AuthorDate: Tue May 30 23:48:33 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue May 30 23:48:33 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=44bac3c3

Change killprocs to use kill_all instead of killall5

X-Gentoo-Bug:376977
X-Gentoo-Bug-URL:https://bugs.gentoo.org/show_bug.cgi?id=376977

 conf.d/killprocs| 5 -
 init.d/killprocs.in | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/conf.d/killprocs b/conf.d/killprocs
index 0cf10d0d..76a2bc9c 100644
--- a/conf.d/killprocs
+++ b/conf.d/killprocs
@@ -1,3 +1,6 @@
-# If you wish to pass any options to killall5 during shutdown,
+# If you wish to pass any options to kill_all during shutdown,
 # you should do so here.
+#
+# The setting is called killall5_opts because the options here are meant
+# to be identical to those you could pass to killall5.
 killall5_opts=""

diff --git a/init.d/killprocs.in b/init.d/killprocs.in
index d1409c51..fcf1364d 100644
--- a/init.d/killprocs.in
+++ b/init.d/killprocs.in
@@ -19,9 +19,9 @@ depend()
 start()
 {
ebegin "Terminating remaining processes"
-   killall5 -15 ${killall5_opts}
+   kill_all 15 ${killall5_opts}
eend 0
ebegin "Killing remaining processes"
-   killall5 -9 ${killall5_opts}
+   kill_all 9 ${killall5_opts}
eend 0
 }



[gentoo-commits] proj/openrc:master commit in: conf.d/, init.d/

2017-02-26 Thread William Hubbs
commit: d4d0f25a4844ecaed43de913e8b729e7a2e894db
Author: William Hubbs  gmail  com>
AuthorDate: Sun Feb 26 19:51:50 2017 +
Commit: William Hubbs  gentoo  org>
CommitDate: Sun Feb 26 19:51:50 2017 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=d4d0f25a

net-online: updates to make the service more usable

- switch from attempting to ping the default gateway to a host outside
the local network, defaulting to google.com.
- along with this, change the name of the variable that requests a ping
test to include_ping_test so the meaning is more clear.

 conf.d/net-online| 11 +++
 init.d/net-online.in | 27 ++-
 2 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/conf.d/net-online b/conf.d/net-online
index aa2c76ba..9abe9ea4 100644
--- a/conf.d/net-online
+++ b/conf.d/net-online
@@ -3,10 +3,13 @@
 # default is all interfaces that support ethernet.
 #interfaces=""
 
-# This setting controls whether a ping to the default gateway is
-# included in the test for network connectivity after all interfaces
-# are active.
-#ping_default_gateway=no
+# This setting controls whether a ping test is included in the test for
+# network connectivity after all interfaces are active.
+#include_ping_test=no
+
+# This setting is the host to attempt to ping if the above is yes.
+# The default is google.com.
+#ping_test_host=some.host.name
 
 # The timeout setting controls how long the net-online service waits
 # for the network to be configured.

diff --git a/init.d/net-online.in b/init.d/net-online.in
index dd3548d6..31af4dd1 100644
--- a/init.d/net-online.in
+++ b/init.d/net-online.in
@@ -15,6 +15,7 @@ depend()
 {
after modules
need sysfs
+   provide network-online
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -uml -vserver
 }
 
@@ -27,19 +28,6 @@ get_interfaces()
done
 }
 
-get_default_gateway()
-{
-   local cmd gateway
-   if command -v ip > /dev/null 2>&1; then
-   cmd="ip route show"
-   else
-   cmd=route
-   fi
-   set -- $($cmd | grep default)
-   [ "$2" != via ] && gateway="$2" || gateway="$3"
-   printf "%s" $gateway
-}
-
 start ()
 {
local carriers configured dev gateway ifcount infinite
@@ -66,10 +54,15 @@ start ()
: $((timeout -= 1))
  done
  ! $infinite && [ $timeout -eq 0 ] && rc=1
- if [ $rc -eq 0 ] && yesno ${ping_default_gateway:-no}; then
-   gateway="$(get_default_gateway)"
-   if [ -n "$gateway" ] && ! ping -c 1 $gateway > /dev/null 2>&1; then
-   rc=1
+ include_ping_test=${include_ping_test:-${ping_default_gateway}}
+ if [ -n "${ping_default_gateway}" ]; then
+ ewarn "ping_default_gateway is deprecated, please use include_ping_test'
+ fi
+ if [ $rc -eq 0 ] && yesno ${include_ping_test:-no}; then
+   ping_test_host="${ping_test_host:-google.com}"
+   if [ -n "$ping_test_host" ]; then
+   ping -c 1 $ping_test_host > /dev/null 2>&1
+   rc=$?
fi
  fi
  eend $rc "The network is offline"



[gentoo-commits] proj/openrc:master commit in: conf.d/, init.d/

2016-01-19 Thread William Hubbs
commit: 1f0441e0c5ca75b7593ae57987770567054c29e2
Author: William Hubbs  gmail  com>
AuthorDate: Tue Jan 19 18:32:56 2016 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Jan 19 19:01:07 2016 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1f0441e0

localmount: Allow users to control whether errors are ignored

 conf.d/localmount| 6 ++
 init.d/localmount.in | 5 +
 2 files changed, 11 insertions(+)

diff --git a/conf.d/localmount b/conf.d/localmount
index e3361da..397e8cd 100644
--- a/conf.d/localmount
+++ b/conf.d/localmount
@@ -1,3 +1,9 @@
 # Stop the unmounting of certain points.
 # This could be useful for some NFS related work.
 #no_umounts="/dir1:/var/dir2"
+#
+# Ignore errors when mounting local file systems.
+# This should be left alone unless you know what you are doing. If it is
+# set to yes, not only will we allow mount failures, but we will ignore
+# syntax errors in fstab.
+#ignore_mount_errors="NO"

diff --git a/init.d/localmount.in b/init.d/localmount.in
index a2b7a8a..cfc841a 100644
--- a/init.d/localmount.in
+++ b/init.d/localmount.in
@@ -39,6 +39,11 @@ start()
rc=$?
if [ "$RC_UNAME" != Linux ]; then
rc=0
+   elif yesno "${ignore_mount_errors:-NO}"; then
+   if [ $rc -ne 0 ]; then
+   ewarn "localmount: errors detected, but ignored"
+   fi
+   rc=0
fi
return $rc
 }



[gentoo-commits] proj/openrc:master commit in: conf.d/, init.d/

2015-10-29 Thread William Hubbs
commit: ee944553a9ea35622046bd1ab5657fd416a7019a
Author: William Hubbs  gmail  com>
AuthorDate: Wed Oct 21 19:01:57 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Wed Oct 21 19:04:28 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ee944553

bootmisc: optionally save the previous dmesg log

X-Gentoo-Bug: 561204
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=561204

 conf.d/bootmisc| 5 +
 init.d/bootmisc.in | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/conf.d/bootmisc b/conf.d/bootmisc
index d79706c..5371209 100644
--- a/conf.d/bootmisc
+++ b/conf.d/bootmisc
@@ -8,3 +8,8 @@ wipe_tmp="YES"
 # Write the initial dmesg log into /var/log/dmesg after boot
 # This may be useful if you need the kernel boot log afterwards
 log_dmesg="YES"
+
+# Save the previous dmesg log to dmesc.old
+# This may be useful if you need to compare the current boot to the
+# previous one.
+#previous_dmesg=no

diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
index 1a05920..4015d8f 100644
--- a/init.d/bootmisc.in
+++ b/init.d/bootmisc.in
@@ -216,6 +216,9 @@ start()
case "$RC_SYS" in
VSERVER|OPENVZ|LXC|SYSTEMD-NSPAWN) ;;
*)
+   if yesno ${previous_dmesg:-no}; then
+   mv /var/log/dmesg 
/var/log/dmesg.old
+   fi
dmesg > /var/log/dmesg
chmod 640 /var/log/dmesg
;;



[gentoo-commits] proj/openrc:master commit in: conf.d/, /, init.d/

2015-10-29 Thread William Hubbs
commit: 960881fcfe974178c0846a816663a258cdd488cc
Author: William Hubbs  gmail  com>
AuthorDate: Mon Oct 19 23:06:55 2015 +
Commit: William Hubbs  gentoo  org>
CommitDate: Tue Oct 20 17:13:47 2015 +
URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=960881fc

Add net-online service

 NEWS.md  | 12 +
 conf.d/Makefile  |  3 ++-
 conf.d/net-online| 15 
 init.d/Makefile  |  2 +-
 init.d/net-online.in | 69 
 5 files changed, 99 insertions(+), 2 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index d67ed60..71a1b7f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,6 +3,18 @@
 This file will contain a list of notable changes for each release. Note
 the information in this file is in reverse order.
 
+## OpenRC-0.19
+
+This version adds a net-online service. By default, this
+service will check all known network interfaces for a configured
+interface or a carrier. It will register as started only when all
+interfaces are configured and there is at least a carrier on one
+interface. The behaviour of this service can be modified in
+/etc/conf.d/net-online.
+
+Currently, this only works on Linux, but if anyone wants to port to
+*bsd, that would be welcomed.
+
 ## OpenRC-0.18.3
 
 Modern Linux systems expect /etc/mtab to be a symbolic link to

diff --git a/conf.d/Makefile b/conf.d/Makefile
index 34a3b07..b8da0e0 100644
--- a/conf.d/Makefile
+++ b/conf.d/Makefile
@@ -15,7 +15,8 @@ include ${MK}/os.mk
 
 CONF-FreeBSD=  ipfw moused powerd rarpd savecore syscons
 
-CONF-Linux=consolefont devfs dmesg hwclock keymaps killprocs modules mtab
+CONF-Linux=consolefont devfs dmesg hwclock keymaps killprocs modules mtab \
+   net-online
 
 CONF-NetBSD=   moused rarpd savecore
 

diff --git a/conf.d/net-online b/conf.d/net-online
new file mode 100644
index 000..bf0b09a
--- /dev/null
+++ b/conf.d/net-online
@@ -0,0 +1,15 @@
+# The interfaces setting controls which interfaces the net-online
+# service considers in deciding whether the network is active. By
+# default, it is all ethernet or wireless LAN interfaces.
+#interfaces=""
+
+# This setting controls whether a ping to the default gateway is
+# included in the test for network connectivity after all interfaces
+# are active.
+#ping_default_gateway=no
+
+# The timeout setting controls how long the net-online service waits
+# for the network to be configured.
+# The default is 120 seconds.
+# if this is set to 0, the wait is infinite.
+#timeout=120

diff --git a/init.d/Makefile b/init.d/Makefile
index a662f8d..f256095 100644
--- a/init.d/Makefile
+++ b/init.d/Makefile
@@ -23,7 +23,7 @@ SRCS-FreeBSD+=adjkerntz.in devd.in dumpon.in 
encswap.in ipfw.in \
 
 SRCS-Linux=binfmt.in 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
+   procfs.in net-online.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 \

diff --git a/init.d/net-online.in b/init.d/net-online.in
new file mode 100644
index 000..ab3da6f
--- /dev/null
+++ b/init.d/net-online.in
@@ -0,0 +1,69 @@
+#!@SBINDIR@/openrc-run
+# Copyright (C) 2015 William Hubbs 
+# Released under the 2-clause BSD license.
+
+description="Delays until the network is online or a specific timeout"
+
+depend()
+{
+   after modules
+   need sysfs
+   keyword -jail -lxc -openvz -prefix -systemd-nspawn -uml -vserver
+}
+
+get_interfaces()
+{
+   local ifname iftype
+   for ifname in /sys/class/net/*; do
+   read iftype < ${ifname}/type
+   [ "$iftype" = "1" ] && printf "%s " ${ifname##*/}
+   done
+}
+
+get_default_gateway()
+{
+   local cmd gateway
+   if command -v ip > /dev/null 2>&1; then
+   cmd="ip route show"
+   else
+   cmd=route
+   fi
+   set -- $($cmd | grep default)
+   [ "$2" != via ] && gateway="$2" || gateway="$3"
+   printf "%s" $gateway
+}
+
+start ()
+{
+   local carriers configured dev gateway ifcount infinite interfaces
+   local rc state timeout x
+
+   ebegin "Checking to see if the network is online"
+   rc=0
+   interfaces=${interfaces:-$(get_interfaces)}
+   timeout=${timeout:-120}
+ [ $timeout -eq 0 ] && infinite=true || infinite=false
+ while $infinite || [ $timeout -gt 0 ]; do
+   carriers=0
+   configured=0
+   ifcount=0
+   for dev in ${interfaces}; do
+   : $((ifcount += 1))
+   read x < /sys/class/net/$dev/carrier
+   [ $x -eq 1 ] && : $((carriers += 1))
+   read x < /sys/class/net/$dev/operstate
+   [ "$x" = up ] && : $((configured += 1))
+   done
+   [ $configured -eq $ifcount ] && [ $carriers