Invasive oneshot services now use spawn()

This commit is contained in:
Jack L. Frost 2014-07-28 07:52:32 +04:00
parent 902f317440
commit 8e225fa577
13 changed files with 23 additions and 18 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
# As of spark-rc 1.1.5, this script is deprecated
service_type='oneshot' service_type='oneshot'
@ -8,7 +7,7 @@ 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/mqueue:mqueue:noexec,nosuid,nodev:/dev/mqueue' )
cfg_mounts+=( 'tmpfs:tmpfs:defaults,mode=0777:/dev/shm' ) cfg_mounts+=( 'tmpfs:tmpfs:defaults,mode=0777:/dev/shm' )
start() { spawn() {
for m in ${cfg_mounts[@]}; do for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1` fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2` fs_type=`echo "$m" | cut -d':' -f2`

View File

@ -1,11 +1,12 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
# This is a script to set up the links in /dev in absence of e?(u|s?m)dev. # This is a script to set up the links in /dev in absence of e?(u|s?m)dev.
# Run this _after_ miscfs.
service_type='oneshot' service_type='oneshot'
# Config moved to conf.d # Config moved to conf.d
start() { spawn() {
for l in "${cfg_links[@]}"; do for l in "${cfg_links[@]}"; do
IFS=';' read dest link <<< "$l" IFS=';' read dest link <<< "$l"

View File

@ -1,11 +1,12 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
# This is a script to set up the right permissions in /dev in absence of e?(u|s?m)dev. # This is a script to set up the right permissions in /dev in absence of e?(u|s?m)dev.
# Run this _after_ miscfs.
service_type='oneshot' service_type='oneshot'
# Config moved to conf.d # Config moved to conf.d
start() { spawn() {
for d in "${cfg_devices[@]}"; do for d in "${cfg_devices[@]}"; do
IFS=';' read device owner perms <<< "$d" IFS=';' read device owner perms <<< "$d"

View File

@ -5,6 +5,8 @@ service_command='/usr/bin/udevd'
cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}" cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}"
depends devfs
udev.populate_dev() { udev.populate_dev() {
watchman.msg "Populating /dev with udev..." watchman.msg "Populating /dev with udev..."
udevadm trigger --type=subsystems --action=add udevadm trigger --type=subsystems --action=add

View File

@ -1,6 +1,5 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
service_type='oneshot' service_type='oneshot'
service_command='hostname' service_command='hostname'
service_args="$cfg_hostname" service_args="$cfg_hostname"

View File

@ -5,7 +5,7 @@ service_type='oneshot'
cfg_ip4dump='/etc/iptables/ip4.rules' cfg_ip4dump='/etc/iptables/ip4.rules'
cfg_ip6dump='/etc/iptables/ip6.rules' cfg_ip6dump='/etc/iptables/ip6.rules'
start() { spawn() {
watchman.msg "Restoring netfilter rules..." watchman.msg "Restoring netfilter rules..."
[[ -f "$cfg_ip4dump" ]] && { [[ -f "$cfg_ip4dump" ]] && {

View File

@ -1,5 +1,7 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
depends devfs
service_command='/usr/local/sbin/mdev' service_command='/usr/local/sbin/mdev'
service_rgs='-s' service_rgs='-s'

View File

@ -1,5 +1,4 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
# As of spark-rc 1.1.5, this script is deprecated
service_type='oneshot' service_type='oneshot'
@ -7,7 +6,7 @@ cfg_mounts+=( 'proc:proc:defaults:/proc' )
cfg_mounts+=( 'run:tmpfs:defaults:/run' ) cfg_mounts+=( 'run:tmpfs:defaults:/run' )
cfg_mounts+=( 'sys:sysfs:defaults:/sys' ) cfg_mounts+=( 'sys:sysfs:defaults:/sys' )
start() { spawn() {
for m in ${cfg_mounts[@]}; do for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1` fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2` fs_type=`echo "$m" | cut -d':' -f2`
@ -22,8 +21,6 @@ start() {
} }
done done
touch "${cfg_rundir}/${service_name}.done"
return 0 return 0
} }

View File

@ -1,8 +1,10 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
depends miscfs
service_type='oneshot' service_type='oneshot'
start() { spawn() {
[[ -w / ]] || { mount -o remount,rw /; } [[ -w / ]] || { mount -o remount,rw /; }
mount -a mount -a
swapon -a swapon -a

View File

@ -7,5 +7,7 @@ service_args='/etc/rc.local'
unset stop unset stop
start() { start() {
[[ -f "/etc/rc.local" ]] && { watchman.start; } [[ -f "/etc/rc.local" ]] && {
watchman.start
}
} }

View File

@ -8,7 +8,9 @@ service_args="-D -f $cfg_sshd_cfgdir/sshd_config"
sshd_genkeys() { sshd_genkeys() {
[[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; } [[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; }
watchman.start
} }
start() { sshd_genkeys; } start() {
sshd_genkeys
watchman.start
}

View File

@ -14,8 +14,4 @@ service_type='oneshot'
service_command='/sbin/sysctl' service_command='/sbin/sysctl'
service_args="-p /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf" service_args="-p /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf"
start() {
watchman.start
}
unset restart reload unset restart reload

View File

@ -5,6 +5,8 @@ service_command='/usr/lib/systemd/systemd-udevd'
cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}" cfg_udev_settle_timeout="${cfg_udev_settle_timeout:-60}"
depends devfs
udev.populate_dev() { udev.populate_dev() {
watchman.msg "Populating /dev with udev..." watchman.msg "Populating /dev with udev..."
udevadm trigger --type=subsystems --action=add udevadm trigger --type=subsystems --action=add