diff options
author | Peter Volkov <pva@gentoo.org> | 2008-10-13 09:25:59 +0000 |
---|---|---|
committer | Peter Volkov <pva@gentoo.org> | 2008-10-13 09:25:59 +0000 |
commit | a93a7d5e312a8d679ee7c1e615a483482def5d8c (patch) | |
tree | e1fe47ee775f13c0d406d675b4f4b2e0924a201e /sys-cluster/vzctl/files | |
parent | Unmask openoffice-bin-3.0.0, officially released now (diff) | |
download | gentoo-2-a93a7d5e312a8d679ee7c1e615a483482def5d8c.tar.gz gentoo-2-a93a7d5e312a8d679ee7c1e615a483482def5d8c.tar.bz2 gentoo-2-a93a7d5e312a8d679ee7c1e615a483482def5d8c.zip |
Made scripts openvz compatible. Skipped revisions to have possibility to put major updates (e.g. security) without this changes applied.
(Portage version: 2.2_rc11/cvs/Linux 2.6.26-gentoo-r1 i686)
Diffstat (limited to 'sys-cluster/vzctl/files')
-rw-r--r-- | sys-cluster/vzctl/files/vzctl-3.0.22-scripts-openrc.patch | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/sys-cluster/vzctl/files/vzctl-3.0.22-scripts-openrc.patch b/sys-cluster/vzctl/files/vzctl-3.0.22-scripts-openrc.patch new file mode 100644 index 000000000000..77a305dfe3bc --- /dev/null +++ b/sys-cluster/vzctl/files/vzctl-3.0.22-scripts-openrc.patch @@ -0,0 +1,237 @@ +--- etc/dists/scripts/gentoo-add_ip.sh 2008-09-16 14:25:00 +0000 ++++ etc/dists/scripts/gentoo-add_ip.sh 2008-08-28 20:55:10 +0000 +@@ -16,7 +16,8 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # +-# This script configure IP alias(es) inside Gentoo like VE. ++# This script configures IP alias(es) inside Gentoo based VE with ++# baselayout-1/openrc used as services/stratup/shutdown system. + # + # Parameters are passed in environment variables. + # Required parameters: +@@ -29,40 +30,62 @@ + # + VENET_DEV=venet0 + +- +-IFCFG_DIR=/etc/conf.d +-IFCFG=${IFCFG_DIR}/net ++#IFCFG_DIR=/etc/conf.d ++IFCFG=/etc/conf.d/net + + SCRIPT=/etc/runlevels/default/net.${VENET_DEV} + + HOSTFILE=/etc/hosts + +-function fix_net() ++# Return true is we have openrc based VE and false if not. ++# Note: /etc/gentoo-release has nothing to do with openrc ++function is_openrc() ++{ ++ [ -f /lib/librc.so ] ++} ++ ++function comment_line_regex() ++{ ++ cp -pf ${IFCFG} ${IFCFG}.$$ || \ ++ error "Failed to comment ${1}: unable to copy ${IFCFG}" ${VZ_FS_NO_DISK_SPACE} ++ sed -e "s/${1}/#${1}/" < ${IFCFG} > ${IFCFG}.$$ && \ ++ mv -f ${IFCFG}.$$ ${IFCFG} 2>/dev/null ++ if [ $? -ne 0 ]; then ++ rm -f ${IFCFG}.$$ 2>/dev/null ++ error "Failed to comment ${1}: unable to create ${IFCFG}." ++ fi ++} ++ ++function set_config() ++{ ++ if ! grep -qe "^config_eth" ${IFCFG} 2>/dev/null; then ++ comment_line_regex "^config_eth" ++ comment_line_regex "^routes_eth" ++ fi ++ if is_openrc ; then ++ put_param ${IFCFG} "config_${VENET_DEV}" "" ++ put_param ${IFCFG} "routes_${VENET_DEV}" "default" ++ else ++ put_param3 ${IFCFG} "config_${VENET_DEV}" "" ++ put_param3 ${IFCFG} "routes_${VENET_DEV}" \ ++ "-net ${FAKEGATEWAYNET}/24" # dev ${VENET_DEV} ++ add_param3 ${IFCFG} "routes_${VENET_DEV}" "default via ${FAKEGATEWAY}" ++ fi ++} ++ ++function set_rc() + { + [ -f "${SCRIPT}" ] && return 0 + rc-update del net.eth0 &>/dev/null ++ rc-update add net.lo boot &>/dev/null + ln -sf /etc/init.d/net.lo /etc/init.d/net.${VENET_DEV} +- rc-update add net.lo boot &>/dev/null + rc-update add net.${VENET_DEV} default &>/dev/null +- if ! grep -qe "^config_eth" ${IFCFG} 2>/dev/null; then +- return 0 +- fi +- cp -pf ${IFCFG} ${IFCFG}.$$ || error "Unable to copy ${IFCFG}" +- sed -e 's/^config_eth/#config_eth/' -e 's/^routes_eth/#routes_eth/' < ${IFCFG} > ${IFCFG}.$$ && mv -f ${IFCFG}.$$ ${IFCFG} 2>/dev/null +- if [ $? -ne 0 ]; then +- rm -f ${IFCFG}.$$ 2>/dev/null +- error "Unable to create ${IFCFG}" +- fi + } + +-function setup_network() ++function init_netconfig() + { +- fix_net +- put_param3 ${IFCFG} "config_${VENET_DEV}" "" +- # add fake route +- put_param3 ${IFCFG} "routes_${VENET_DEV}" \ +- "-net ${FAKEGATEWAYNET}/24" # dev ${VENET_DEV} +- add_param3 ${IFCFG} "routes_${VENET_DEV}" "default via ${FAKEGATEWAY}" ++ set_rc ++ set_config + # Set up /etc/hosts + if [ ! -f ${HOSTFILE} ]; then + echo "127.0.0.1 localhost.localdomain localhost" > $HOSTFILE +@@ -72,25 +95,27 @@ + function add_ip() + { + local ip +- local new_ips +- +- # In case we are starting VE +- if [ "x${VE_STATE}" = "xstarting" ]; then +- setup_network +- fi +- +- if [ "x${IPDELALL}" = "xyes" ]; then +- put_param3 "${IFCFG}" "config_${VENET_DEV}" "" ++ if [ "x${VE_STATE}" = "xstarting" -o "x${IPDELALL}" = "xyes" ]; then ++ init_netconfig ++ if [ "x${IPDELALL}" = "xyes" ]; then ++ /etc/init.d/net.${VENET_DEV} stop >/dev/null 2>&1 ++ return 0 ++ fi + fi + + for ip in ${IP_ADDR}; do +- grep -qw "^config_${VENET_DEV}=\(.*\"${ip}[\"\/].*\)" ${IFCFG} || +- add_param3 "${IFCFG}" "config_${VENET_DEV}" "${ip}/32" ++ if ! grep -qw "config_${VENET_DEV}=\(.*\"${ip}[\"\/].*\)" ${IFCFG}; then ++ if is_openrc ; then ++ add_param "${IFCFG}" "config_${VENET_DEV}" "${ip}/32" ++ else ++ add_param3 "${IFCFG}" "config_${VENET_DEV}" "${ip}/32" ++ fi ++ fi + done + + if [ "x${VE_STATE}" = "xrunning" ]; then + # synchronyze config files & interfaces +- /etc/init.d/net.${VENET_DEV} restart ++ /etc/init.d/net.${VENET_DEV} restart >/dev/null 2>&1 + fi + } + + +--- etc/dists/scripts/gentoo-del_ip.sh 2008-09-16 14:25:00 +0000 ++++ etc/dists/scripts/gentoo-del_ip.sh 2008-08-28 20:55:33 +0000 +@@ -28,19 +28,28 @@ + VENET_DEV=venet0 + CFGFILE=/etc/conf.d/net + +-# Function to delete IP address for Debian template ++# Return true is we have openrc based VE and false if not. ++# Note: /etc/gentoo-release has nothing to do with openrc ++function is_openrc() ++{ ++ [ -f /lib/librc.so ] ++} ++ + function del_ip() + { +- local found= +- local ip e_ip +- ++ local ip + for ip in ${IP_ADDR}; do +- grep -qw "${ip}" ${CFGFILE} && found=true && +- del_param3 "${CFGFILE}" "config_${VENET_DEV}" "${ip}/32" ++ if grep -qw "${ip}" ${CFGFILE}; then ++ if is_openrc ; then ++ del_param "${CFGFILE}" "config_${VENET_DEV}" "${ip}/32" ++ else ++ del_param3 "${CFGFILE}" "config_${VENET_DEV}" "${ip}/32" ++ fi ++ if [ "x${VE_STATE}" = "xrunning" ]; then ++ /etc/init.d/net.${VENET_DEV} restart >/dev/null 2>&1 ++ fi ++ fi + done +- if [ -n "${found}" ]; then +- /etc/init.d/net.${VENET_DEV} restart 2>/dev/null 1>/dev/null +- fi + } + + del_ip + +--- etc/dists/scripts/gentoo-set_hostname.sh 2008-09-16 14:25:00 +0000 ++++ etc/dists/scripts/gentoo-set_hostname.sh 2008-08-24 07:47:46 +0000 +@@ -16,22 +16,39 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + # +-# This script sets hostname inside VE for Gentoo like distros +-# For usage info see vz-veconfig(5) man page. ++# This script sets hostname inside Gentoo based VE with ++# baselayout-1/openrc used as services/stratup/shutdown system. + # + # Some parameters are passed in environment variables. + # Required parameters: + # Optional parameters: + # HOSTNM +-# Sets host name for this VE. Modifies /etc/hosts and +-# /etc/sysconfig/network (in RedHat) or /etc/rc.config (in SuSE) ++# Sets host name for this VE. Modifies /etc/conf.d/hostname ++ ++# Return true is we have openrc based VE and false if not. ++# Note: /etc/gentoo-release has nothing to do with openrc ++function is_openrc() ++{ ++ [ -f /lib/librc.so ] ++} ++ + function set_hostname() + { + local cfgfile=$1 + local hostname=$2 + + [ -z "${hostname}" ] && return 0 +- put_param "${cfgfile}" "HOSTNAME" "${hostname}" ++ if is_openrc ; then ++ if grep -qe "^HOSTNAME=" ${cfgfile} >/dev/null 2>&1; then ++ del_param ${cfgfile} "HOSTNAME" ++ fi ++ put_param "${cfgfile}" "hostname" "${hostname}" ++ else ++ if grep -qe "^hostname=" ${cfgfile} >/dev/null 2>&1; then ++ del_param ${cfgfile} "hostname" ++ fi ++ put_param "${cfgfile}" "HOSTNAME" "${hostname}" ++ fi + hostname ${hostname} + } + + +--- etc/dists/scripts/gentoo-set_ugid_quota.sh 2008-09-16 14:25:00 +0000 ++++ etc/dists/scripts/gentoo-set_ugid_quota.sh 2008-08-28 21:40:00 +0000 +@@ -57,6 +57,6 @@ + } + chmod 755 ${SCRIPTANAME} + +-ln -sf ${SCRIPTANAME} ${DEFAULT} ++rc-update add vzquota default + + exit 0 + |