# HG changeset patch # User Eric Joseph-Alexandre # Date 1295567778 -3600 # Node ID daa2159acc30513c27d5d4ab015e7a3877033f67 # Parent 9e1674525e2f34e63b5c2190b36e21962acf23e5 Add: vzctl diff -r 9e1674525e2f -r daa2159acc30 vzctl/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/receipt Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,61 @@ +# SliTaz package receipt. + +PACKAGE="vzctl" +VERSION="3.0.25.1" +CATEGORY="system-tools" +SHORT_DESC="OpenVZ containers control utility" +MAINTAINER="erjo@slitaz.org" +DEPENDS="udev bash procmail bridge-utils logrotate tar gzip" +BUILD_DEPENDS="sed" +TARBALL="$PACKAGE-$VERSION.tar.bz2" +WEB_SITE="http://wiki.openvz.org/Main_Page" +WGET_URL="http://download.openvz.org/utils/${PACKAGE}/${VERSION}/src/${TARBALL}" + +# Rules to configure and make the package. +compile_rules() +{ + cd $src + + # Apply patches + while read patch_file; do + if [ -f done.$patch_file ]; then + echo "Skipping $patch_file" + continue + fi + echo "Apply $patch_file" + patch -p1 < ../stuff/$patch_file || exit 1 + touch done.$patch_file + done < +# + +VENET_DEV=eth0 +CFGFILE=/etc/network.conf + +function add_ip() +{ + if ! grep -q venet0 ${CFGFILE}; then + sed -i "s/^INTERFACE.*/INTERFACE=\"${VENET_DEV}\"/" ${CFGFILE} + fi + + if [ ! -z ${IP_ADDR} ]; then + sed -i 's/DHCP=.*/DHCP="no"/' ${CFGFILE} + sed -i 's/STATIC=.*/STATIC="yes"/' ${CFGFILE} + sed -i -e "s/IP=".*"/IP=\"${IP_ADDR}\"/" ${CFGFILE} + sed -i -e "s/NETMASK=".*"/NETMASK=\"255.255.255.255\"/" ${CFGFILE} + fi + + # Starting the network + /etc/init.d/network.sh + + # Add default route + /sbin/route add default ${VENET_DEV} +} + +add_ip + +exit 0 diff -r 9e1674525e2f -r daa2159acc30 vzctl/stuff/slitaz-del_ip.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/stuff/slitaz-del_ip.sh Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,39 @@ +#!/bin/bash +# Deletes IP address from a container running SliTaz distro. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Copyright (C) 2011 Eric Joseph-Alexandre + + +VENET_DEV=eth0 +CFGFILE=/etc/network.conf + +# Function to delete IP address +function del_ip() +{ + if grep -q ${IP_ADDR} ${CFGFILE}; then + sed -i 's/^IP.*/IP=\"0\"/' ${CFGFILE} + fi + + # Shutting down $VENET_DEV if CT is running. + if [ "$VE_STATE" = "running" ]; then + /sbin/ifconfig ${VENET_DEV} down + fi +} + +del_ip + +exit 0 diff -r 9e1674525e2f -r daa2159acc30 vzctl/stuff/slitaz-set_hostname.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/stuff/slitaz-set_hostname.sh Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (C) 2000-2009, Parallels, Inc. All rights reserved. +# Copyright (C) 2011 Eric Joseph-Alexandre +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Sets up hostname in a container running slitaz-like distro. + +function set_hostname() +{ + local cfgfile="$1" + local hostname=$2 + + [ -z "${hostname}" ] && return 0 + + hostname=${hostname%%.*} + + echo "${hostname}" > ${cfgfile} + + hostname ${hostname} +} + +change_hostname /etc/hosts "${HOSTNM}" "${IP_ADDR}" +set_hostname /etc/hostname "${HOSTNM}" + +exit 0 diff -r 9e1674525e2f -r daa2159acc30 vzctl/stuff/slitaz.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/stuff/slitaz.conf Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,23 @@ +# Copyright (C) 2000-2008, Parallels, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +ADD_IP=slitaz-add_ip.sh +DEL_IP=slitaz-del_ip.sh +SET_HOSTNAME=slitaz-set_hostname.sh +SET_DNS=set_dns.sh +SET_USERPASS=set_userpass.sh +SET_UGID_QUOTA=set_ugid_quota.sh +POST_CREATE=postcreate.sh diff -r 9e1674525e2f -r daa2159acc30 vzctl/stuff/vzctl-3.0.23-Makefile.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/stuff/vzctl-3.0.23-Makefile.u Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,70 @@ +--- vzctl-3.0.23-ori/Makefile.am Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/Makefile.am Mon Nov 16 16:32:40 2009 +@@ -49,7 +49,8 @@ + install-redhat \ + install-gentoo \ + install-suse \ +- install-debian ++ install-debian \ ++ install-slitaz + + $(DISTRO_TARGETS): + $(MAKE) $(AM_MAKEFLAGS) -C etc $@ +--- vzctl-3.0.23-ori/Makefile.in Thu Oct 30 14:24:52 2008 ++++ vzctl-3.0.23/Makefile.in Mon Nov 16 16:33:11 2009 +@@ -217,7 +217,8 @@ + install-redhat \ + install-gentoo \ + install-suse \ +- install-debian ++ install-debian \ ++ install-slitaz + + all: all-recursive + +--- vzctl-3.0.23-ori/etc/Makefile.am Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/etc/Makefile.am Mon Nov 16 16:33:39 2009 +@@ -43,6 +43,9 @@ + + install-debian: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ ++ ++install-slitaz: ++ $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + + install-gentoo: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ +--- vzctl-3.0.23-ori/etc/Makefile.in Thu Oct 30 14:24:49 2008 ++++ vzctl-3.0.23/etc/Makefile.in Mon Nov 16 16:34:00 2009 +@@ -563,6 +563,9 @@ + install-debian: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + ++install-slitaz: ++ $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ ++ + install-gentoo: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/conf.d +--- vzctl-3.0.23-ori/etc/init.d/Makefile.am Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/etc/init.d/Makefile.am Mon Nov 16 16:34:25 2009 +@@ -31,6 +31,8 @@ + + install-debian: install-redhat + ++install-slitaz: install-redhat ++ + install-gentoo: vz-gentoo + $(mkinstalldirs) $(DESTDIR)$(initddir) + $(INSTALL_SCRIPT) vz-gentoo $(DESTDIR)$(initddir)/vz +--- vzctl-3.0.23-ori/etc/init.d/Makefile.in Thu Oct 30 14:24:50 2008 ++++ vzctl-3.0.23/etc/init.d/Makefile.in Mon Nov 16 16:34:40 2009 +@@ -404,6 +404,8 @@ + + install-debian: install-redhat + ++install-slitaz: install-redhat ++ + install-gentoo: vz-gentoo + $(mkinstalldirs) $(DESTDIR)$(initddir) + $(INSTALL_SCRIPT) vz-gentoo $(DESTDIR)$(initddir)/vz diff -r 9e1674525e2f -r daa2159acc30 vzctl/stuff/vzctl-3.0.23.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/stuff/vzctl-3.0.23.u Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,102 @@ +--- vzctl-3.0.23-ori/Makefile.am Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/Makefile.am Mon Nov 16 21:43:03 2009 +@@ -49,7 +49,8 @@ + install-redhat \ + install-gentoo \ + install-suse \ +- install-debian ++ install-debian \ ++ install-slitaz + + $(DISTRO_TARGETS): + $(MAKE) $(AM_MAKEFLAGS) -C etc $@ +--- vzctl-3.0.23-ori/Makefile.in Thu Oct 30 14:24:52 2008 ++++ vzctl-3.0.23/Makefile.in Mon Nov 16 21:43:03 2009 +@@ -217,7 +217,8 @@ + install-redhat \ + install-gentoo \ + install-suse \ +- install-debian ++ install-debian \ ++ install-slitaz + + all: all-recursive + +--- vzctl-3.0.23-ori/etc/Makefile.am Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/etc/Makefile.am Mon Nov 16 21:43:03 2009 +@@ -43,6 +43,9 @@ + + install-debian: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ ++ ++install-slitaz: ++ $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + + install-gentoo: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ +--- vzctl-3.0.23-ori/etc/Makefile.in Thu Oct 30 14:24:49 2008 ++++ vzctl-3.0.23/etc/Makefile.in Mon Nov 16 21:43:03 2009 +@@ -563,6 +563,9 @@ + install-debian: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + ++install-slitaz: ++ $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ ++ + install-gentoo: + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/conf.d +--- vzctl-3.0.23-ori/etc/init.d/Makefile.am Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/etc/init.d/Makefile.am Mon Nov 16 21:46:42 2009 +@@ -31,6 +31,11 @@ + + install-debian: install-redhat + ++install-slitaz: ++ $(mkinstalldirs) $(DESTDIR)$(initddir) ++ $(INSTALL_SCRIPT) vz-redhat $(DESTDIR)$(initddir)/vz ++ sed -e 's!/subsys!!' ++ + install-gentoo: vz-gentoo + $(mkinstalldirs) $(DESTDIR)$(initddir) + $(INSTALL_SCRIPT) vz-gentoo $(DESTDIR)$(initddir)/vz +--- vzctl-3.0.23-ori/etc/init.d/Makefile.in Thu Oct 30 14:24:50 2008 ++++ vzctl-3.0.23/etc/init.d/Makefile.in Mon Nov 16 22:12:15 2009 +@@ -404,6 +404,11 @@ + + install-debian: install-redhat + ++install-slitaz: install-redhat ++ sed -i -e 's!/subsys!!' $(DESTDIR)$(initddir)/vz ++ sed -i -e 's/sysctl -q/sysctl -n/' $(DESTDIR)$(initddir)/vz ++ ++ + install-gentoo: vz-gentoo + $(mkinstalldirs) $(DESTDIR)$(initddir) + $(INSTALL_SCRIPT) vz-gentoo $(DESTDIR)$(initddir)/vz +--- vzctl-3.0.23-ori/scripts/vps-create.in Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/scripts/vps-create.in Mon Nov 16 22:26:20 2009 +@@ -37,7 +37,7 @@ + vzerror "Tarball does not exist: $PRIVATE_TEMPLATE" ${VZ_FS_NEW_VE_PRVT} + HEADER="$(od -A n -N 2 -t x1 -- "$PRIVATE_TEMPLATE")" || + vzerror "Invalid tarball: $PRIVATE_TEMPLATE" ${VZ_FS_NEW_VE_PRVT} +- TMP="$(df -P "$VE_PRVT")" || ++ TMP="$(df "$VE_PRVT")" || + vzerror "Failed to calculate available disk space on $VE_PRVT" ${VZ_FS_NEW_VE_PRVT} + AVAIL="$(echo "$TMP" | awk 'END{print $4}')" + if [ "$HEADER" = ' 1f 8b' ]; then +--- vzctl-3.0.23-ori/scripts/vps-functions.in Thu Oct 30 14:24:43 2008 ++++ vzctl-3.0.23/scripts/vps-functions.in Mon Nov 16 22:25:52 2009 +@@ -126,10 +126,10 @@ + + route="$(${IP_CMD} route get "$1" |grep ' dev .* src ')" + # match: $1 ... dev $dev ... +- dev="$(echo "$route" |sed -ne '/ via /! s/^.* dev \+\([^ ]\+\) .*$/\1/p;Q')" ++ dev="$(echo "$route" |sed -ne '/ via /! s/^.* dev \+\([^ ]\+\) .*$/\1/p;q')" + [ -n "$dev" ] || + # match: $1 ... via $1 ... dev $dev ... +- dev="$(echo "$route" |sed -ne 's/^\([^ ]\+\) \(.* \)\?via \+\1 \(.* \)\?dev \+\([^ ]\+\) .*$/\4/p;Q')" ++ dev="$(echo "$route" |sed -ne 's/^\([^ ]\+\) \(.* \)\?via \+\1 \(.* \)\?dev \+\([^ ]\+\) .*$/\4/p;q')" + [ -n "$dev" ] || return 0 + + for netdev in $NETDEVICES; do diff -r 9e1674525e2f -r daa2159acc30 vzctl/stuff/vzctl-3.0.25.1-Makefile.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vzctl/stuff/vzctl-3.0.25.1-Makefile.u Fri Jan 21 00:56:18 2011 +0100 @@ -0,0 +1,133 @@ +--- vzctl-3.0.25.1-ori/Makefile.am Fri Dec 24 12:45:32 2010 ++++ vzctl-3.0.25.1/Makefile.am Fri Dec 31 09:27:42 2010 +@@ -49,7 +49,8 @@ + install-redhat \ + install-gentoo \ + install-suse \ +- install-debian ++ install-debian\ ++ install-slitaz + + DISTRO_TARGETS_ALL = \ + $(DISTRO_TARGETS) \ +--- vzctl-3.0.25.1-ori/Makefile.in Fri Dec 24 12:45:44 2010 ++++ vzctl-3.0.25.1/Makefile.in Fri Dec 31 09:27:42 2010 +@@ -266,7 +266,8 @@ + install-redhat \ + install-gentoo \ + install-suse \ +- install-debian ++ install-debian \ ++ install-slitaz + + DISTRO_TARGETS_ALL = \ + $(DISTRO_TARGETS) \ +--- vzctl-3.0.25.1-ori/bin/Makefile.am Fri Dec 24 12:45:38 2010 ++++ vzctl-3.0.25.1/bin/Makefile.am Fri Dec 31 09:35:38 2010 +@@ -57,6 +57,8 @@ + + install-debian: + ++install-slitaz: ++ + install-gentoo: + @echo + @echo "***************************************************" +--- vzctl-3.0.25.1-ori/bin/Makefile.in Fri Dec 24 12:45:43 2010 ++++ vzctl-3.0.25.1/bin/Makefile.in Fri Dec 31 09:35:39 2010 +@@ -530,6 +530,8 @@ + + install-debian: + ++install-slitaz: ++ + install-gentoo: + @echo + @echo "***************************************************" +--- vzctl-3.0.25.1-ori/etc/Makefile.am Fri Dec 24 12:45:34 2010 ++++ vzctl-3.0.25.1/etc/Makefile.am Fri Dec 31 09:27:42 2010 +@@ -50,3 +50,6 @@ + $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/conf.d + $(LN_S) $(pkgconfdir)/vz.conf $(DESTDIR)$(sysconfdir)/conf.d/vz ++ ++install-slitaz: ++ $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ +--- vzctl-3.0.25.1-ori/etc/Makefile.in Fri Dec 24 12:45:43 2010 ++++ vzctl-3.0.25.1/etc/Makefile.in Fri Dec 31 09:27:42 2010 +@@ -683,6 +683,10 @@ + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/conf.d + $(LN_S) $(pkgconfdir)/vz.conf $(DESTDIR)$(sysconfdir)/conf.d/vz + ++install-slitaz: ++ $(MAKE) $(AM_MAKEFLAGS) -C init.d $@ ++ ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: +--- vzctl-3.0.25.1-ori/etc/init.d/Makefile.am Fri Dec 24 12:45:34 2010 ++++ vzctl-3.0.25.1/etc/init.d/Makefile.am Fri Dec 31 09:27:42 2010 +@@ -33,6 +33,8 @@ + + install-debian: install-redhat + ++install-slitaz: install-redhat ++ + install-gentoo: vz-gentoo vzeventd-gentoo + $(mkinstalldirs) $(DESTDIR)$(initddir) + $(INSTALL_SCRIPT) vz-gentoo $(DESTDIR)$(initddir)/vz +--- vzctl-3.0.25.1-ori/etc/init.d/Makefile.in Fri Dec 24 12:45:43 2010 ++++ vzctl-3.0.25.1/etc/init.d/Makefile.in Fri Dec 31 09:27:40 2010 +@@ -492,6 +492,8 @@ + + install-debian: install-redhat + ++install-slitaz: install-redhat ++ + install-gentoo: vz-gentoo vzeventd-gentoo + $(mkinstalldirs) $(DESTDIR)$(initddir) + $(INSTALL_SCRIPT) vz-gentoo $(DESTDIR)$(initddir)/vz +--- vzctl-3.0.25.1-ori/etc/init.d/initd-functions.in Fri Dec 24 12:45:35 2010 ++++ vzctl-3.0.25.1/etc/init.d/initd-functions.in Sun Jan 2 14:29:21 2011 +@@ -28,6 +28,9 @@ + elif [ -r /etc/debian_version ]; then + DISTR=debian + VARLOCK=/var/lock ++elif [ -r /etc/slitaz-release ]; then ++ DISTR=slitaz ++ VARLOCK=/var/lock + fi + + print_success() +--- vzctl-3.0.25.1-ori/etc/init.d/vz-redhat.in Fri Dec 24 12:45:35 2010 ++++ vzctl-3.0.25.1/etc/init.d/vz-redhat.in Fri Dec 31 14:50:22 2010 +@@ -189,7 +189,7 @@ + if [ "${IPV6}" = "yes" ]; then + ip -6 addr add fe80::1/128 dev $VZDEV + fi +- sysctl -q -w net.ipv4.conf.$VZDEV.send_redirects=0 ++ sysctl -w net.ipv4.conf.$VZDEV.send_redirects=0 + if [ "$(sysctl -n -e net.ipv4.ip_forward)" != "1" ]; then + print_warning "IP forwarding is not enabled" + fi +@@ -242,7 +242,7 @@ + need_restart="" + velist=$(vzlist -aH -octid,onboot -s-bootorder | + awk '$2 == "yes" {print $1}') +- sysctl -q -w net.ipv4.route.src_check=0 ++ sysctl -w net.ipv4.route.src_check=0 + for veid in $velist; do + [ "${veid}" = "0" ] && continue + __echo "Starting CT ${veid}: " +--- vzctl-3.0.25.1-ori/scripts/vps-create.in Fri Dec 24 12:45:37 2010 ++++ vzctl-3.0.25.1/scripts/vps-create.in Fri Dec 31 14:53:35 2010 +@@ -38,7 +38,7 @@ + vzerror "Tarball does not exist: $PRIVATE_TEMPLATE" ${VZ_FS_NEW_VE_PRVT} + HEADER="$(od -A n -N 2 -t x1 -- "$PRIVATE_TEMPLATE")" || + vzerror "Invalid tarball: $PRIVATE_TEMPLATE" ${VZ_FS_NEW_VE_PRVT} +- TMP="$(df -P "$VE_PRVT")" || ++ TMP="$(df "$VE_PRVT")" || + vzerror "Failed to calculate available disk space on $VE_PRVT" ${VZ_FS_NEW_VE_PRVT} + AVAIL="$(echo "$TMP" | awk 'END{print $4}')" + if [ "$HEADER" = ' 1f 8b' ]; then