This commit is contained in:
Jack L. Frost 2013-09-29 03:32:39 +04:00
parent 946b77d028
commit 7af48c15d4
24 changed files with 256 additions and 0 deletions

4
init.d/agetty Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env watchman
service_command='/bin/agetty'
service_args="38400 ${service_name##*-} linux"

1
init.d/agetty-tty2 Symbolic link
View File

@ -0,0 +1 @@
agetty

1
init.d/agetty-tty3 Symbolic link
View File

@ -0,0 +1 @@
agetty

1
init.d/agetty-tty4 Symbolic link
View File

@ -0,0 +1 @@
agetty

1
init.d/agetty-tty5 Symbolic link
View File

@ -0,0 +1 @@
agetty

1
init.d/agetty-tty6 Symbolic link
View File

@ -0,0 +1 @@
agetty

4
init.d/crond Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env watchman
service_command='/bin/crond'
service_args='-n'

20
init.d/dbus Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env watchman
service_command='/usr/bin/dbus-daemon'
service_args='--system'
service_pidfile='/run/dbus/pid'
start_pre() {
/usr/bin/dbus-uuidgen --ensure=/etc/machine-id
[[ -e /run/dbus ]] || { mkdir /run/dbus; }
}
start() {
start_pre
watchman.start
}
stop() {
[[ -e "$service_pidfile" ]] && { rm "$service_pidfile"; }
watchman.stop
}

32
init.d/devfs Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env watchman
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() {
for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2`
fs_opts=`echo "$m" | cut -d':' -f3`
fs_mountpoint=`echo "$m" | cut -d':' -f4`
mountpoint -q "$fs_mountpoint" || {
[[ -d "$fs_mountpoint" ]] || { mkdir "$fs_mountpoint"; }
mount "$fs_dev" -n -t "$fs_type" -o "$fs_opts" "$fs_mountpoint"
}
done
}
stop() {
for m in "${cfg_mounts[@]}"; do
fs_mountpoint=`echo "$m" | cut -d ':' -f 4`
mountpoint -q "$fs_mountpoint" && {
umount "$fs_mountpoint"
}
done
}

7
init.d/dhcpcd Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env watchman
depends network
service_command='/usr/sbin/dhcpcd'
service_args='-q'
service_pidfile='/var/run/dhcpcd.pid'

16
init.d/fsck Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env watchman
service_type='oneshot'
unset stop restart status
start() {
watchman.msg "Remounting / as read-only..."
mount / -o remount,ro
watchman.msg "Checking filesystems..."
/bin/fsck -A -p
watchman.msg "Remounting / as read-write..."
mount / -o remount,rw
}

16
init.d/hostname Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env watchman
service_type='oneshot'
service_command='hostname'
service_args="$cfg_hostname"
start() {
[[ -e "/etc/hostname" ]] && {
cfg_hostname=`cat /etc/hostname`
} || {
watchman.err "/etc/hostname: no such file"
return 1
}
watchman.start
}

9
init.d/mdev Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env watchman
service_command='/usr/local/sbin/mdev'
service_rgs='-s'
hotplug() {
echo "Enabling hotplug..."
echo /sbin/mdev > /proc/sys/kernel/hotplug
}

34
init.d/miscfs Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env watchman
service_type='oneshot'
cfg_mounts+=( 'proc:proc:defaults:/proc' )
cfg_mounts+=( 'run:tmpfs:defaults:/run' )
cfg_mounts+=( 'sys:sysfs:defaults:/sys' )
start() {
for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2`
fs_opts=`echo "$m" | cut -d':' -f3`
fs_mountpoint=`echo "$m" | cut -d':' -f4`
mountpoint -q "$fs_mountpoint" || {
[[ -d "$fs_mountpoint" ]] || { mkdir "$fs_mountpoint"; }
mount "$fs_dev" -n -t "$fs_type" -o "$fs_opts" "$fs_mountpoint" || {
could not mount "$fs_dev on $fs_mountpoint :("
}
}
done
return 0
}
stop() {
for m in "${cfg_mounts[@]}"; do
fs_mountpoint=`echo "$m" | cut -d ':' -f 4`
mountpoint -q "$fs_mountpoint" && {
umount "$fs_mountpoint"
}
done
}

9
init.d/mount Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env watchman
depends miscfs
service_type='oneshot'
service_command='/bin/mount'
service_args='-a'
unset stop

18
init.d/network Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env watchman
service_type='oneshot'
start() {
watchman.msg "Activating the loopback interface (lo)..."
ip link set lo up
}
stop() {
watchman.status || {
watchman.err "$service_name is already disabled"
return 1
}
watchman.msg "Deactivating the loopback interface (lo)..."
ip link set lo down
watchman.stop
}

7
init.d/nrpe Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env watchman
cfg_nrpe_config='/etc/nrpe/nrpe.cfg'
service_command='/bin/nrpe'
service_args="-c $cfg_nrpe_config -d"
service_pidfile='/run/nrpe.pid'

7
init.d/ntpd Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env watchman
cfg_ntpd_config='/etc/ntp.conf'
service_command='/bin/ntpd'
service_pidfile='/run/ntpd.pid'
service_args="-c $cfg_ntpd_config -p $service_pidfile"

7
init.d/openvpn-mh Executable file
View File

@ -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"

11
init.d/rc.local Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env watchman
service_type='oneshot'
service_command="$BASH"
service_args='/etc/rc.local'
unset stop
start() {
[[ -f "/etc/rc.local" ]] && { watchman.start; }
}

14
init.d/sshd Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env watchman
watchman.depends network
cfg_sshd_cfgdir='/etc/ssh'
service_command='/bin/sshd'
service_args="-f $cfg_sshd_cfgdir/sshd_config"
service_pidfile='/run/sshd.pid'
sshd_genkeys() {
[[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; }
watchman.start
}

4
init.d/syslog-ng Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env watchman
service_command='/bin/syslog-ng'
service_pidfile='/run/syslog-ng.pid'

27
init.d/udev Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env watchman
service_command='/usr/lib/systemd/systemd-udevd'
service_args='--resolve-names=never'
cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}"
watchman.depends devfs
udev.populate_dev() {
watchman.msg "Populating /dev with udev..."
udevadm trigger --type=subsystems --action=add
udevadm trigger --type=devices --action=add
watchman.msg "Waiting for uevents..."
udevadm settle --timeout=${cfg_udev_settle_timeout}
udevadm control --property=do_not_run_plug_service=
}
start() {
watchman.start
sleep 1
udev.populate_dev
}
reload() {
udevadm control --reload
}

5
init.d/xinetd Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env watchman
service_command='/usr/bin/xinetd'
service_pidfile="/run/xinetd.pid"
service_args="-pidfile $service_pidfile"