xe-guest-utilities: init at 6.2.0
use mkEnableOption use sha256 add xe-guest-utilities to module-list.nix
This commit is contained in:
parent
63f1eb6b00
commit
449d908b88
@ -51,6 +51,7 @@
|
||||
bdimcheff = "Brandon Dimcheff <brandon@dimcheff.com>";
|
||||
benley = "Benjamin Staffin <benley@gmail.com>";
|
||||
bennofs = "Benno Fünfstück <benno.fuenfstueck@gmail.com>";
|
||||
benwbooth = "Ben Booth <benwbooth@gmail.com>";
|
||||
berdario = "Dario Bertini <berdario@gmail.com>";
|
||||
bergey = "Daniel Bergey <bergey@teallabs.org>";
|
||||
bjg = "Brian Gough <bjg@gnu.org>";
|
||||
|
@ -542,4 +542,5 @@
|
||||
./virtualisation/virtualbox-host.nix
|
||||
./virtualisation/vmware-guest.nix
|
||||
./virtualisation/xen-dom0.nix
|
||||
./virtualisation/xe-guest-utilities.nix
|
||||
]
|
||||
|
52
nixos/modules/virtualisation/xe-guest-utilities.nix
Normal file
52
nixos/modules/virtualisation/xe-guest-utilities.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.xe-guest-utilities;
|
||||
in {
|
||||
options = {
|
||||
services.xe-guest-utilities = {
|
||||
enable = mkEnableOption "Whether to enable the Xen guest utilities daemon.";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
services.udev.packages = [ pkgs.xe-guest-utilities ];
|
||||
systemd.tmpfiles.rules = [ "d /run/xenstored 0755 - - -" ];
|
||||
|
||||
systemd.services.xe-daemon = {
|
||||
description = "xen daemon file";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "xe-linux-distribution.service" ];
|
||||
requires = [ "proc-xen.mount" ];
|
||||
path = [ pkgs.coreutils pkgs.iproute ];
|
||||
serviceConfig = {
|
||||
PIDFile = "/run/xe-daemon.pid";
|
||||
ExecStart = "${pkgs.xe-guest-utilities}/bin/xe-daemon -p /run/xe-daemon.pid";
|
||||
ExecStop = "${pkgs.procps}/bin/pkill -TERM -F /run/xe-daemon.pid";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.xe-linux-distribution = {
|
||||
description = "xen linux distribution service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "xend.service" ];
|
||||
path = [ pkgs.xe-guest-utilities pkgs.coreutils pkgs.gawk pkgs.gnused ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
RemainAfterExit = "yes";
|
||||
ExecStart = "${pkgs.xe-guest-utilities}/bin/xe-linux-distribution /var/cache/xe-linux-distribution";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.mounts = [
|
||||
{ description = "Mount /proc/xen files";
|
||||
what = "xenfs";
|
||||
where = "/proc/xen";
|
||||
type = "xenfs";
|
||||
unitConfig = {
|
||||
ConditionPathExists = "/proc/xen";
|
||||
RefuseManualStop = "true";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
75
pkgs/tools/virtualization/xe-guest-utilities/default.nix
Normal file
75
pkgs/tools/virtualization/xe-guest-utilities/default.nix
Normal file
@ -0,0 +1,75 @@
|
||||
{ stdenv, fetchurl, bzip2, lzo, zlib, xz, bash, python, gnutar, gnused, gnugrep, which }:
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
name = "xe-guest-utilities";
|
||||
version = "6.2.0";
|
||||
meta = {
|
||||
description = "Citrix XenServer Tools";
|
||||
homepage = http://citrix.com/English/ps2/products/product.asp?contentID=683148&ntref=hp_nav_US;
|
||||
maintainers = with stdenv.lib.maintainers; [ benwbooth ];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
license = [ stdenv.lib.licenses.gpl2 stdenv.lib.licenses.lgpl21 ];
|
||||
};
|
||||
src = fetchurl {
|
||||
url = "https://sources.archlinux.org/other/community/xe-guest-utilities/xe-guest-utilities_${version}-1120.tar.gz";
|
||||
sha256 = "f9593cd9588188f80253e736f48d8dd94c5b517abb18316085f86acffab48794";
|
||||
};
|
||||
buildInputs = [ bzip2 gnutar gnused python lzo zlib xz stdenv gnugrep which ];
|
||||
patches = [ ./ip-address.patch ];
|
||||
postPatch = ''
|
||||
tar xf "$NIX_BUILD_TOP/$name-$version/xenstore-sources.tar.bz2"
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
export CC=gcc
|
||||
export CFLAGS='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
|
||||
export PYTHON=python2
|
||||
cd "$NIX_BUILD_TOP/$name-$version/uclibc-sources"
|
||||
for file in Config.mk tools/libxc/Makefile tools/misc/Makefile tools/misc/lomount/Makefile tools/xenstore/Makefile; do
|
||||
substituteInPlace "$file" --replace -Werror ""
|
||||
done
|
||||
make -C tools/include
|
||||
make -C tools/libxc
|
||||
make -C tools/xenstore
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
export CFLAGS+='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
|
||||
if [[ $CARCH == x86_64 ]]; then
|
||||
export LIBLEAFDIR_x86_64=lib
|
||||
fi
|
||||
for f in include libxc xenstore; do
|
||||
[[ ! -d $NIX_BUILD_TOP/$name-$version/uclibc-sources/tools/$f ]] && continue
|
||||
make -C "$NIX_BUILD_TOP/$name-$version/uclibc-sources/tools/$f" DESTDIR="$out" BINDIR=/bin SBINDIR=/bin INCLUDEDIR=/include LIBDIR=/lib install
|
||||
done
|
||||
rm -r "$out"/var
|
||||
|
||||
cd "$NIX_BUILD_TOP/$name-$version"
|
||||
install -Dm755 xe-update-guest-attrs "$out/bin/xe-update-guest-attrs"
|
||||
install -Dm755 xe-daemon "$out/bin/xe-daemon"
|
||||
install -Dm644 xen-vcpu-hotplug.rules "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules"
|
||||
substituteInPlace "$out/bin/xe-daemon" --replace sbin bin
|
||||
substituteInPlace "$out/bin/xe-daemon" --replace /usr/ "$out/"
|
||||
substituteInPlace "$out/bin/xe-update-guest-attrs" --replace /usr/ "$out/"
|
||||
substituteInPlace "$out/bin/xe-update-guest-attrs" --replace 'export PATH=' 'export PATH=$PATH:'
|
||||
substituteInPlace "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules" --replace /bin/sh '${bash}/bin/sh'
|
||||
|
||||
cat <<'EOS' >"$out/bin/xe-linux-distribution"
|
||||
#!${bash}/bin/bash -eu
|
||||
. /etc/os-release
|
||||
if [[ $# -gt 0 ]]; then
|
||||
mkdir -p "$(dirname "$1")"
|
||||
exec 1>"$1"
|
||||
fi
|
||||
cat <<EOF
|
||||
os_distro="$ID"
|
||||
os_majorver="''${VERSION_ID%%.*}"
|
||||
os_minorver="''${VERSION_ID#*.}"
|
||||
os_uname="$(uname -r)"
|
||||
os_name="$PRETTY_NAME"
|
||||
EOF
|
||||
EOS
|
||||
chmod 0755 "$out/bin/xe-linux-distribution"
|
||||
'';
|
||||
|
||||
})
|
@ -0,0 +1,16 @@
|
||||
diff -uNr a/xe-update-guest-attrs b/xe-update-guest-attrs
|
||||
--- a/xe-update-guest-attrs 2012-09-25 12:45:14.000000000 +0200
|
||||
+++ b/xe-update-guest-attrs 2012-11-21 16:46:35.000000000 +0100
|
||||
@@ -177,9 +177,9 @@
|
||||
# collisions:0 txqueuelen:0
|
||||
# RX bytes:3604609 (3.4 MiB) TX bytes:3604609 (3.4 MiB)
|
||||
|
||||
-ifs=`/sbin/ifconfig | sed -n -e 's/^\([a-z0-9]\+\).*/name \1/p' \
|
||||
- -e 's/.*inet addr:\('$IPADDR_RE'\) .*/ipv4 \1/p' \
|
||||
- -e 's+.*inet6 addr: \('$IPADDR6_RE'\)/.*+ipv6 \1+p' | \
|
||||
+ifs=`ip addr show | sed -n -e 's/^[[:digit:]]*: \([a-z0-9]*\): .*/name \1 /gp;' \
|
||||
+ -e 's/^[[:space:]]\{4\}inet \('${IPADDR_RE}'\)\/.*/ipv4 \1 /gp;' \
|
||||
+ -e 's/^[[:space:]]\{4\}inet6 \('${IPADDR6_RE}'\)\/.*/ipv6 \1 /gp;' | \
|
||||
while read tag value; do
|
||||
case "${tag}" in
|
||||
name)
|
@ -3776,6 +3776,8 @@ in
|
||||
|
||||
xdummy = callPackage ../tools/misc/xdummy { };
|
||||
|
||||
xe-guest-utilities = callPackage ../tools/virtualization/xe-guest-utilities { };
|
||||
|
||||
xflux = callPackage ../tools/misc/xflux { };
|
||||
|
||||
xfsprogs = callPackage ../tools/filesystems/xfsprogs { };
|
||||
|
Loading…
Reference in New Issue
Block a user