Update to 1.0.3.
- Remove obsolete patches. - Add systemd support. - Lua bindings are not optional (needed e.g. for lxc-top).
This commit is contained in:
parent
8b406eb2da
commit
de0c86a03d
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ lxc-0.7.2.tar.gz
|
|||||||
/lxc-0.7.5.tar.gz
|
/lxc-0.7.5.tar.gz
|
||||||
/lxc-0.8.0.tar.gz
|
/lxc-0.8.0.tar.gz
|
||||||
/lxc-0.9.0.tar.gz
|
/lxc-0.9.0.tar.gz
|
||||||
|
/lxc-1.0.3.tar.gz
|
||||||
|
@ -1,385 +0,0 @@
|
|||||||
diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
|
|
||||||
index 684bb9c..922563d 100644
|
|
||||||
--- a/templates/lxc-fedora.in
|
|
||||||
+++ b/templates/lxc-fedora.in
|
|
||||||
@@ -26,18 +26,69 @@
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
#Configurations
|
|
||||||
-arch=$(arch)
|
|
||||||
+arch=$(uname -m)
|
|
||||||
cache_base=@LOCALSTATEDIR@/cache/lxc/fedora/$arch
|
|
||||||
default_path=@LXCPATH@
|
|
||||||
root_password=root
|
|
||||||
|
|
||||||
# is this fedora?
|
|
||||||
-[ -f /etc/fedora-release ] && is_fedora=true
|
|
||||||
+# Alow for weird remixes like the Raspberry Pi
|
|
||||||
+#
|
|
||||||
+# Use the Mitre standard CPE identifier for the release ID if possible...
|
|
||||||
+# This may be in /etc/os-release or /etc/system-release-cpe. We
|
|
||||||
+# should be able to use EITHER. Give preference to /etc/os-release for now.
|
|
||||||
+
|
|
||||||
+if [ -e /etc/os-release ]
|
|
||||||
+then
|
|
||||||
+# This is a shell friendly configuration file. We can just source it.
|
|
||||||
+# What we're looking for in here is the ID, VERSION_ID and the CPE_NAME
|
|
||||||
+ . /etc/os-release
|
|
||||||
+ echo "Host CPE ID from /etc/os-release: ${CPE_NAME}"
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if [ "${CPE_NAME}" = "" -a -e /etc/system-release-cpe ]
|
|
||||||
+then
|
|
||||||
+ CPE_NAME=$(head -n1 /etc/system-release-cpe)
|
|
||||||
+ CPE_URI=$(expr ${CPE_NAME} : '\([^:]*:[^:*]\)')
|
|
||||||
+ if [ "${CPE_URI}" != "cpe:/o" ]
|
|
||||||
+ then
|
|
||||||
+ CPE_NAME=
|
|
||||||
+ else
|
|
||||||
+ echo "Host CPE ID from /etc/system-release-cpe: ${CPE_NAME}"
|
|
||||||
+ # Probably a better way to do this but sill remain posix
|
|
||||||
+ # compatible but this works, shrug...
|
|
||||||
+ # Must be nice and not introduce convenient bashisms here.
|
|
||||||
+ ID=$(expr ${CPE_NAME} : '[^:]*:[^:]*:[^:]*:\([^:]*\)')
|
|
||||||
+ VERSION_ID=$(expr ${CPE_NAME} : '[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\)')
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
|
|
||||||
-if [ "$arch" = "i686" ]; then
|
|
||||||
- arch=i386
|
|
||||||
+if [ "${CPE_NAME}" != "" -a "${ID}" = "fedora" -a "${VERSION_ID}" != "" ]
|
|
||||||
+then
|
|
||||||
+ fedora_host_ver=${VERSION_ID}
|
|
||||||
+ is_fedora=true
|
|
||||||
+elif [ -e /etc/redhat-release ]
|
|
||||||
+then
|
|
||||||
+ # Only if all other methods fail, try to parse the redhat-release file.
|
|
||||||
+ fedora_host_ver=$( sed -e '/^Fedora /!d' -e 's/Fedora.*\srelease\s*\([0-9][0-9]*\)\s.*/\1/' < /etc/redhat-release )
|
|
||||||
+ if [ "$fedora_host_ver" != "" ]
|
|
||||||
+ then
|
|
||||||
+ is_fedora=true
|
|
||||||
+ fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
+# Map a few architectures to their generic Fedora repository archs.
|
|
||||||
+# The two ARM archs are a bit of a guesstimate for the v5 and v6
|
|
||||||
+# archs. V6 should have hardware floating point (Rasberry Pi).
|
|
||||||
+# The "arm" arch is safer (no hardware floating point). So
|
|
||||||
+# there may be cases where we "get it wrong" for some v6 other
|
|
||||||
+# than RPi.
|
|
||||||
+case "$arch" in
|
|
||||||
+i686) arch=i386 ;;
|
|
||||||
+armv3l|armv4l|armv5l) arch=arm ;;
|
|
||||||
+armv6l|armv7l|armv8l) arch=armhfp ;;
|
|
||||||
+esac
|
|
||||||
+
|
|
||||||
configure_fedora()
|
|
||||||
{
|
|
||||||
|
|
||||||
@@ -50,7 +101,7 @@ configure_fedora()
|
|
||||||
DEVICE=eth0
|
|
||||||
BOOTPROTO=dhcp
|
|
||||||
ONBOOT=yes
|
|
||||||
-HOSTNAME=${name}
|
|
||||||
+HOSTNAME=${utsname}
|
|
||||||
NM_CONTROLLED=no
|
|
||||||
TYPE=Ethernet
|
|
||||||
MTU=${MTU}
|
|
||||||
@@ -59,12 +110,18 @@ EOF
|
|
||||||
# set the hostname
|
|
||||||
cat <<EOF > ${rootfs_path}/etc/sysconfig/network
|
|
||||||
NETWORKING=yes
|
|
||||||
-HOSTNAME=${name}
|
|
||||||
+HOSTNAME=${utsname}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
+ # set hostname on systemd Fedora systems
|
|
||||||
+ if [ $release -gt 14 ]; then
|
|
||||||
+ echo "${utsname}" > ${rootfs_path}/etc/hostname
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
# set minimal hosts
|
|
||||||
cat <<EOF > $rootfs_path/etc/hosts
|
|
||||||
-127.0.0.1 localhost $name
|
|
||||||
+127.0.0.1 localhost.localdomain localhost $utsname
|
|
||||||
+::1 localhost6.localdomain6 localhost6
|
|
||||||
EOF
|
|
||||||
|
|
||||||
dev_path="${rootfs_path}/dev"
|
|
||||||
@@ -118,10 +175,27 @@ configure_fedora_systemd()
|
|
||||||
{
|
|
||||||
unlink ${rootfs_path}/etc/systemd/system/default.target
|
|
||||||
touch ${rootfs_path}/etc/fstab
|
|
||||||
- chroot ${rootfs_path} ln -s /dev/null //etc/systemd/system/udev.service
|
|
||||||
+ chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/udev.service
|
|
||||||
chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
|
|
||||||
#dependency on a device unit fails it specially that we disabled udev
|
|
||||||
- sed -i 's/After=dev-%i.device/After=/' ${rootfs_path}/lib/systemd/system/getty\@.service
|
|
||||||
+ # sed -i 's/After=dev-%i.device/After=/' ${rootfs_path}/lib/systemd/system/getty\@.service
|
|
||||||
+ #
|
|
||||||
+ # Actually, the After=dev-%i.device line does not appear in the
|
|
||||||
+ # Fedora 17 or Fedora 18 systemd getty\@.service file. It may be left
|
|
||||||
+ # over from an earlier version and it's not doing any harm. We do need
|
|
||||||
+ # to disable the "ConditionalPathExists=/dev/tty0" line or no gettys are
|
|
||||||
+ # started on the ttys in the container. Lets do it in an override copy of
|
|
||||||
+ # the service so it can still pass rpm verifies and not be automatically
|
|
||||||
+ # updated by a new systemd version. -- mhw /\/\|=mhw=|\/\/
|
|
||||||
+
|
|
||||||
+ sed -e 's/^ConditionPathExists=/# ConditionPathExists=/' \
|
|
||||||
+ -e 's/After=dev-%i.device/After=/' \
|
|
||||||
+ < ${rootfs_path}/lib/systemd/system/getty\@.service \
|
|
||||||
+ > ${rootfs_path}/etc/systemd/system/getty\@.service
|
|
||||||
+ # Setup getty service on the 4 ttys we are going to allow in the
|
|
||||||
+ # default config. Number should match lxc.tty
|
|
||||||
+ ( cd ${rootfs_path}/etc/systemd/system/getty.target.wants
|
|
||||||
+ for i in 1 2 3 4 ; do ln -sf ../getty\@.service getty@tty${i}.service; done )
|
|
||||||
}
|
|
||||||
|
|
||||||
download_fedora()
|
|
||||||
@@ -142,27 +216,53 @@ download_fedora()
|
|
||||||
MIRRORLIST_URL="http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$release&arch=$arch"
|
|
||||||
|
|
||||||
DOWNLOAD_OK=no
|
|
||||||
- for trynumber in 1 2 3; do
|
|
||||||
+
|
|
||||||
+ # We're splitting the old loop into two loops plus a directory retrival.
|
|
||||||
+ # First loop... Try and retrive a mirror list with retries and a slight
|
|
||||||
+ # delay between attempts...
|
|
||||||
+ for trynumber in 1 2 3 4; do
|
|
||||||
[ $trynumber != 1 ] && echo "Trying again..."
|
|
||||||
- MIRROR_URL=$(curl -s -S -f "$MIRRORLIST_URL" | head -n2 | tail -n1)
|
|
||||||
- if [ $? -ne 0 ] || [ -z "$MIRROR_URL" ]; then
|
|
||||||
- echo "Failed to get a mirror"
|
|
||||||
- continue
|
|
||||||
- fi
|
|
||||||
+ # This code is mildly "brittle" in that it assumes a certain
|
|
||||||
+ # page format and parsing HTML. I've done worse. :-P
|
|
||||||
+ MIRROR_URLS=$(curl -s -S -f "$MIRRORLIST_URL" | sed -e '/^http:/!d' -e '2,6!d')
|
|
||||||
+ if [ $? -eq 0 ] && [ -n "$MIRROR_URLS" ]
|
|
||||||
+ then
|
|
||||||
+ break
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ echo "Failed to get a mirror on try $trynumber"
|
|
||||||
+ sleep 3
|
|
||||||
+ done
|
|
||||||
+
|
|
||||||
+ # This will fall through if we didn't get any URLS above
|
|
||||||
+ for MIRROR_URL in ${MIRROR_URLS}
|
|
||||||
+ do
|
|
||||||
if [ "$release" -gt "16" ]; then
|
|
||||||
- RELEASE_URL="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm"
|
|
||||||
+ RELEASE_URL="$MIRROR_URL/Packages/f"
|
|
||||||
else
|
|
||||||
- RELEASE_URL="$MIRROR_URL/Packages/fedora-release-$release-1.noarch.rpm"
|
|
||||||
+ RELEASE_URL="$MIRROR_URL/Packages/"
|
|
||||||
fi
|
|
||||||
- echo "Fetching from $RELEASE_URL"
|
|
||||||
- curl -f "$RELEASE_URL" > $INSTALL_ROOT/fedora-release-$release.noarch.rpm
|
|
||||||
+
|
|
||||||
+ echo "Fetching rpm name from $RELEASE_URL..."
|
|
||||||
+ # This code is mildly "brittle" in that it assumes a certain directory
|
|
||||||
+ # page format and parsing HTML. I've done worse. :-P
|
|
||||||
+ RELEASE_RPM=$(curl -L -f "$RELEASE_URL" | sed -e "/fedora-release-${release}-/!d" -e 's/.*<a href=\"//' -e 's/\">.*//' )
|
|
||||||
+ if [ $? -ne 0 -o "${RELEASE_RPM}" = "" ]; then
|
|
||||||
+ echo "Failed to identify fedora release rpm."
|
|
||||||
+ continue
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ echo "Fetching fedora release rpm from ${RELEASE_URL}/${RELEASE_RPM}......"
|
|
||||||
+ curl -L -f "${RELEASE_URL}/${RELEASE_RPM}" > ${INSTALL_ROOT}/${RELEASE_RPM}
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
- echo "Failed to download fedora release rpm"
|
|
||||||
+ echo "Failed to download fedora release rpm ${RELEASE_RPM}."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
+
|
|
||||||
DOWNLOAD_OK=yes
|
|
||||||
break
|
|
||||||
done
|
|
||||||
+
|
|
||||||
if [ $DOWNLOAD_OK != yes ]; then
|
|
||||||
echo "Aborting"
|
|
||||||
return 1
|
|
||||||
@@ -170,7 +270,7 @@ download_fedora()
|
|
||||||
|
|
||||||
mkdir -p $INSTALL_ROOT/var/lib/rpm
|
|
||||||
rpm --root $INSTALL_ROOT --initdb
|
|
||||||
- rpm --root $INSTALL_ROOT -ivh $INSTALL_ROOT/fedora-release-$release.noarch.rpm
|
|
||||||
+ rpm --root $INSTALL_ROOT -ivh ${INSTALL_ROOT}/${RELEASE_RPM}
|
|
||||||
$YUM install $PKG_LIST
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
@@ -248,10 +348,13 @@ copy_configuration()
|
|
||||||
mkdir -p $config_path
|
|
||||||
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
|
|
||||||
cat <<EOF >> $config_path/config
|
|
||||||
-lxc.utsname = $name
|
|
||||||
+lxc.utsname = $utsname
|
|
||||||
lxc.tty = 4
|
|
||||||
lxc.pts = 1024
|
|
||||||
lxc.mount = $config_path/fstab
|
|
||||||
+lxc.cap.drop = sys_module mac_admin mac_override sys_time
|
|
||||||
+
|
|
||||||
+lxc.autodev = $auto_dev
|
|
||||||
|
|
||||||
# When using LXC with apparmor, uncomment the next line to run unconfined:
|
|
||||||
#lxc.aa_profile = unconfined
|
|
||||||
@@ -272,7 +375,7 @@ lxc.cgroup.devices.allow = c 1:8 rwm
|
|
||||||
lxc.cgroup.devices.allow = c 136:* rwm
|
|
||||||
lxc.cgroup.devices.allow = c 5:2 rwm
|
|
||||||
# rtc
|
|
||||||
-lxc.cgroup.devices.allow = c 254:0 rwm
|
|
||||||
+lxc.cgroup.devices.allow = c 254:0 rm
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF > $config_path/fstab
|
|
||||||
@@ -313,21 +416,23 @@ usage()
|
|
||||||
cat <<EOF
|
|
||||||
usage:
|
|
||||||
$1 -n|--name=<container_name>
|
|
||||||
- [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>] [-A|--arch=<arch of the container>]
|
|
||||||
+ [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>] [--fqdn=<network name of container>] [-A|--arch=<arch of the container>]
|
|
||||||
[-h|--help]
|
|
||||||
Mandatory args:
|
|
||||||
-n,--name container name, used to as an identifier for that container from now on
|
|
||||||
Optional args:
|
|
||||||
- -p,--path path to where the container rootfs will be created, defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that case
|
|
||||||
+ -p,--path path to where the container will be created, defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that case
|
|
||||||
+ --rootfs path for actual rootfs.
|
|
||||||
-c,--clean clean the cache
|
|
||||||
- -R,--release Fedora release for the new container. if the host is Fedora, then it will defaultto the host's release.
|
|
||||||
+ -R,--release Fedora release for the new container. if the host is Fedora, then it will default to the host's release.
|
|
||||||
+ --fqdn fully qualified domain name (FQDN) for DNS and system naming
|
|
||||||
-A,--arch NOT USED YET. Define what arch the container will be [i686,x86_64]
|
|
||||||
-h,--help print this help
|
|
||||||
EOF
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
-options=$(getopt -o hp:n:cR: -l help,path:,name:,clean,release: -- "$@")
|
|
||||||
+options=$(getopt -o hp:n:cR: -l help,path:,rootfs:,name:,clean,release:,fqdn: -- "$@")
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
usage $(basename $0)
|
|
||||||
exit 1
|
|
||||||
@@ -339,9 +444,11 @@ do
|
|
||||||
case "$1" in
|
|
||||||
-h|--help) usage $0 && exit 0;;
|
|
||||||
-p|--path) path=$2; shift 2;;
|
|
||||||
+ --rootfs) rootfs=$2; shift 2;;
|
|
||||||
-n|--name) name=$2; shift 2;;
|
|
||||||
-c|--clean) clean=$2; shift 2;;
|
|
||||||
-R|--release) release=$2; shift 2;;
|
|
||||||
+ --fqdn) utsname=$2; shift 2;;
|
|
||||||
--) shift 1; break ;;
|
|
||||||
*) break ;;
|
|
||||||
esac
|
|
||||||
@@ -352,6 +459,29 @@ if [ ! -z "$clean" -a -z "$path" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
+if [ -z "${utsname}" ]; then
|
|
||||||
+ utsname=${name}
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+# This follows a standard "resolver" convention that an FQDN must have
|
|
||||||
+# at least two dots or it is considered a local relative host name.
|
|
||||||
+# If it doesn't, append the dns domain name of the host system.
|
|
||||||
+#
|
|
||||||
+# This changes one significant behavior when running
|
|
||||||
+# "lxc_create -n Container_Name" without using the
|
|
||||||
+# --fqdn option.
|
|
||||||
+#
|
|
||||||
+# Old behavior:
|
|
||||||
+# utsname and hostname = Container_Name
|
|
||||||
+# New behavior:
|
|
||||||
+# utsname and hostname = Container_Name.Domain_Name
|
|
||||||
+
|
|
||||||
+if [ $(expr "$utsname" : '.*\..*\.') = 0 ]; then
|
|
||||||
+ if [ -n "$(dnsdomainname)" ]; then
|
|
||||||
+ utsname=${utsname}.$(dnsdomainname)
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
needed_pkgs=""
|
|
||||||
type yum >/dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
@@ -365,33 +495,43 @@ fi
|
|
||||||
|
|
||||||
if [ -n "$needed_pkgs" ]; then
|
|
||||||
echo "Missing commands: $needed_pkgs"
|
|
||||||
- echo "Please install these using \"sudo apt-get install $needed_pkgs\""
|
|
||||||
+ echo "Please install these using \"sudo yum install $needed_pkgs\""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$path" ]; then
|
|
||||||
- path=$default_path
|
|
||||||
+ path=$default_path/$name
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$release" ]; then
|
|
||||||
- if [ "$is_fedora" ]; then
|
|
||||||
- release=$(cat /etc/fedora-release |awk '/^Fedora/ {print $3}')
|
|
||||||
+ if [ "$is_fedora" -a "$fedora_host_ver" ]; then
|
|
||||||
+ release=$fedora_host_ver
|
|
||||||
else
|
|
||||||
- echo "This is not a fedora host and release missing, defaulting to 14. use -R|--release to specify release"
|
|
||||||
- release=14
|
|
||||||
+ echo "This is not a fedora host and release missing, defaulting to 18. use -R|--release to specify release"
|
|
||||||
+ release=18
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
+# Fedora 15 and above run systemd. We need autodev enabled to keep
|
|
||||||
+# systemd from causing problems.
|
|
||||||
+if [ $release -gt 14 ]; then
|
|
||||||
+ auto_dev="1"
|
|
||||||
+else
|
|
||||||
+ auto_dev="0"
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
|
||||||
echo "This script should be run as 'root'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
-rootfs_path=$path/$name/rootfs
|
|
||||||
-# check for 'lxc.rootfs' passed in through default config by lxc-create
|
|
||||||
-if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
|
|
||||||
- rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'`
|
|
||||||
+if [ -z "$rootfs_path" ]; then
|
|
||||||
+ rootfs_path=$path/rootfs
|
|
||||||
+ # check for 'lxc.rootfs' passed in through default config by lxc-create
|
|
||||||
+ if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
|
|
||||||
+ rootfs_path=`grep 'lxc.rootfs =' $path/config | awk -F= '{ print $2 }'`
|
|
||||||
+ fi
|
|
||||||
fi
|
|
||||||
config_path=$default_path/$name
|
|
||||||
cache=$cache_base/$release
|
|
||||||
@@ -427,13 +567,20 @@ if [ $? -ne 0 ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
-type /bin/systemd >/dev/null 2>&1
|
|
||||||
-if [ $? -ne 0 ]; then
|
|
||||||
- configure_fedora_init
|
|
||||||
-else
|
|
||||||
+# If the systemd configuration directory exists - set it up for what we need.
|
|
||||||
+if [ -d ${rootfs_path}/etc/systemd/system ]
|
|
||||||
+then
|
|
||||||
configure_fedora_systemd
|
|
||||||
fi
|
|
||||||
|
|
||||||
+# This configuration (rc.sysinit) is not inconsistent with the systemd stuff
|
|
||||||
+# above and may actually coexist on some upgraded systems. Let's just make
|
|
||||||
+# sure that, if it exists, we update this file, even if it's not used...
|
|
||||||
+if [ -f ${rootfs_path}/etc/rc.sysinit ]
|
|
||||||
+then
|
|
||||||
+ configure_fedora_init
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
if [ ! -z $clean ]; then
|
|
||||||
clean || exit 1
|
|
||||||
exit 0
|
|
@ -1,39 +0,0 @@
|
|||||||
diff -up lxc-0.9.0/src/lua-lxc/lxc.lua.orig lxc-0.9.0/src/lua-lxc/lxc.lua
|
|
||||||
--- lxc-0.9.0/src/lua-lxc/lxc.lua.orig 2013-02-18 08:47:43.000000000 +0100
|
|
||||||
+++ lxc-0.9.0/src/lua-lxc/lxc.lua 2013-09-01 23:51:05.582938966 +0200
|
|
||||||
@@ -282,7 +282,7 @@ function container:stat_get_ints(control
|
|
||||||
table.insert(result, val)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
- return unpack(result)
|
|
||||||
+ return table.unpack(result)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- read an integer from a cgroup file
|
|
||||||
diff -up lxc-0.9.0/src/lua-lxc/Makefile.am.orig lxc-0.9.0/src/lua-lxc/Makefile.am
|
|
||||||
--- lxc-0.9.0/src/lua-lxc/Makefile.am.orig 2013-04-05 11:45:22.000000000 +0200
|
|
||||||
+++ lxc-0.9.0/src/lua-lxc/Makefile.am 2013-09-01 23:51:05.581938980 +0200
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
if ENABLE_LUA
|
|
||||||
|
|
||||||
-luadir=$(datadir)/lua/5.1
|
|
||||||
-sodir=$(libdir)/lua/5.1/lxc
|
|
||||||
+luadir=$(datadir)/lua/5.2
|
|
||||||
+sodir=$(libdir)/lua/5.2/lxc
|
|
||||||
|
|
||||||
lua_SCRIPTS=lxc.lua
|
|
||||||
|
|
||||||
diff -up lxc-0.9.0/src/lua-lxc/Makefile.in.orig lxc-0.9.0/src/lua-lxc/Makefile.in
|
|
||||||
--- lxc-0.9.0/src/lua-lxc/Makefile.in.orig 2013-04-05 11:48:20.000000000 +0200
|
|
||||||
+++ lxc-0.9.0/src/lua-lxc/Makefile.in 2013-09-01 23:51:18.384762328 +0200
|
|
||||||
@@ -230,8 +230,8 @@ target_alias = @target_alias@
|
|
||||||
top_build_prefix = @top_build_prefix@
|
|
||||||
top_builddir = @top_builddir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
-@ENABLE_LUA_TRUE@luadir = $(datadir)/lua/5.1
|
|
||||||
-@ENABLE_LUA_TRUE@sodir = $(libdir)/lua/5.1/lxc
|
|
||||||
+@ENABLE_LUA_TRUE@luadir = $(datadir)/lua/5.2
|
|
||||||
+@ENABLE_LUA_TRUE@sodir = $(libdir)/lua/5.2/lxc
|
|
||||||
@ENABLE_LUA_TRUE@lua_SCRIPTS = lxc.lua
|
|
||||||
@ENABLE_LUA_TRUE@core_so_SOURCES = core.c
|
|
||||||
@ENABLE_LUA_TRUE@AM_CFLAGS = -I$(top_srcdir)/src $(LUA_CFLAGS) -DVERSION=\"$(VERSION)\" -DLXCPATH=\"$(LXCPATH)\"
|
|
93
lxc.spec
93
lxc.spec
@ -1,8 +1,7 @@
|
|||||||
%if 0%{?fedora} || 0%{?rhel} > 7
|
%if 0%{?fedora}
|
||||||
%global with_python3 1
|
%global with_python3 1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%global with_lua 1
|
|
||||||
%if 0%{?fedora} > 19
|
%if 0%{?fedora} > 19
|
||||||
%global luaver 5.2
|
%global luaver 5.2
|
||||||
%else
|
%else
|
||||||
@ -12,27 +11,24 @@
|
|||||||
%global luapkgdir %{_datadir}/lua/%{luaver}
|
%global luapkgdir %{_datadir}/lua/%{luaver}
|
||||||
|
|
||||||
Name: lxc
|
Name: lxc
|
||||||
Version: 0.9.0
|
Version: 1.0.3
|
||||||
Release: 4%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Linux Resource Containers
|
Summary: Linux Resource Containers
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
License: LGPLv2+ and GPLv2
|
License: LGPLv2+ and GPLv2
|
||||||
URL: http://lxc.sourceforge.net
|
URL: http://linuxcontainers.org
|
||||||
Source0: http://lxc.sourceforge.net/download/lxc/%{name}-%{version}.tar.gz
|
Source0: http://linuxcontainers.org/downloads/%{name}-%{version}.tar.gz
|
||||||
Patch0: lxc-0.9.0-fedora-template.patch
|
|
||||||
# only used on Fedora > 19
|
|
||||||
Patch1: lxc-0.9.0-lua-5.2.patch
|
|
||||||
BuildRequires: docbook-utils
|
BuildRequires: docbook-utils
|
||||||
Buildrequires: docbook2X
|
Buildrequires: docbook2X
|
||||||
BuildRequires: kernel-headers
|
BuildRequires: kernel-headers
|
||||||
BuildRequires: libcap-devel
|
BuildRequires: libcap-devel
|
||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
|
BuildRequires: lua-devel
|
||||||
%if 0%{?with_python3}
|
%if 0%{?with_python3}
|
||||||
BuildRequires: python3-devel >= 3.2
|
BuildRequires: python3-devel >= 3.2
|
||||||
%endif
|
%endif
|
||||||
%if 0%{?with_lua}
|
BuildRequires: systemd
|
||||||
BuildRequires: lua-devel
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||||
|
|
||||||
@ -44,6 +40,9 @@ overhead of full virtualization.
|
|||||||
%package libs
|
%package libs
|
||||||
Summary: Runtime library files for %{name}
|
Summary: Runtime library files for %{name}
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
|
Requires(post): systemd
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
|
||||||
%description libs
|
%description libs
|
||||||
Linux Resource Containers provide process and resource isolation without the
|
Linux Resource Containers provide process and resource isolation without the
|
||||||
@ -79,7 +78,6 @@ This package contains tools needing the Python3 bindings.
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_lua}
|
|
||||||
%package -n lua-%{name}
|
%package -n lua-%{name}
|
||||||
Summary: Lua binding for %{name}
|
Summary: Lua binding for %{name}
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -92,7 +90,6 @@ overhead of full virtualization.
|
|||||||
The lua-%{name} package contains the Lua binding for %{name}.
|
The lua-%{name} package contains the Lua binding for %{name}.
|
||||||
|
|
||||||
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}core\\.so\\.0
|
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}core\\.so\\.0
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
%package templates
|
%package templates
|
||||||
@ -141,10 +138,7 @@ This package contains documentation for %{name}.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{version}
|
%setup -q -n %{name}-%{version}
|
||||||
%patch0 -p1
|
|
||||||
%if 0%{?with_lua} && 0%{?fedora} > 19
|
|
||||||
%patch1 -p1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --with-distro=fedora \
|
%configure --with-distro=fedora \
|
||||||
@ -152,12 +146,10 @@ This package contains documentation for %{name}.
|
|||||||
--docdir=%{_pkgdocdir} \
|
--docdir=%{_pkgdocdir} \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
--disable-apparmor \
|
--disable-apparmor \
|
||||||
|
--enable-lua \
|
||||||
%if 0%{?with_python3}
|
%if 0%{?with_python3}
|
||||||
--enable-python \
|
--enable-python \
|
||||||
%endif
|
%endif
|
||||||
%if 0%{?with_lua}
|
|
||||||
--enable-lua \
|
|
||||||
%endif
|
|
||||||
# intentionally blank line
|
# intentionally blank line
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
@ -173,20 +165,43 @@ chmod -x %{buildroot}%{luapkgdir}/lxc.lua
|
|||||||
mkdir -p %{buildroot}%{_pkgdocdir}
|
mkdir -p %{buildroot}%{_pkgdocdir}
|
||||||
cp -a AUTHORS COPYING README %{buildroot}%{_pkgdocdir}
|
cp -a AUTHORS COPYING README %{buildroot}%{_pkgdocdir}
|
||||||
|
|
||||||
|
# cache dir
|
||||||
|
mkdir -p %{buildroot}%{_localstatedir}/cache/%{name}
|
||||||
|
|
||||||
|
# move templates with extra dependencies
|
||||||
|
# - lxc-altlinux needs apt
|
||||||
|
# - lxc-archlinux needs pacman
|
||||||
|
# - lxc-opensuse needs zypper
|
||||||
|
# - lxc-ubuntu-cloud needs ubuntu-cloudimg-query
|
||||||
|
mkdir -p %{buildroot}%{_pkgdocdir}/templates
|
||||||
|
for t in altlinux archlinux opensuse ubuntu-cloud ; do
|
||||||
|
mv %{buildroot}%{_datadir}/%{name}/templates/%{name}-$t \
|
||||||
|
%{buildroot}%{_pkgdocdir}/templates
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
|
||||||
%post libs -p /sbin/ldconfig
|
%post libs
|
||||||
|
/sbin/ldconfig
|
||||||
|
%systemd_post %{name}.service
|
||||||
|
|
||||||
|
|
||||||
%postun libs -p /sbin/ldconfig
|
%preun libs
|
||||||
|
%systemd_preun %{name}.service
|
||||||
|
|
||||||
|
|
||||||
|
%postun libs
|
||||||
|
/sbin/ldconfig
|
||||||
|
%systemd_postun %{name}.service
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%{_bindir}/%{name}-*
|
%{_bindir}/%{name}-*
|
||||||
%{_mandir}/man1/%{name}*
|
%{_mandir}/man1/%{name}*
|
||||||
|
%{_mandir}/*/man1/%{name}*
|
||||||
%{_datadir}/%{name}/lxc.functions
|
%{_datadir}/%{name}/lxc.functions
|
||||||
%if 0%{?with_python3}
|
%if 0%{?with_python3}
|
||||||
%exclude %{_bindir}/%{name}-device
|
%exclude %{_bindir}/%{name}-device
|
||||||
@ -199,24 +214,35 @@ make check
|
|||||||
%{_bindir}/%{name}-ls
|
%{_bindir}/%{name}-ls
|
||||||
%{_mandir}/man1/%{name}-ls*
|
%{_mandir}/man1/%{name}-ls*
|
||||||
%endif
|
%endif
|
||||||
|
%dir %{_sysconfdir}/bash_completion.d/
|
||||||
|
%{_sysconfdir}/bash_completion.d/%{name}
|
||||||
|
|
||||||
|
|
||||||
%files libs
|
%files libs
|
||||||
%dir %{_datadir}/%{name}
|
%dir %{_datadir}/%{name}
|
||||||
%dir %{_datadir}/%{name}/templates
|
%dir %{_datadir}/%{name}/templates
|
||||||
|
%dir %{_datadir}/%{name}/config
|
||||||
%{_datadir}/%{name}/hooks
|
%{_datadir}/%{name}/hooks
|
||||||
%{_libdir}/liblxc.so.*
|
%{_libdir}/liblxc.so.*
|
||||||
%{_libdir}/%{name}
|
%{_libdir}/%{name}
|
||||||
%{_libexecdir}/%{name}
|
%{_libexecdir}/%{name}
|
||||||
|
# fixme: should be in libexecdir?
|
||||||
|
%{_sbindir}/init.%{name}
|
||||||
%{_sharedstatedir}/%{name}
|
%{_sharedstatedir}/%{name}
|
||||||
%dir %{_sysconfdir}/%{name}
|
%dir %{_sysconfdir}/%{name}
|
||||||
%config(noreplace) %{_sysconfdir}/%{name}/default.conf
|
%config(noreplace) %{_sysconfdir}/%{name}/default.conf
|
||||||
%{_mandir}/man5/%{name}*
|
%{_mandir}/man5/%{name}*
|
||||||
%{_mandir}/man7/%{name}*
|
%{_mandir}/man7/%{name}*
|
||||||
|
%{_mandir}/*/man5/%{name}*
|
||||||
|
%{_mandir}/*/man7/%{name}*
|
||||||
%dir %{_pkgdocdir}
|
%dir %{_pkgdocdir}
|
||||||
%{_pkgdocdir}/AUTHORS
|
%{_pkgdocdir}/AUTHORS
|
||||||
%{_pkgdocdir}/COPYING
|
%{_pkgdocdir}/COPYING
|
||||||
%{_pkgdocdir}/README
|
%{_pkgdocdir}/README
|
||||||
|
%{_unitdir}/%{name}.service
|
||||||
|
%dir %{_localstatedir}/cache/%{name}
|
||||||
|
# fixme:
|
||||||
|
%exclude %{_datadir}/%{name}/%{name}-patch.py*
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if 0%{?with_python3}
|
||||||
@ -234,23 +260,15 @@ make check
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_lua}
|
|
||||||
%files -n lua-%{name}
|
%files -n lua-%{name}
|
||||||
%{lualibdir}/%{name}
|
%{lualibdir}/%{name}
|
||||||
%{luapkgdir}/%{name}.lua
|
%{luapkgdir}/%{name}.lua
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
%files templates
|
%files templates
|
||||||
%{_datadir}/lxc/templates/lxc-*
|
%{_datadir}/%{name}/templates/lxc-*
|
||||||
# needs apt
|
%{_datadir}/%{name}/config/*
|
||||||
%exclude %{_datadir}/lxc/templates/lxc-altlinux
|
%{_pkgdocdir}/templates
|
||||||
# needs pacman
|
|
||||||
%exclude %{_datadir}/lxc/templates/lxc-archlinux
|
|
||||||
# needs zypper
|
|
||||||
%exclude %{_datadir}/lxc/templates/lxc-opensuse
|
|
||||||
# needs ubuntu-cloudimg-query
|
|
||||||
%exclude %{_datadir}/lxc/templates/lxc-ubuntu-cloud
|
|
||||||
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
@ -264,9 +282,16 @@ make check
|
|||||||
# README, AUTHORS and COPYING intentionally duplicated because -doc
|
# README, AUTHORS and COPYING intentionally duplicated because -doc
|
||||||
# can be installed on its own.
|
# can be installed on its own.
|
||||||
%{_pkgdocdir}/*
|
%{_pkgdocdir}/*
|
||||||
|
%exclude %{_pkgdocdir}/templates
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 4 2014 Thomas Moschny <thomas.moschny@gmx.de> - 1.0.3-1
|
||||||
|
- Update to 1.0.3.
|
||||||
|
- Remove obsolete patches.
|
||||||
|
- Add systemd support.
|
||||||
|
- Lua bindings are not optional (needed e.g. for lxc-top).
|
||||||
|
|
||||||
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.9.0-4
|
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.9.0-4
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
|
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user