diff --git a/init.d/agetty-tty8 b/init.d/agetty-tty8 new file mode 100755 index 0000000..e43449d --- /dev/null +++ b/init.d/agetty-tty8 @@ -0,0 +1,4 @@ +#!/usr/bin/env watchman + +service_command='/bin/agetty' +service_args="38400 ${service_name##*-} linux" diff --git a/init.d/cjdroute b/init.d/cjdroute index 7d494a3..d78ba0c 100755 --- a/init.d/cjdroute +++ b/init.d/cjdroute @@ -2,12 +2,11 @@ unset reload -service_username='cjdns' service_command='/usr/local/sbin/cjdroute' cjdroute_config='/etc/cjdroute.conf' cjdroute_tun_interface='cjdns0' -cjdroute_listen_port='' +cjdroute_listen_port='7530' service_pid=`lsof -i :"$cjdroute_listen_port" | tail -1 | cut -d ' ' -f 2` diff --git a/init.d/devfs b/init.d/devfs index 80ed7c0..aedbcc8 100755 --- a/init.d/devfs +++ b/init.d/devfs @@ -5,7 +5,6 @@ service_type='oneshot' cfg_mounts+=( 'dev:devtmpfs:defaults:/dev' ) cfg_mounts+=( '/dev/pts:devpts:noexec,nosuid,gid=5,mode=0620:/dev/pts' ) cfg_mounts+=( '/dev/mqueue:mqueue:noexec,nosuid,nodev:/dev/mqueue' ) -cfg_mounts+=( '/dev/pts:devpts:noexec,nosuid,gid=5,mode=0620:/dev/pts' ) cfg_mounts+=( 'tmpfs:tmpfs:defaults,mode=0777:/dev/shm' ) start() { diff --git a/init.d/dhcpcd b/init.d/dhcpcd index c56695e..69053b5 100755 --- a/init.d/dhcpcd +++ b/init.d/dhcpcd @@ -1,8 +1,6 @@ #!/usr/bin/env watchman # dhcp client daemon initscript -depends network - service_command='/usr/sbin/dhcpcd' service_args='-q -C resolv.conf' service_pidfile='/var/run/dhcpcd.pid' diff --git a/init.d/ipt b/init.d/ipt new file mode 100755 index 0000000..25a7772 --- /dev/null +++ b/init.d/ipt @@ -0,0 +1,7 @@ +#!/usr/bin/env watchman + +service_type='oneshot' +service_command='/usr/local/sbin/ipt' +service_args="$cfg_hostname" + +stop() { "$service_command" clean; } diff --git a/init.d/mdev b/init.d/mdev index 83adcc4..23ce0cb 100755 --- a/init.d/mdev +++ b/init.d/mdev @@ -1,5 +1,7 @@ #!/usr/bin/env watchman +depends devfs + service_command='/usr/local/sbin/mdev' service_rgs='-s' diff --git a/init.d/mount b/init.d/mount index ffa4fe6..9075a09 100755 --- a/init.d/mount +++ b/init.d/mount @@ -7,6 +7,7 @@ service_type='oneshot' start() { [[ -w / ]] || { mount -o remount,rw /; } mount -a + swapon -a } unset stop diff --git a/init.d/net-auto-wired b/init.d/net-auto-wired new file mode 100755 index 0000000..807bb22 --- /dev/null +++ b/init.d/net-auto-wired @@ -0,0 +1,62 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /usr/lib/network/globals +. /etc/conf.d/netcfg + +if [[ ! -x /usr/bin/ifplugd ]]; then + exit_stderr "Please install 'ifplugd' to use net-auto-wired" +fi + +if [[ -z "${WIRED_INTERFACE}" ]]; then + exit_stderr "No interface name set. Add to /etc/conf.d/netcfg a line"$'\n' \ + " WIRED_INTERFACE='your_interface'" +fi + +CFG=/etc/ifplugd/ifplugd.conf +ACTION=/etc/ifplugd/netcfg.action +PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid +[[ -f $PIDFILE ]] && read PID < $PIDFILE + +# Source ifplugd configuration +[ -f $CFG ] && . $CFG + +case "$1" in + start) + if ! ck_daemon net-auto-wired; then + exit_stderr "net-auto-wired has already been started: try \"/etc/rc.d/net-auto-wired restart\"" + fi + stat_busy "Starting netcfg auto-wired mode for interface ${WIRED_INTERFACE}" + A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`" + [[ "$A" ]] || A="$ARGS" + [[ "$PID" ]] || /usr/bin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A + # ifplugd may return non-zero, but still succeed if -w is passed, as default in upstream config. + sleep 1 + if [[ -f $PIDFILE ]]; then + add_daemon net-auto-wired + stat_done + else + stat_fail + fi + ;; + stop) + if ! ck_daemon net-auto-wired; then + stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}" + if [[ "$PID" ]] && /usr/bin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION; then + rm_daemon net-auto-wired + stat_done + else + stat_fail + fi + fi + ;; + restart) + "$0" stop + sleep 1 + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/init.d/net-auto-wireless b/init.d/net-auto-wireless new file mode 100755 index 0000000..9094232 --- /dev/null +++ b/init.d/net-auto-wireless @@ -0,0 +1,61 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /usr/lib/network/globals +. /etc/conf.d/netcfg + +if [[ ! -x /usr/sbin/wpa_actiond ]]; then + exit_stderr "Please install 'wpa_actiond' to use net-auto-wireless" +fi + +if [[ -z "${WIRELESS_INTERFACE}" ]]; then + exit_stderr "No interface name set. Add to /etc/conf.d/netcfg a line"$'\n' \ + " WIRELESS_INTERFACE='your_interface'" +fi + +case "$1" in + start) + if ! ck_daemon net-auto-wireless; then + exit_stderr "net-auto-wireless has already been started: try \"/etc/rc.d/net-auto-wireless restart\"" + fi + # Ensure any device renaming has occurred as intended + for daemon in "${DAEMONS[@]}"; do + if [[ "$daemon" = "net-rename" ]]; then + if ck_daemon net-rename; then + /etc/rc.d/net-rename start + fi + fi + done + + stat_busy "Starting netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}" + if /usr/bin/netcfg-wpa_actiond "${WIRELESS_INTERFACE}" >/dev/null; then + add_daemon net-auto-wireless + stat_done + else + stat_fail + fi + ;; + stop) + if ! ck_daemon net-auto-wireless; then + stat_busy "Stopping netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}" + if /usr/bin/netcfg-wpa_actiond stop "${WIRELESS_INTERFACE}" >/dev/null; then + rm_daemon net-auto-wireless + stat_done + else + stat_fail + fi + fi + ;; + restart) + "$0" stop + sleep 1 + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac +exit 0 +# vim: ft=sh ts=4 et sw=4: diff --git a/init.d/net-profiles b/init.d/net-profiles new file mode 100755 index 0000000..ae9c00e --- /dev/null +++ b/init.d/net-profiles @@ -0,0 +1,55 @@ +#!/bin/bash +# +# This script utilizes netcfg-daemon. + +. /etc/rc.conf +. /etc/rc.d/functions +. /usr/lib/network/globals + +case "$1" in + start) + if ! ck_daemon net-profiles; then + exit_stderr "net-profiles has already been started. Try '/etc/rc.d/net-profiles restart'" + fi + + # Ensure any device renaming has occurred as intended + for daemon in "${DAEMONS[@]}"; do + if [[ $daemon = net-rename ]]; then + if ck_daemon net-rename; then + /etc/rc.d/net-rename start + fi + fi + done + + # $NET env var is passed from the kernel boot line + if [[ -n $NET ]]; then + # Record the connected profile for net-profiles stop + if [[ $NET = menu ]]; then + /usr/bin/netcfg-menu || exit 1 + mv "$STATE_DIR"/{menu,netcfg-daemon} + else + /usr/bin/netcfg check-iface "$NET" || exit 1 + echo "$NET" > "$STATE_DIR/netcfg-daemon" + fi + elif ! /usr/bin/netcfg-daemon start; then + exit_err "No profile started." + fi + add_daemon net-profiles + ;; + stop) + if ck_daemon net-profiles; then + exit_stderr "net-profiles is not running" + fi + /usr/bin/netcfg-daemon stop + rm_daemon net-profiles + ;; + restart) + "$0" stop + sleep 1 + "$0" start + ;; + *) + exit_stderr "Usage: $0 {start|stop|restart}" +esac + +# vim: ft=sh ts=4 et sw=4: diff --git a/init.d/net-rename b/init.d/net-rename new file mode 100755 index 0000000..42dfa23 --- /dev/null +++ b/init.d/net-rename @@ -0,0 +1,28 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /usr/lib/network/globals + +case "$1" in + start) + report_try "Renaming network devices" + ifrename -p -t + report_success + + add_daemon net-rename + ;; + stop) + rm_daemon net-rename + # No stop neccesary, but add one to look nice on shutdown. + /bin/true + ;; + restart) + "$0" start + ;; + *) + exit_stderr "Usage: $0 {start|stop|restart}" + ;; +esac + +# vim: ft=sh ts=4 et sw=4: diff --git a/init.d/network b/init.d/network index 85245eb..0b050c6 100755 --- a/init.d/network +++ b/init.d/network @@ -1,10 +1,12 @@ #!/usr/bin/env watchman service_type='oneshot' +service_command='ip' +service_args='link set lo up' start() { watchman.msg "Activating the loopback interface (lo)..." - ip link set lo up + watchman.start } stop() { diff --git a/init.d/nrpe b/init.d/nrpe index a30a8fa..5c84251 100755 --- a/init.d/nrpe +++ b/init.d/nrpe @@ -2,6 +2,6 @@ cfg_nrpe_config='/etc/nrpe/nrpe.cfg' -service_command='/bin/nrpe' -service_args="-c $cfg_nrpe_config -d" +service_command='/usr/bin/nrpe' service_pidfile='/run/nrpe.pid' +service_args=" -c ${cfg_nrpe_config} -d" diff --git a/init.d/openvpn-mh b/init.d/openvpn-mh new file mode 100755 index 0000000..ea0c0a1 --- /dev/null +++ b/init.d/openvpn-mh @@ -0,0 +1,7 @@ +#!/usr/bin/env watchman + +cfg_ovpn_instance="${service_name##*-}" + +service_command="/usr/sbin/openvpn" +service_workdir="/etc/openvpn/$cfg_ovpn_instance" +service_args="client.cfg" diff --git a/init.d/preload b/init.d/preload new file mode 100755 index 0000000..6ad2a19 --- /dev/null +++ b/init.d/preload @@ -0,0 +1,4 @@ +#!/usr/bin/env watchman + +service_command='/bin/preload' +service_args='-f' diff --git a/init.d/sshd b/init.d/sshd index d98ef34..ab0e6ce 100755 --- a/init.d/sshd +++ b/init.d/sshd @@ -1,7 +1,5 @@ #!/usr/bin/env watchman -watchman.depends network - cfg_sshd_cfgdir='/etc/ssh' service_command='/bin/sshd' diff --git a/init.d/udev b/init.d/udev index d13d3fc..b335dec 100755 --- a/init.d/udev +++ b/init.d/udev @@ -1,10 +1,11 @@ #!/usr/bin/env watchman -service_command='/bin/udevd' +service_command='/sbin/udevd' +# service_args='--resolve-names=never' cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}" -watchman.depends devfs +depends devfs udev.populate_dev() { watchman.msg "Populating /dev with udev..." @@ -13,6 +14,7 @@ udev.populate_dev() { watchman.msg "Waiting for uevents..." udevadm settle --timeout=${cfg_udev_settle_timeout} + udevadm control --property=do_not_run_plug_service= } start() {