Merge pull request #74 from vholer/master
Fix pre/post networking parts for SysV and Upstartpull/76/head
commit
3741bc7eb6
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
# chkconfig: 2345 11 99
|
||||||
|
# description: OpenNebula contextualization
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: one-context
|
||||||
|
# Required-Start: $local_fs $network $syslog one-context-local
|
||||||
|
# Required-Stop:
|
||||||
|
# Should-Start: $time
|
||||||
|
# Should-Stop:
|
||||||
|
# X-Start-Before: sshd
|
||||||
|
# X-Stop-After:
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: OpenNebula contextualization
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
action $"Starting OpenNebula contextualization: " \
|
||||||
|
/usr/sbin/one-contextd network
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
# chkconfig: 2345 9 99
|
||||||
|
# description: OpenNebula pre-networking contextualization
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: one-context-local
|
||||||
|
# Required-Start: $local_fs
|
||||||
|
# Required-Stop:
|
||||||
|
# Should-Start: $time
|
||||||
|
# Should-Stop:
|
||||||
|
# X-Start-Before: $network
|
||||||
|
# X-Stop-After:
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: OpenNebula pre-networking contextualization
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
action $"Starting OpenNebula pre-networking contextualization: " \
|
||||||
|
/usr/sbin/one-contextd local
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: one-context-reconfigure
|
||||||
|
# Required-Start: one-context-local one-context
|
||||||
|
# Required-Stop:
|
||||||
|
# Should-Start: $time
|
||||||
|
# Should-Stop:
|
||||||
|
# Default-Start:
|
||||||
|
# Default-Stop: 0 1 2 3 4 5 6
|
||||||
|
# Short-Description: OpenNebula reconfiguration
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
export TIMEOUT=0
|
||||||
|
log_daemon_msg $"Starting OpenNebula reconfiguration"
|
||||||
|
/usr/sbin/one-context-reconfigure
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_action_msg $"Usage: $0 {start}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
# chkconfig: - 99 1
|
||||||
|
# description: OpenNebula reconfiguration
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: one-context-reconfigure
|
||||||
|
# Required-Start: one-context-local one-context
|
||||||
|
# Required-Stop:
|
||||||
|
# Should-Start: $time
|
||||||
|
# Should-Stop:
|
||||||
|
# Default-Start:
|
||||||
|
# Default-Stop: 0 1 2 3 4 5 6
|
||||||
|
# Short-Description: OpenNebula reconfiguration
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
export TIMEOUT=0
|
||||||
|
action $"Starting OpenNebula reconfiguration: " \
|
||||||
|
/usr/sbin/one-context-reconfigure
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: one-context-reconfigure-delayed
|
||||||
|
# Required-Start: one-context-local one-context
|
||||||
|
# Required-Stop:
|
||||||
|
# Should-Start: $time
|
||||||
|
# Should-Stop:
|
||||||
|
# Default-Start:
|
||||||
|
# Default-Stop: 0 1 2 3 4 5 6
|
||||||
|
# Short-Description: OpenNebula delayed reconfiguration
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
log_daemon_msg $"Starting OpenNebula delayed reconfiguration"
|
||||||
|
/usr/sbin/one-context-reconfigure
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log_action_msg $"Usage: $0 {start}"
|
||||||
|
exit 2
|
||||||
|
esac
|
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------- #
|
||||||
|
# Copyright 2010-2017, OpenNebula Systems #
|
||||||
|
# #
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||||
|
# not use this file except in compliance with the License. You may obtain #
|
||||||
|
# a copy of the License at #
|
||||||
|
# #
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||||
|
# #
|
||||||
|
# Unless required by applicable law or agreed to in writing, software #
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||||
|
# See the License for the specific language governing permissions and #
|
||||||
|
# limitations under the License. #
|
||||||
|
#--------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
# chkconfig: - 99 1
|
||||||
|
# description: OpenNebula delayed reconfiguration
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: one-context-reconfigure-delayed
|
||||||
|
# Required-Start: one-context-local one-context
|
||||||
|
# Required-Stop:
|
||||||
|
# Should-Start: $time
|
||||||
|
# Should-Stop:
|
||||||
|
# Default-Start:
|
||||||
|
# Default-Stop: 0 1 2 3 4 5 6
|
||||||
|
# Short-Description: OpenNebula delayed reconfiguration
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
action $"Starting OpenNebula reconfiguration: " \
|
||||||
|
/usr/sbin/one-context-reconfigure
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
@ -0,0 +1,8 @@
|
|||||||
|
description "OpenNebula pre-networking contextualization"
|
||||||
|
author "OpenNebula Systems <support@opennebula.systems>"
|
||||||
|
|
||||||
|
start on mounted MOUNTPOINT=/
|
||||||
|
|
||||||
|
task
|
||||||
|
|
||||||
|
exec /usr/sbin/one-contextd local
|
@ -0,0 +1,6 @@
|
|||||||
|
description "OpenNebula delayed reconfiguration"
|
||||||
|
author "OpenNebula Systems <support@opennebula.systems>"
|
||||||
|
|
||||||
|
task
|
||||||
|
|
||||||
|
exec /usr/sbin/one-context-reconfigure
|
@ -0,0 +1,9 @@
|
|||||||
|
description "OpenNebula reconfiguration"
|
||||||
|
author "OpenNebula Systems <support@opennebula.systems>"
|
||||||
|
|
||||||
|
task
|
||||||
|
|
||||||
|
script
|
||||||
|
export TIMEOUT=0
|
||||||
|
exec /usr/sbin/one-context-reconfigure
|
||||||
|
end script
|
@ -0,0 +1,8 @@
|
|||||||
|
description "OpenNebula contextualization"
|
||||||
|
author "OpenNebula Systems <support@opennebula.systems>"
|
||||||
|
|
||||||
|
start on (filesystem and started rsyslog)
|
||||||
|
|
||||||
|
task
|
||||||
|
|
||||||
|
exec /usr/sbin/one-contextd network
|
@ -0,0 +1,12 @@
|
|||||||
|
# On NIC hogplug the delayed reconfiguration is triggered.
|
||||||
|
SUBSYSTEM=="net", ACTION=="add", \
|
||||||
|
TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service", \
|
||||||
|
RUN+="/usr/bin/timeout 5 /usr/sbin/service one-context-reconfigure-delayed start"
|
||||||
|
|
||||||
|
# When CONTEXT CD-ROM is changed, it generates 2 events. This rule takes
|
||||||
|
# every second event and triggers systemd service one-context-reconfigure.
|
||||||
|
# This service also stops any existing delayed reconfiguration.
|
||||||
|
SUBSYSTEM=="block", ACTION=="change", \
|
||||||
|
ENV{ID_FS_TYPE}=="iso9660" ENV{ID_FS_LABEL_ENC}=="CONTEXT", \
|
||||||
|
ENV{SEQNUM}=="*[02468]", \
|
||||||
|
RUN+="/usr/sbin/service one-context-reconfigure start"
|
@ -1,7 +0,0 @@
|
|||||||
# On NIC hogplug the delayed reconfiguration is triggered.
|
|
||||||
SUBSYSTEM=="net", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service"
|
|
||||||
|
|
||||||
# When CONTEXT CD-ROM is changed, it generates 2 events. This rule takes
|
|
||||||
# every second event and triggers systemd service one-context-reconfigure-now.
|
|
||||||
# This service also stops any existing delayed reconfiguration.
|
|
||||||
SUBSYSTEM=="block", ACTION=="change", ENV{ID_FS_TYPE}=="iso9660" ENV{ID_FS_LABEL_ENC}=="CONTEXT", ENV{SEQNUM}=="*[02468]" RUN+="/bin/systemctl start one-context-reconfigure.service"
|
|
@ -1 +0,0 @@
|
|||||||
SUBSYSTEM=="net", ACTION=="add", RUN="/usr/sbin/one-context-reconfigure"
|
|
@ -0,0 +1,11 @@
|
|||||||
|
# On NIC hogplug the delayed reconfiguration is triggered.
|
||||||
|
SUBSYSTEM=="net", ACTION=="add", \
|
||||||
|
TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service"
|
||||||
|
|
||||||
|
# When CONTEXT CD-ROM is changed, it generates 2 events. This rule takes
|
||||||
|
# every second event and triggers systemd service one-context-reconfigure.
|
||||||
|
# This service also stops any existing delayed reconfiguration.
|
||||||
|
SUBSYSTEM=="block", ACTION=="change", \
|
||||||
|
ENV{ID_FS_TYPE}=="iso9660" ENV{ID_FS_LABEL_ENC}=="CONTEXT", \
|
||||||
|
ENV{SEQNUM}=="*[02468]", \
|
||||||
|
RUN+="/bin/systemctl start one-context-reconfigure.service"
|
@ -0,0 +1,3 @@
|
|||||||
|
# On NIC hogplug the delayed reconfiguration is triggered.
|
||||||
|
SUBSYSTEM=="net", ACTION=="add", \
|
||||||
|
RUN+="/sbin/service one-context-reconfigure-delayed start"
|
@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=OpenNebula pre-networking contextualization script
|
||||||
|
DefaultDependencies=no
|
||||||
|
Before=network-pre.target
|
||||||
|
Wants=network-pre.target local-fs.target dev-disk-by\x2dlabel-CONTEXT.device
|
||||||
|
After=local-fs.target dev-disk-by\x2dlabel-CONTEXT.device
|
||||||
|
ConditionPathExists=!/var/run/one-context/context.sh.local
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/sbin/one-contextd local
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in new issue