From f10e04e36170dbd0faae3a667d53f0af1ef6a13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 15 Oct 2013 11:17:55 -0400 Subject: [PATCH] Make 'make dist' match git content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a few obvious issues when comparing the make dist output with the git tree. - Make all templates non-executable in git - Remove unused files: - src/lxc/list.c (empty, only includes the list.h header) - src/lxc/lxc-destroy.in (replace by lxc_destroy.c) - Add missing files to dist tarball: - src/python-lxc/examples/pyconsole.py - src/python-lxc/examples/pyconsole-vte.py - Mark all the python API tests executable - Mark lxc-test-ubuntu executable Signed-off-by: Stéphane Graber Signed-off-by: Serge Hallyn --- src/lxc/list.c | 23 ---- src/lxc/lxc-destroy.in | 195 ---------------------------- src/python-lxc/Makefile.am | 4 +- src/python-lxc/examples/api_test.py | 0 src/tests/lxc-test-ubuntu | 0 templates/lxc-openmandriva.in | 0 6 files changed, 3 insertions(+), 219 deletions(-) delete mode 100644 src/lxc/list.c delete mode 100644 src/lxc/lxc-destroy.in mode change 100644 => 100755 src/python-lxc/examples/api_test.py mode change 100644 => 100755 src/tests/lxc-test-ubuntu mode change 100755 => 100644 templates/lxc-openmandriva.in diff --git a/src/lxc/list.c b/src/lxc/list.c deleted file mode 100644 index 14596c897..000000000 --- a/src/lxc/list.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in deleted file mode 100644 index bca5264aa..000000000 --- a/src/lxc/lxc-destroy.in +++ /dev/null @@ -1,195 +0,0 @@ -#!/bin/sh - -# -# lxc: linux Container library - -# Authors: -# Daniel Lezcano - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. - -# This library 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 -# Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# -# This script allows to set or remove the capabilities on the lxc tools. -# When the capabilities are set, a non root user can manage the containers. -# - -usage() { - echo "usage: $(basename $0) -n NAME [-f] [-P lxcpath]" >&2 -} - -help() { - usage - echo >&2 - echo "Remove an existing container on the system." >&2 - echo >&2 - echo "Options:" >&2 - echo " -n NAME specify the name of the container" >&2 - echo " -f stop the container if it is running (rather than abort)" >&2 - echo " -P lxcpath container is in specified lxcpath" >&2 -} - -. @DATADIR@/lxc/lxc.functions - -usage_err() { - [ -n "$1" ] && echo "$1" >&2 - usage - exit 1 -} - -verify_zfs() { - local path=$1 - which zfs > /dev/null 2>&1 || { echo no; return; } - if zfs list -H $path >/dev/null 2>&1; then - echo zfs - else - echo no - fi -} - -busy_zfs() { - local path=$1 - local dev - dev=`zfs list -H $path 2>/dev/null | awk '{ print $1 }'` - if zfs list -t snapshot | grep -q "$dev"; then - echo busy - else - echo zfs - fi -} - -verify_lvm() { - local path=$1 - if [ -b $path -o -h $path ]; then - lvdisplay $path > /dev/null 2>&1 && { echo lvm; return; } - fi - echo no -} - -busy_lvm() { - local path=$1 - lvdisplay $path | grep -q "LV snapshot status.*source of" && { echo busy; return; } - echo lvm -} - -optarg_check() { - if [ -z "$2" ]; then - usage_err "option '$1' requires an argument" - fi -} - -force=0 - -while [ $# -gt 0 ]; do - opt="$1" - shift - case "$opt" in - -h|--help) - help - exit 1 - ;; - -n|--name) - optarg_check "$opt" "$1" - lxc_name=$1 - shift - ;; - -P|--lxcpath) - optarg_check "$opt" "$1" - lxc_path=$1 - shift - ;; - -f) - force=1 - ;; - --) - break - ;; - -?) - usage_err "unknown option '$opt'" - ;; - -*) - # split opts -abc into -a -b -c - set -- $(echo "${opt#-}" | sed 's/\(.\)/ -\1/g') "$@" - ;; - *) - usage - exit 1 - ;; - esac -done - -if [ -z "$lxc_name" ]; then - echo "$(basename $0): no container name specified" >&2 - usage $0 - exit 1 -fi - -if [ "$(id -u)" != "0" ]; then - echo "$(basename $0): must be run as root" >&2 - exit 1 -fi - -if [ ! -d "$lxc_path/$lxc_name" ]; then - echo "$(basename $0): '$lxc_name' does not exist" >&2 - exit 1 -fi - -# make sure the container is stopped -if ! lxc-info -n $lxc_name -P $lxc_path --state-is "STOPPED"; then - if [ $force -eq 1 ]; then - lxc-stop -P $lxc_path -n $lxc_name - lxc-wait -P $lxc_path -n $lxc_name -s STOPPED - else - echo "$(basename $0): '$lxc_name' $(lxc-info -P $lxc_path -n $lxc_name -s); aborted" >&2 - exit 1 - fi -fi - -# Deduce the type of rootfs -# If LVM partition, destroy it. For btrfs, we delete the subvolume. If anything -# else, ignore it. We'll support deletion of others later. -rootdev=`grep '^\s*lxc\.rootfs' $lxc_path/$lxc_name/config 2>/dev/null | sed -e 's/^[^/]*//'` -if [ -n "$rootdev" ]; then - if [ `verify_lvm $rootdev` = "lvm" ]; then - if [ `busy_lvm $rootdev` = "busy" ]; then - echo "$rootdev has lvm snapshots - not deleting" - exit 1 - else - echo "removing backing store: $rootdev" - lvremove -f $rootdev - fi - elif [ `verify_zfs $rootdev` = "zfs" ]; then - if [ `busy_zfs $rootdev` = "busy" ]; then - echo "$rootdev has zfs snapshots - not deleting" - exit 1 - else - zfs destroy $(zfs list | grep $rootdev | awk '{ print $1 }') - if [ $? -ne 0 ]; then - echo "zfs destroy failed - please wait a bit and try again" - exit 1 - fi - fi - elif [ -h "$rootdev" -o -d "$rootdev" ]; then - if which btrfs >/dev/null 2>&1 && - btrfs subvolume list "$rootdev" >/dev/null 2>&1; then - btrfs subvolume delete "$rootdev" - else - # In case rootfs is not under $lxc_path/$lxc_name, remove it - rm -rf --one-file-system --preserve-root $rootdev - fi - fi -fi - -# recursively remove the container to remove old container configuration -rm -rf --one-file-system --preserve-root $lxc_path/$lxc_name diff --git a/src/python-lxc/Makefile.am b/src/python-lxc/Makefile.am index f81dbff53..b1c10b54f 100644 --- a/src/python-lxc/Makefile.am +++ b/src/python-lxc/Makefile.am @@ -24,4 +24,6 @@ EXTRA_DIST = \ setup.py \ lxc.c \ lxc/__init__.py \ - examples/api_test.py + examples/api_test.py \ + examples/pyconsole.py \ + examples/pyconsole-vte.py diff --git a/src/python-lxc/examples/api_test.py b/src/python-lxc/examples/api_test.py old mode 100644 new mode 100755 diff --git a/src/tests/lxc-test-ubuntu b/src/tests/lxc-test-ubuntu old mode 100644 new mode 100755 diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in old mode 100755 new mode 100644