lol

xen: finish moving to `by-name`; refactor (#406638)

authored by philiptaron.tngl.sh and committed by

GitHub 8ac41f32 225c2a95

+1827 -382
-374
pkgs/build-support/xen/default.nix
··· 1 - { 2 - lib, 3 - stdenv, 4 - autoPatchelfHook, 5 - cmake, 6 - pkg-config, 7 - testers, 8 - which, 9 - fetchgit, 10 - 11 - # Xen 12 - acpica-tools, 13 - bison, 14 - bzip2, 15 - dev86, 16 - e2fsprogs, 17 - flex, 18 - libnl, 19 - libuuid, 20 - lzo, 21 - ncurses, 22 - ocamlPackages, 23 - perl, 24 - python3Packages, 25 - systemdMinimal, 26 - xz, 27 - yajl, 28 - zlib, 29 - zstd, 30 - 31 - # Optional Components 32 - seabios-qemu, 33 - systemSeaBIOS ? seabios-qemu, 34 - OVMF, 35 - ipxe, 36 - checkpolicy, 37 - binutils-unwrapped-all-targets, 38 - 39 - # Documentation 40 - pandoc, 41 - 42 - # Scripts 43 - bridge-utils, 44 - coreutils, 45 - diffutils, 46 - gawk, 47 - gnugrep, 48 - gnused, 49 - inetutils, 50 - iproute2, 51 - iptables, 52 - multipath-tools, 53 - nbd, 54 - openvswitch, 55 - util-linux, 56 - }: 57 - 58 - { 59 - pname, 60 - branch ? lib.versions.majorMinor version, 61 - version, 62 - vendor ? "nixos", 63 - upstreamVersion ? version, 64 - withFlask ? false, 65 - withSeaBIOS ? true, 66 - withOVMF ? true, 67 - withIPXE ? true, 68 - rev, 69 - hash, 70 - patches ? [ ], 71 - meta ? { }, 72 - }: 73 - 74 - let 75 - inherit (lib) 76 - enableFeature 77 - getExe' 78 - licenses 79 - makeSearchPathOutput 80 - optional 81 - optionalString 82 - optionals 83 - systems 84 - teams 85 - versionOlder 86 - warn 87 - ; 88 - inherit (systems.inspect.patterns) isLinux isAarch64; 89 - inherit (licenses) 90 - cc-by-40 91 - gpl2Only 92 - lgpl21Only 93 - mit 94 - ; 95 - 96 - # Mark versions older than minSupportedVersion as EOL. 97 - minSupportedVersion = "4.17"; 98 - 99 - #TODO: fix paths instead. 100 - scriptEnvPath = makeSearchPathOutput "out" "bin" [ 101 - bridge-utils 102 - coreutils 103 - diffutils 104 - gawk 105 - gnugrep 106 - gnused 107 - inetutils 108 - iproute2 109 - iptables 110 - multipath-tools 111 - nbd 112 - openvswitch 113 - perl 114 - util-linux.bin 115 - which 116 - ]; 117 - in 118 - 119 - stdenv.mkDerivation (finalAttrs: { 120 - inherit pname version patches; 121 - 122 - outputs = [ 123 - "out" 124 - "man" 125 - "doc" 126 - "dev" 127 - "boot" 128 - ]; 129 - 130 - src = fetchgit { 131 - url = "https://xenbits.xenproject.org/git-http/xen.git"; 132 - inherit rev hash; 133 - }; 134 - 135 - nativeBuildInputs = [ 136 - autoPatchelfHook 137 - bison 138 - cmake 139 - flex 140 - pandoc 141 - pkg-config 142 - python3Packages.setuptools 143 - ]; 144 - buildInputs = 145 - [ 146 - # Xen 147 - acpica-tools 148 - bzip2 149 - dev86 150 - e2fsprogs.dev 151 - libnl 152 - libuuid 153 - lzo 154 - ncurses 155 - perl 156 - python3Packages.python 157 - xz 158 - yajl 159 - zlib 160 - zstd 161 - 162 - # oxenstored 163 - ocamlPackages.findlib 164 - ocamlPackages.ocaml 165 - 166 - # Python Fixes 167 - python3Packages.wrapPython 168 - ] 169 - ++ optional withFlask checkpolicy 170 - ++ optional (versionOlder version "4.19") systemdMinimal; 171 - 172 - configureFlags = [ 173 - "--enable-systemd" 174 - "--disable-qemu-traditional" 175 - "--with-system-qemu" 176 - (if withSeaBIOS then "--with-system-seabios=${systemSeaBIOS.firmware}" else "--disable-seabios") 177 - (if withOVMF then "--with-system-ovmf=${OVMF.mergedFirmware}" else "--disable-ovmf") 178 - (if withIPXE then "--with-system-ipxe=${ipxe.firmware}" else "--disable-ipxe") 179 - (enableFeature withFlask "xsmpolicy") 180 - ]; 181 - 182 - makeFlags = 183 - [ 184 - "SUBSYSTEMS=${toString finalAttrs.buildFlags}" 185 - 186 - "PREFIX=$(out)" 187 - "BASH_COMPLETION_DIR=$(PREFIX)/share/bash-completion/completions" 188 - 189 - "XEN_WHOAMI=${pname}" 190 - "XEN_DOMAIN=${vendor}" 191 - 192 - "GIT=${coreutils}/bin/false" 193 - "WGET=${coreutils}/bin/false" 194 - "EFI_VENDOR=${vendor}" 195 - "INSTALL_EFI_STRIP=1" 196 - "LD=${getExe' binutils-unwrapped-all-targets "ld"}" 197 - ] 198 - # These flags set the CONFIG_* options in /boot/xen.config 199 - # and define if the default policy file is built. However, 200 - # the Flask binaries always get compiled by default. 201 - ++ optionals withFlask [ 202 - "XSM_ENABLE=y" 203 - "FLASK_ENABLE=y" 204 - ]; 205 - 206 - buildFlags = [ 207 - "xen" 208 - "tools" 209 - "docs" 210 - ]; 211 - 212 - enableParallelBuilding = true; 213 - 214 - env.NIX_CFLAGS_COMPILE = toString [ 215 - "-Wno-error=maybe-uninitialized" 216 - "-Wno-error=array-bounds" 217 - ]; 218 - 219 - dontUseCmakeConfigure = true; 220 - 221 - # Remove in-tree QEMU sources, we don't need them in any circumstance. 222 - prePatch = "rm --recursive --force tools/qemu-xen tools/qemu-xen-traditional"; 223 - 224 - postPatch = 225 - # The following patch forces Xen to install xen.efi on $out/boot 226 - # instead of $out/boot/efi/efi/nixos, as the latter directory 227 - # would otherwise need to be created manually. This also creates 228 - # a more consistent output for downstreams who override the 229 - # vendor attribute above. 230 - '' 231 - substituteInPlace xen/Makefile \ 232 - --replace-fail "\$(D)\$(EFI_MOUNTPOINT)/efi/\$(EFI_VENDOR)/\$(T)-\$(XEN_FULLVERSION).efi" \ 233 - "\$(D)\$(BOOT_DIR)/\$(T)-\$(XEN_FULLVERSION).efi" 234 - '' 235 - 236 - # The following patch fixes the call to /bin/mkdir on the 237 - # launch_xenstore.sh helper script. 238 - + '' 239 - substituteInPlace tools/hotplug/Linux/launch-xenstore.in \ 240 - --replace-fail "/bin/mkdir" "${coreutils}/bin/mkdir" 241 - '' 242 - 243 - # The following expression fixes the paths called by Xen's systemd 244 - # units, so we can use them in the NixOS module. 245 - + '' 246 - substituteInPlace \ 247 - tools/hotplug/Linux/systemd/{xen-init-dom0,xen-qemu-dom0-disk-backend,xenconsoled,xendomains,xenstored}.service.in \ 248 - --replace-fail /bin/grep ${gnugrep}/bin/grep 249 - substituteInPlace \ 250 - tools/hotplug/Linux/systemd/{xen-qemu-dom0-disk-backend,xenconsoled}.service.in \ 251 - --replace-fail "/bin/mkdir" "${coreutils}/bin/mkdir" 252 - ''; 253 - 254 - installPhase = '' 255 - runHook preInstall 256 - 257 - mkdir --parents $out $out/share $boot 258 - cp -prvd dist/install/nix/store/*/* $out/ 259 - cp -prvd dist/install/etc $out 260 - cp -prvd dist/install/boot $boot 261 - 262 - runHook postInstall 263 - ''; 264 - 265 - postInstall = 266 - # Wrap xencov_split, xenmon and xentrace_format. 267 - '' 268 - wrapPythonPrograms 269 - '' 270 - 271 - # We also need to wrap pygrub, which lies in $out/libexec/xen/bin. 272 - + '' 273 - wrapPythonProgramsIn "$out/libexec/xen/bin" "$out $pythonPath" 274 - '' 275 - 276 - # Fix shebangs in Xen's various scripts. 277 - #TODO: Remove any and all usage of `sed` and replace these complicated magic runes with readable code. 278 - + '' 279 - shopt -s extglob 280 - for i in $out/etc/xen/scripts/!(*.sh); do 281 - sed --in-place "2s@^@export PATH=$out/bin:${scriptEnvPath}\n@" $i 282 - done 283 - ''; 284 - 285 - postFixup = 286 - '' 287 - addAutoPatchelfSearchPath $out/lib 288 - autoPatchelf $out/libexec/xen/bin 289 - '' 290 - # Flask is particularly hard to disable. Even after 291 - # setting the make flags to `n`, it still gets compiled. 292 - # If withFlask is disabled, delete the extra binaries. 293 - + optionalString (!withFlask) '' 294 - rm -f $out/bin/flask-* 295 - ''; 296 - 297 - passthru = { 298 - efi = "boot/xen-${upstreamVersion}.efi"; 299 - flaskPolicy = 300 - if withFlask then 301 - warn "This Xen was compiled with FLASK support, but the FLASK file does not match the Xen version number. Please hardcode the path to the FLASK file instead." "boot/xenpolicy-${version}" 302 - else 303 - throw "This Xen was compiled without FLASK support."; 304 - # This test suite is very simple, as Xen's userspace 305 - # utilities require the hypervisor to be booted. 306 - tests = { 307 - pkg-config = testers.hasPkgConfigModules { 308 - package = finalAttrs.finalPackage; 309 - moduleNames = [ 310 - "xencall" 311 - "xencontrol" 312 - "xendevicemodel" 313 - "xenevtchn" 314 - "xenforeignmemory" 315 - "xengnttab" 316 - "xenguest" 317 - "xenhypfs" 318 - "xenlight" 319 - "xenstat" 320 - "xenstore" 321 - "xentoolcore" 322 - "xentoollog" 323 - "xenvchan" 324 - "xlutil" 325 - ]; 326 - }; 327 - }; 328 - }; 329 - 330 - meta = { 331 - inherit branch; 332 - 333 - description = "Type-1 hypervisor intended for embedded and hyperscale use cases"; 334 - longDescription = 335 - '' 336 - The Xen Project Hypervisor is a virtualisation technology defined as a *type-1 337 - hypervisor*, which allows multiple virtual machines, known as domains, to run 338 - concurrently with the host on the physical machine. On a typical *type-2 339 - hypervisor*, the virtual machines run as applications on top of the 340 - host. NixOS runs as the privileged **Domain 0**, and can paravirtualise or fully 341 - virtualise **Unprivileged Domains**. 342 - 343 - Use with the `qemu_xen` package. 344 - '' 345 - + "\nIncludes:\n* `xen.efi`: The Xen Project's [EFI binary](https://xenbits.xenproject.org/docs/${branch}-testing/misc/efi.html), available on the `boot` output of this package." 346 - + optionalString withFlask "\n* `xsm-flask`: The [FLASK Xen Security Module](https://wiki.xenproject.org/wiki/Xen_Security_Modules_:_XSM-FLASK). The `xenpolicy-${upstreamVersion}` file is available on the `boot` output of this package." 347 - + optionalString withSeaBIOS "\n* `seabios`: Support for the SeaBIOS boot firmware on HVM domains." 348 - + optionalString withOVMF "\n* `ovmf`: Support for the OVMF UEFI boot firmware on HVM domains." 349 - + optionalString withIPXE "\n* `ipxe`: Support for the iPXE boot firmware on HVM domains."; 350 - 351 - homepage = "https://xenproject.org/"; 352 - downloadPage = "https://downloads.xenproject.org/release/xen/${version}/"; 353 - changelog = "https://wiki.xenproject.org/wiki/Xen_Project_${branch}_Release_Notes"; 354 - 355 - license = [ 356 - # Documentation. 357 - cc-by-40 358 - # Most of Xen is licensed under the GPL v2.0. 359 - gpl2Only 360 - # Xen Libraries and the `xl` command-line utility. 361 - lgpl21Only 362 - # Development headers in $dev/include. 363 - mit 364 - ]; 365 - 366 - teams = [ teams.xen ]; 367 - knownVulnerabilities = optional (versionOlder version minSupportedVersion) "The Xen Project Hypervisor version ${version} is no longer supported by the Xen Project Security Team. See https://xenbits.xenproject.org/docs/unstable/support-matrix.html"; 368 - 369 - mainProgram = "xl"; 370 - 371 - platforms = [ isLinux ]; 372 - badPlatforms = [ isAarch64 ]; 373 - } // meta; 374 - })
+35
pkgs/by-name/xe/xen/0001-makefile-efi-output-directory.patch
··· 1 + From 7f802ceac03252ad5182ee8c69ebb01da24a307c Mon Sep 17 00:00:00 2001 2 + From: Fernando Rodrigues <alpha@sigmasquadron.net> 3 + Date: Fri, 4 Jul 2025 18:07:01 +0000 4 + Subject: [PATCH 1/2] xen/Makefile: patch .efi output directory 5 + 6 + This is necessary so the build does not fail when Xen tries to install 7 + .efi files to $boot/efi/nixos and panics when the directory doesn't 8 + exist. It also has the benefit of installing the files in a location 9 + that is easier to access. 10 + 11 + Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net> 12 + 13 + diff --git a/xen/Makefile b/xen/Makefile 14 + index 6bf0b0ea9e..907cd89f7e 100644 15 + --- a/xen/Makefile 16 + +++ b/xen/Makefile 17 + @@ -527,6 +527,6 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX) 18 + $(if $(efi-strip-opt), \ 19 + $(STRIP) $(efi-strip-opt) -p -o $(TARGET).efi.stripped $(TARGET).efi && \ 20 + - $(INSTALL_DATA) $(TARGET).efi.stripped $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi ||) \ 21 + - $(INSTALL_DATA) $(TARGET).efi $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi; \ 22 + + $(INSTALL_DATA) $(TARGET).efi.stripped $(D)$(BOOT_DIR)/$(T)-$(XEN_FULLVERSION).efi ||) \ 23 + + $(INSTALL_DATA) $(TARGET).efi $(D)$(BOOT_DIR)/$(T)-$(XEN_FULLVERSION).efi; \ 24 + elif [ "$(D)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(D))" ]; then \ 25 + echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \ 26 + @@ -560,5 +560,5 @@ _uninstall: 27 + rm -f $(D)$(EFI_DIR)/$(T).efi 28 + if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \ 29 + - rm -f $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi; \ 30 + + rm -f $(D)$(BOOT_DIR)/$(T)-$(XEN_FULLVERSION).efi; \ 31 + fi 32 + 33 + -- 34 + 2.49.0 35 +
+1390
pkgs/by-name/xe/xen/0002-scripts-external-executable-calls.patch
··· 1 + From 4893cc08acc81bfc2f8730ea108574aedae909aa Mon Sep 17 00:00:00 2001 2 + From: Fernando Rodrigues <alpha@sigmasquadron.net> 3 + Date: Fri, 4 Jul 2025 20:09:06 +0000 4 + Subject: [PATCH 2/2] xen/tools/hotplug/Linux: patch external binary calls 5 + 6 + This patch replaces all instances of executable calls and static FHS 7 + paths in the hotplug scripts with at-padded variables that can be 8 + replaced by replaceVars during a Nix build. 9 + 10 + Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net> 11 + 12 + diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block 13 + index 2691b56951..bd41313bf8 100644 14 + --- a/tools/hotplug/Linux/block 15 + +++ b/tools/hotplug/Linux/block 16 + @@ -1,5 +1,5 @@ 17 + #!/bin/bash 18 + 19 + -dir=$(dirname "$0") 20 + +dir=$(@dirname@ "$0") 21 + . "$dir/block-common.sh" 22 + 23 + @@ -32,5 +32,5 @@ find_free_loopback_helper() { 24 + find_free_loopback_dev() { 25 + local loopdev 26 + - loopdev=$(losetup -a | sed -e 's+^/dev/loop++' -e 's/:.*//' | find_free_loopback_helper) 27 + + loopdev=$(@losetup@ -a | @sed@ -e 's+^/dev/loop++' -e 's/:.*//' | find_free_loopback_helper) 28 + if [ -n "$loopdev" ] && [ -b "$loopdev" ]; then 29 + echo "$loopdev" 30 + @@ -67,6 +67,6 @@ check_sharing() 31 + local inode="$4" 32 + 33 + - shared_list=$(losetup -a | 34 + - sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[0*${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" ) 35 + + shared_list=$(@losetup@ -a | 36 + + @sed@ -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[0*${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" ) 37 + for dev in $shared_list 38 + do 39 + @@ -95,5 +95,5 @@ check_sharing() 40 + fi 41 + 42 + - for file in $(cat /proc/mounts | grep -v "$toskip" | cut -f 1 -d ' ') 43 + + for file in $(@cat@ /proc/mounts | @grep@ -v "$toskip" | @cut@ -f 1 -d ' ') 44 + do 45 + if [ -e "$file" ] 46 + @@ -268,5 +268,5 @@ case "$command" in 47 + if [ -L "$dev" ] 48 + then 49 + - dev=$(readlink -f "$dev") || fatal "$dev link does not exist." 50 + + dev=$(@readlink@ -f "$dev") || fatal "$dev link does not exist." 51 + fi 52 + test -e "$dev" || fatal "$dev does not exist." 53 + @@ -283,5 +283,5 @@ case "$command" in 54 + # Canonicalise the file, for sharing check comparison, and the mode 55 + # for ease of use here. 56 + - file=$(readlink -f "$p") || fatal "$p does not exist." 57 + + file=$(@readlink@ -f "$p") || fatal "$p does not exist." 58 + test -f "$file" || fatal "$file does not exist." 59 + mode=$(canonicalise_mode "$mode") 60 + @@ -298,5 +298,5 @@ case "$command" in 61 + fi 62 + 63 + - if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w 64 + + if [ "$mode" = 'w' ] && ! @stat@ "$file" -c %A | @grep@ -q w 65 + then 66 + release_lock "block" 67 + @@ -308,6 +308,6 @@ mount it read-write in a guest domain." 68 + if [ "x$mode" != 'x!' ] 69 + then 70 + - inode=$(stat -c '%i' "$file") 71 + - dev=$(stat -c '%D' "$file") 72 + + inode=$(@stat@ -c '%i' "$file") 73 + + dev=$(@stat@ -c '%D' "$file") 74 + if [ -z "$inode" ] || [ -z "$dev" ] 75 + then 76 + @@ -318,5 +318,5 @@ mount it read-write in a guest domain." 77 + fi 78 + 79 + - loopdev=$(losetup -f 2>/dev/null || find_free_loopback_dev) 80 + + loopdev=$(@losetup@ -f 2>/dev/null || find_free_loopback_dev) 81 + if [ "$loopdev" = '' ] 82 + then 83 + @@ -325,5 +325,5 @@ mount it read-write in a guest domain." 84 + fi 85 + 86 + - if LANG=C losetup -h 2>&1 | grep read-only >/dev/null 87 + + if LANG=C @losetup@ -h 2>&1 | @grep@ read-only >/dev/null 88 + then 89 + roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}" 90 + @@ -331,5 +331,5 @@ mount it read-write in a guest domain." 91 + roflag='' 92 + fi 93 + - do_or_die losetup $roflag "$loopdev" "$file" 94 + + do_or_die @losetup@ $roflag "$loopdev" "$file" 95 + xenstore_write "$XENBUS_PATH/node" "$loopdev" 96 + write_dev "$loopdev" 97 + @@ -355,5 +355,5 @@ mount it read-write in a guest domain." 98 + claim_lock "block" 99 + node=$(xenstore_read "$XENBUS_PATH/node") 100 + - losetup -d "$node" 101 + + @losetup@ -d "$node" 102 + release_lock "block" 103 + exit 0 104 + diff --git a/tools/hotplug/Linux/block-common.sh b/tools/hotplug/Linux/block-common.sh 105 + index 5c80237d99..5e1c350555 100644 106 + --- a/tools/hotplug/Linux/block-common.sh 107 + +++ b/tools/hotplug/Linux/block-common.sh 108 + @@ -16,5 +16,5 @@ 109 + 110 + 111 + -dir=$(dirname "$0") 112 + +dir=$(@dirname@ "$0") 113 + . "$dir/xen-hotplug-common.sh" 114 + 115 + @@ -46,5 +46,5 @@ ebusy() 116 + device_major_minor() 117 + { 118 + - stat -L -c %t:%T "$1" 119 + + @stat@ -L -c %t:%T "$1" 120 + } 121 + 122 + diff --git a/tools/hotplug/Linux/block-drbd-probe b/tools/hotplug/Linux/block-drbd-probe 123 + index 7b2968b6d9..ba246cd132 100755 124 + --- a/tools/hotplug/Linux/block-drbd-probe 125 + +++ b/tools/hotplug/Linux/block-drbd-probe 126 + @@ -32,6 +32,6 @@ function get_res_name() 127 + { 128 + local drbd_dev=$1 129 + - local drbd_dev_list=($(drbdadm sh-dev all)) 130 + - local drbd_res_list=($(drbdadm sh-resource all)) 131 + + local drbd_dev_list=($(@drbdadm@ sh-dev all)) 132 + + local drbd_res_list=($(@drbdadm@ sh-resource all)) 133 + local temp_drbd_dev temp_drbd_res 134 + local found=0 135 + @@ -49,5 +49,5 @@ function get_res_name() 136 + 137 + for temp_drbd_res in ${drbd_res_list[@]}; do 138 + - temp_drbd_dev=$(drbdadm sh-dev $temp_drbd_res) 139 + + temp_drbd_dev=$(@drbdadm@ sh-dev $temp_drbd_res) 140 + if [[ "$temp_drbd_dev" == "$drbd_dev" ]]; then 141 + drbd_res="$temp_drbd_res" 142 + @@ -67,5 +67,5 @@ fi 143 + 144 + # check protocol 145 + -drbdsetup $1 show | grep -q "protocol D;" 146 + +@drbdsetup@ $1 show | @grep@ -q "protocol D;" 147 + if [[ $? -ne 0 ]]; then 148 + exit 3 149 + @@ -73,5 +73,5 @@ fi 150 + 151 + # check connect status 152 + -state=$(drbdadm cstate "$drbd_res") 153 + +state=$(@drbdadm@ cstate "$drbd_res") 154 + if [[ "$state" != "Connected" ]]; then 155 + exit 4 156 + @@ -79,5 +79,5 @@ fi 157 + 158 + # check role 159 + -role=$(drbdadm role "$drbd_res") 160 + +role=$(@drbdadm@ role "$drbd_res") 161 + if [[ "$role" != "Primary/Secondary" ]]; then 162 + exit 4 163 + diff --git a/tools/hotplug/Linux/block-dummy b/tools/hotplug/Linux/block-dummy 164 + index 57d40b5fce..50bbf09bb6 100644 165 + --- a/tools/hotplug/Linux/block-dummy 166 + +++ b/tools/hotplug/Linux/block-dummy 167 + @@ -23,10 +23,10 @@ 168 + # script=block-dummy,vdev=xvda,target=dummy:<file> 169 + 170 + -dir=$(dirname "$0") 171 + +dir=$(@dirname@ "$0") 172 + . "$dir/block-common.sh" 173 + 174 + check_tools() 175 + { 176 + - if ! command -v losetup > /dev/null 2>&1; then 177 + + if ! command -v @losetup@ > /dev/null 2>&1; then 178 + fatal "Unable to find losetup" 179 + fi 180 + @@ -56,5 +56,5 @@ add() 181 + test -f "$file" || fatal "$file does not exist." 182 + 183 + - loopdev=$(losetup -f 2>/dev/null || find_free_loopback_dev) 184 + + loopdev=$(@losetup@ -f 2>/dev/null || find_free_loopback_dev) 185 + if [ "$loopdev" = '' ] 186 + then 187 + @@ -62,5 +62,5 @@ add() 188 + fi 189 + 190 + - if LANG=C losetup -h 2>&1 | grep read-only >/dev/null 191 + + if LANG=C @losetup@ -h 2>&1 | @grep@ read-only >/dev/null 192 + then 193 + roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}" 194 + @@ -69,5 +69,5 @@ add() 195 + fi 196 + 197 + - do_or_die losetup $roflag "$loopdev" "$file" 198 + + do_or_die @losetup@ $roflag "$loopdev" "$file" 199 + # FIXME Is this OK? 200 + xenstore_write "$XENBUS_PATH/node" "$loopdev" 201 + @@ -79,5 +79,5 @@ remove() 202 + { 203 + node=$(xenstore_read "$XENBUS_PATH/node") 204 + - losetup -d "$node" 205 + + @losetup@ -d "$node" 206 + } 207 + 208 + diff --git a/tools/hotplug/Linux/block-enbd b/tools/hotplug/Linux/block-enbd 209 + index 67faa84268..77599ff6df 100644 210 + --- a/tools/hotplug/Linux/block-enbd 211 + +++ b/tools/hotplug/Linux/block-enbd 212 + @@ -8,5 +8,5 @@ 213 + # This assumes you're running a correctly configured server at the other end! 214 + 215 + -dir=$(dirname "$0") 216 + +dir=$(@dirname@ "$0") 217 + . "$dir/block-common.sh" 218 + 219 + @@ -14,5 +14,5 @@ case "$command" in 220 + add) 221 + for dev in /dev/nd*; do 222 + - if nbd-client $2:$3 $dev; then 223 + + if @nbd-client@ $2:$3 $dev; then 224 + write_dev $dev 225 + exit 0 226 + @@ -22,5 +22,5 @@ case "$command" in 227 + ;; 228 + remove) 229 + - nbd-client -d $2 230 + + @nbd-client@ -d $2 231 + exit 0 232 + ;; 233 + diff --git a/tools/hotplug/Linux/block-iscsi b/tools/hotplug/Linux/block-iscsi 234 + index 3615905252..ad45a3685b 100644 235 + --- a/tools/hotplug/Linux/block-iscsi 236 + +++ b/tools/hotplug/Linux/block-iscsi 237 + @@ -24,18 +24,18 @@ 238 + # 239 + 240 + -dir=$(dirname "$0") 241 + +dir=$(@dirname@ "$0") 242 + . "$dir/block-common.sh" 243 + 244 + remove_label() 245 + { 246 + - echo $1 | sed "s/^\("$2"\)//" 247 + + echo $1 | @sed@ "s/^\("$2"\)//" 248 + } 249 + 250 + check_tools() 251 + { 252 + - if ! command -v iscsiadm > /dev/null 2>&1; then 253 + + if ! command -v @iscsiadm@ > /dev/null 2>&1; then 254 + fatal "Unable to find iscsiadm tool" 255 + fi 256 + - if [ "$multipath" = "y" ] && ! command -v multipath > /dev/null 2>&1; then 257 + + if [ "$multipath" = "y" ] && ! command -v @multipath@ > /dev/null 2>&1; then 258 + fatal "Unable to find multipath" 259 + fi 260 + @@ -75,5 +75,5 @@ find_device() 261 + count=0 262 + while [ ! -e /dev/disk/by-path/*"$iqn"-lun-0 ]; do 263 + - sleep 1 264 + + @sleep@ 1 265 + count=`expr $count + 1` 266 + if [ count = 100 ]; then 267 + @@ -82,10 +82,10 @@ find_device() 268 + fi 269 + done 270 + - sddev=$(readlink -f /dev/disk/by-path/*"$iqn"-lun-0 || true) 271 + + sddev=$(@readlink@ -f /dev/disk/by-path/*"$iqn"-lun-0 || true) 272 + if [ ! -b "$sddev" ]; then 273 + fatal "Unable to find attached device path" 274 + fi 275 + if [ "$multipath" = "y" ]; then 276 + - mdev=$(multipath -ll "$sddev" | head -1 | awk '{ print $1}') 277 + + mdev=$(@multipath@ -ll "$sddev" | @head@ -1 | @awk@ '{ print $1}') 278 + if [ ! -b /dev/mapper/"$mdev" ]; then 279 + fatal "Unable to find attached device multipath" 280 + @@ -101,5 +101,5 @@ find_device() 281 + attach() 282 + { 283 + - do_or_die iscsiadm -m node --targetname "$iqn" -p "$portal" --login > /dev/null 284 + + do_or_die @iscsiadm@ -m node --targetname "$iqn" -p "$portal" --login > /dev/null 285 + find_device 286 + } 287 + @@ -110,7 +110,7 @@ prepare() 288 + { 289 + # Check if target is already opened 290 + - iscsiadm -m session 2>&1 | grep -q "$iqn" && fatal "Device already opened" 291 + + @iscsiadm@ -m session 2>&1 | @grep@ -q "$iqn" && fatal "Device already opened" 292 + # Discover portal targets 293 + - iscsiadm -m discovery -t st -p $portal 2>&1 | grep -q "$iqn" || \ 294 + + @iscsiadm@ -m discovery -t st -p $portal 2>&1 | @grep@ -q "$iqn" || \ 295 + fatal "No matching target iqn found" 296 + } 297 + @@ -128,5 +128,5 @@ remove() 298 + { 299 + find_device 300 + - do_or_die iscsiadm -m node --targetname "$iqn" -p "$portal" --logout > /dev/null 301 + + do_or_die @iscsiadm@ -m node --targetname "$iqn" -p "$portal" --logout > /dev/null 302 + } 303 + 304 + diff --git a/tools/hotplug/Linux/block-nbd b/tools/hotplug/Linux/block-nbd 305 + index b29b31564a..a98350b121 100644 306 + --- a/tools/hotplug/Linux/block-nbd 307 + +++ b/tools/hotplug/Linux/block-nbd 308 + @@ -8,5 +8,5 @@ 309 + # This assumes you're running a correctly configured server at the other end! 310 + 311 + -dir=$(dirname "$0") 312 + +dir=$(@dirname@ "$0") 313 + . "$dir/block-common.sh" 314 + 315 + @@ -14,5 +14,5 @@ case "$command" in 316 + add) 317 + for dev in /dev/nbd*; do 318 + - if nbd-client $2 $3 $dev; then 319 + + if @nbd-client@ $2 $3 $dev; then 320 + write_dev $dev 321 + exit 0 322 + @@ -22,5 +22,5 @@ case "$command" in 323 + ;; 324 + remove) 325 + - nbd-client -d $2 326 + + @nbd-client@ -d $2 327 + exit 0 328 + ;; 329 + diff --git a/tools/hotplug/Linux/block-tap b/tools/hotplug/Linux/block-tap 330 + index 95970a61f6..a03a36f8b6 100755 331 + --- a/tools/hotplug/Linux/block-tap 332 + +++ b/tools/hotplug/Linux/block-tap 333 + @@ -29,10 +29,10 @@ 334 + # format/<type> is either "aio" (for raw files), or "vhd" 335 + 336 + -dir=$(dirname "$0") 337 + +dir=$(@dirname@ "$0") 338 + . "$dir/block-common.sh" 339 + 340 + remove_label() 341 + { 342 + - echo $1 | sed "s/^\("$2"\)//" 343 + + echo $1 | @sed@ "s/^\("$2"\)//" 344 + } 345 + 346 + @@ -102,5 +102,5 @@ count_using() 347 + do 348 + f=$(xenstore_read_default "$base_path/$dom/$dev/params" "") 349 + - f=$(echo "$f" | cut -d ":" -f 2) 350 + + f=$(echo "$f" | @cut@ -d ":" -f 2) 351 + 352 + if [ -n "$f" ] && [ "$file" = $f ] ; then 353 + @@ -131,5 +131,5 @@ check_tap_sharing() 354 + for dev in $(xenstore-list "$base_path/$dom") ; do 355 + local f=$(xenstore_read_default "$base_path/$dom/$dev/params" "") 356 + - f=$(echo "$f" | cut -d ":" -f 2) 357 + + f=$(echo "$f" | @cut@ -d ":" -f 2) 358 + 359 + if [ -n "$f" ] && [ "$file" = "$f" ] ; then 360 + diff --git a/tools/hotplug/Linux/colo-proxy-setup b/tools/hotplug/Linux/colo-proxy-setup 361 + index d709146c47..e0f44364cc 100755 362 + --- a/tools/hotplug/Linux/colo-proxy-setup 363 + +++ b/tools/hotplug/Linux/colo-proxy-setup 364 + @@ -1,5 +1,5 @@ 365 + #! /bin/bash 366 + 367 + -dir=$(dirname "$0") 368 + +dir=$(@dirname@ "$0") 369 + . "$dir/xen-hotplug-common.sh" 370 + . "$dir/hotplugpath.sh" 371 + @@ -38,60 +38,60 @@ fi 372 + function setup_primary() 373 + { 374 + - do_without_error tc qdisc add dev $vifname root handle 1: prio 375 + - do_without_error tc filter add dev $vifname parent 1: protocol ip prio 10 \ 376 + + do_without_error @tc@ qdisc add dev $vifname root handle 1: prio 377 + + do_without_error @tc@ filter add dev $vifname parent 1: protocol ip prio 10 \ 378 + u32 match u32 0 0 flowid 1:2 action mirred egress mirror dev $forwarddev 379 + - do_without_error tc filter add dev $vifname parent 1: protocol arp prio 11 \ 380 + + do_without_error @tc@ filter add dev $vifname parent 1: protocol arp prio 11 \ 381 + u32 match u32 0 0 flowid 1:2 action mirred egress mirror dev $forwarddev 382 + - do_without_error tc filter add dev $vifname parent 1: protocol ipv6 prio \ 383 + + do_without_error @tc@ filter add dev $vifname parent 1: protocol ipv6 prio \ 384 + 12 u32 match u32 0 0 flowid 1:2 action mirred egress mirror \ 385 + dev $forwarddev 386 + 387 + - do_without_error modprobe nf_conntrack_ipv4 388 + - do_without_error modprobe xt_PMYCOLO sec_dev=$forwarddev 389 + + do_without_error @modprobe@ nf_conntrack_ipv4 390 + + do_without_error @modprobe@ xt_PMYCOLO sec_dev=$forwarddev 391 + 392 + - iptables -t mangle -I PREROUTING -m physdev --physdev-in \ 393 + + @iptables@ -t mangle -I PREROUTING -m physdev --physdev-in \ 394 + $vifname -j PMYCOLO --index $index 395 + - ip6tables -t mangle -I PREROUTING -m physdev --physdev-in \ 396 + + @ip6tables@ -t mangle -I PREROUTING -m physdev --physdev-in \ 397 + $vifname -j PMYCOLO --index $index 398 + - do_without_error arptables -I INPUT -i $forwarddev -j MARK --set-mark $index 399 + + do_without_error @arptables@ -I INPUT -i $forwarddev -j MARK --set-mark $index 400 + } 401 + 402 + function teardown_primary() 403 + { 404 + - do_without_error tc filter del dev $vifname parent 1: protocol ip prio 10 u32 match u32 \ 405 + + do_without_error @tc@ filter del dev $vifname parent 1: protocol ip prio 10 u32 match u32 \ 406 + 0 0 flowid 1:2 action mirred egress mirror dev $forwarddev 407 + - do_without_error tc filter del dev $vifname parent 1: protocol arp prio 11 u32 match u32 \ 408 + + do_without_error @tc@ filter del dev $vifname parent 1: protocol arp prio 11 u32 match u32 \ 409 + 0 0 flowid 1:2 action mirred egress mirror dev $forwarddev 410 + - do_without_error tc filter del dev $vifname parent 1: protocol ipv6 prio 12 u32 match u32 \ 411 + + do_without_error @tc@ filter del dev $vifname parent 1: protocol ipv6 prio 12 u32 match u32 \ 412 + 0 0 flowid 1:2 action mirred egress mirror dev $forwarddev 413 + - do_without_error tc qdisc del dev $vifname root handle 1: prio 414 + + do_without_error @tc@ qdisc del dev $vifname root handle 1: prio 415 + 416 + - do_without_error iptables -t mangle -D PREROUTING -m physdev --physdev-in \ 417 + + do_without_error @iptables@ -t mangle -D PREROUTING -m physdev --physdev-in \ 418 + $vifname -j PMYCOLO --index $index 419 + - do_without_error ip6tables -t mangle -D PREROUTING -m physdev --physdev-in \ 420 + + do_without_error @ip6tables@ -t mangle -D PREROUTING -m physdev --physdev-in \ 421 + $vifname -j PMYCOLO --index $index 422 + - do_without_error arptables -F 423 + - do_without_error rmmod xt_PMYCOLO 424 + + do_without_error @arptables@ -F 425 + + do_without_error @rmmod@ xt_PMYCOLO 426 + } 427 + 428 + function setup_secondary() 429 + { 430 + - if which brctl >&/dev/null; then 431 + - do_without_error brctl delif $bridge $vifname 432 + - do_without_error brctl addbr $forwardbr 433 + - do_without_error brctl addif $forwardbr $vifname 434 + - do_without_error brctl addif $forwardbr $forwarddev 435 + + if @which@ @brctl@ >&/dev/null; then 436 + + do_without_error @brctl@ delif $bridge $vifname 437 + + do_without_error @brctl@ addbr $forwardbr 438 + + do_without_error @brctl@ addif $forwardbr $vifname 439 + + do_without_error @brctl@ addif $forwardbr $forwarddev 440 + else 441 + - do_without_error ip link set $vifname nomaster 442 + - do_without_error ip link add name $forwardbr type bridge 443 + - do_without_error ip link set $vifname master $forwardbr 444 + - do_without_error ip link set $forwarddev master $forwardbr 445 + + do_without_error @ip@ link set $vifname nomaster 446 + + do_without_error @ip@ link add name $forwardbr type bridge 447 + + do_without_error @ip@ link set $vifname master $forwardbr 448 + + do_without_error @ip@ link set $forwarddev master $forwardbr 449 + fi 450 + - do_without_error ip link set dev $forwardbr up 451 + - do_without_error modprobe xt_SECCOLO 452 + + do_without_error @ip@ link set dev $forwardbr up 453 + + do_without_error @modprobe@ xt_SECCOLO 454 + 455 + - iptables -t mangle -I PREROUTING -m physdev --physdev-in \ 456 + + @iptables@ -t mangle -I PREROUTING -m physdev --physdev-in \ 457 + $vifname -j SECCOLO --index $index 458 + - ip6tables -t mangle -I PREROUTING -m physdev --physdev-in \ 459 + + @ip6tables@ -t mangle -I PREROUTING -m physdev --physdev-in \ 460 + $vifname -j SECCOLO --index $index 461 + } 462 + @@ -99,21 +99,21 @@ function setup_secondary() 463 + function teardown_secondary() 464 + { 465 + - if which brctl >&/dev/null; then 466 + - do_without_error brctl delif $forwardbr $forwarddev 467 + - do_without_error brctl delif $forwardbr $vifname 468 + - do_without_error brctl delbr $forwardbr 469 + - do_without_error brctl addif $bridge $vifname 470 + + if @which@ @brctl@ >&/dev/null; then 471 + + do_without_error @brctl@ delif $forwardbr $forwarddev 472 + + do_without_error @brctl@ delif $forwardbr $vifname 473 + + do_without_error @brctl@ delbr $forwardbr 474 + + do_without_error @brctl@ addif $bridge $vifname 475 + else 476 + - do_without_error ip link set $forwarddev nomaster 477 + - do_without_error ip link set $vifname nomaster 478 + - do_without_error ip link delete $forwardbr type bridge 479 + - do_without_error ip link set $vifname master $bridge 480 + + do_without_error @ip@ link set $forwarddev nomaster 481 + + do_without_error @ip@ link set $vifname nomaster 482 + + do_without_error @ip@ link delete $forwardbr type bridge 483 + + do_without_error @ip@ link set $vifname master $bridge 484 + fi 485 + 486 + - do_without_error iptables -t mangle -D PREROUTING -m physdev --physdev-in \ 487 + + do_without_error @iptables@ -t mangle -D PREROUTING -m physdev --physdev-in \ 488 + $vifname -j SECCOLO --index $index 489 + - do_without_error ip6tables -t mangle -D PREROUTING -m physdev --physdev-in \ 490 + + do_without_error @ip6tables@ -t mangle -D PREROUTING -m physdev --physdev-in \ 491 + $vifname -j SECCOLO --index $index 492 + - do_without_error rmmod xt_SECCOLO 493 + + do_without_error @rmmod@ xt_SECCOLO 494 + } 495 + 496 + diff --git a/tools/hotplug/Linux/external-device-migrate b/tools/hotplug/Linux/external-device-migrate 497 + index f5942a6a95..228917b784 100644 498 + --- a/tools/hotplug/Linux/external-device-migrate 499 + +++ b/tools/hotplug/Linux/external-device-migrate 500 + @@ -24,10 +24,10 @@ set -x 501 + # synchronization 502 + 503 + -dir=$(dirname "$0") 504 + +dir=$(@dirname@ "$0") 505 + . "$dir/logging.sh" 506 + 507 + 508 + function ext_dev_migrate_usage() { 509 + -cat <<EOF 510 + +@cat@ <<EOF 511 + Pass the following command line parameters to the script: 512 + 513 + diff --git a/tools/hotplug/Linux/init.d/xen-watchdog.in b/tools/hotplug/Linux/init.d/xen-watchdog.in 514 + index a0bde199c4..cefa3b81f8 100644 515 + --- a/tools/hotplug/Linux/init.d/xen-watchdog.in 516 + +++ b/tools/hotplug/Linux/init.d/xen-watchdog.in 517 + @@ -26,5 +26,5 @@ test -f $xencommons_config/xencommons && . $xencommons_config/xencommons 518 + test -n "$XENWATCHDOGD_ARGS" || XENWATCHDOGD_ARGS='30 15' 519 + DAEMON=${sbindir}/xenwatchdogd 520 + -base=$(basename $DAEMON) 521 + +base=$(@basename@ $DAEMON) 522 + 523 + # Source function library. 524 + @@ -64,5 +64,5 @@ stop() { 525 + echo -n $"Stopping domain watchdog daemon: " 526 + 527 + - killall -USR1 $base 2>/dev/null 528 + + @killall@ -USR1 $base 2>/dev/null 529 + r=$? 530 + [ "$r" -eq 0 ] && success $"$base stop" || failure $"$base stop" 531 + diff --git a/tools/hotplug/Linux/init.d/xencommons.in b/tools/hotplug/Linux/init.d/xencommons.in 532 + index 7fd6903b98..dcc8de631b 100644 533 + --- a/tools/hotplug/Linux/init.d/xencommons.in 534 + +++ b/tools/hotplug/Linux/init.d/xencommons.in 535 + @@ -39,5 +39,5 @@ fi 536 + if test "x$1" = xstart && \ 537 + ! test -f /proc/xen/capabilities && \ 538 + - ! grep '^xenfs ' /proc/mounts >/dev/null; 539 + + ! @grep@ '^xenfs ' /proc/mounts >/dev/null; 540 + then 541 + mount -t xenfs xenfs /proc/xen 542 + @@ -48,5 +48,5 @@ fi 543 + # empty capabilities file in pv_ops domU kernel 544 + if test -f /proc/xen/capabilities && \ 545 + - ! grep -q "control_d" /proc/xen/capabilities ; then 546 + + ! @grep@ -q "control_d" /proc/xen/capabilities ; then 547 + exit 0 548 + fi 549 + @@ -55,9 +55,9 @@ do_start () { 550 + local mod 551 + 552 + - for mod in $BACKEND_MODULES ; do modprobe "$mod" &>/dev/null ; done 553 + + for mod in $BACKEND_MODULES ; do @modprobe@ "$mod" &>/dev/null ; done 554 + 555 + - mkdir -m700 -p ${XEN_RUN_DIR} 556 + - mkdir -m700 -p ${XEN_LOCK_DIR} 557 + - mkdir -p ${XEN_LOG_DIR} 558 + + @mkdir@ -m700 -p ${XEN_RUN_DIR} 559 + + @mkdir@ -m700 -p ${XEN_LOCK_DIR} 560 + + @mkdir@ -p ${XEN_LOG_DIR} 561 + 562 + @XEN_SCRIPT_DIR@/launch-xenstore || exit 1 563 + @@ -79,6 +79,6 @@ do_stop () { 564 + if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then 565 + kill $pid 566 + - while kill -9 $pid >/dev/null 2>&1; do sleep 1; done 567 + - rm -f $XENCONSOLED_PIDFILE 568 + + while kill -9 $pid >/dev/null 2>&1; do @sleep@ 1; done 569 + + @rm@ -f $XENCONSOLED_PIDFILE 570 + fi 571 + 572 + @@ -86,6 +86,6 @@ do_stop () { 573 + if read 2>/dev/null <$QEMU_PIDFILE pid; then 574 + kill $pid 575 + - while kill -9 $pid >/dev/null 2>&1; do sleep 1; done 576 + - rm -f $QEMU_PIDFILE 577 + + while kill -9 $pid >/dev/null 2>&1; do @sleep@ 1; done 578 + + @rm@ -f $QEMU_PIDFILE 579 + fi 580 + 581 + diff --git a/tools/hotplug/Linux/init.d/xendriverdomain.in b/tools/hotplug/Linux/init.d/xendriverdomain.in 582 + index 17b381c3dc..064906f027 100644 583 + --- a/tools/hotplug/Linux/init.d/xendriverdomain.in 584 + +++ b/tools/hotplug/Linux/init.d/xendriverdomain.in 585 + @@ -35,5 +35,5 @@ fi 586 + if test "x$1" = xstart && \ 587 + ! test -f /proc/xen/capabilities && \ 588 + - ! grep '^xenfs ' /proc/mounts >/dev/null; 589 + + ! @grep@ '^xenfs ' /proc/mounts >/dev/null; 590 + then 591 + mount -t xenfs xenfs /proc/xen 592 + @@ -44,5 +44,5 @@ fi 593 + # empty capabilities file in pv_ops domU kernel 594 + if ! test -f /proc/xen/capabilities || \ 595 + - grep -q "control_d" /proc/xen/capabilities ; then 596 + + @grep@ -q "control_d" /proc/xen/capabilities ; then 597 + exit 0 598 + fi 599 + @@ -50,5 +50,5 @@ fi 600 + do_start () { 601 + echo Starting xl devd... 602 + - mkdir -p "${XEN_RUN_DIR}" 603 + + @mkdir@ -p "${XEN_RUN_DIR}" 604 + ${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE $XLDEVD_ARGS 605 + } 606 + @@ -57,6 +57,6 @@ do_stop () { 607 + if read 2>/dev/null <$XLDEVD_PIDFILE pid; then 608 + kill $pid 609 + - while kill -9 $pid >/dev/null 2>&1; do sleep 1; done 610 + - rm -f $XLDEVD_PIDFILE 611 + + while kill -9 $pid >/dev/null 2>&1; do @sleep@ 1; done 612 + + @rm@ -f $XLDEVD_PIDFILE 613 + fi 614 + } 615 + diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in 616 + index da4eeca7c5..059036d899 100644 617 + --- a/tools/hotplug/Linux/launch-xenstore.in 618 + +++ b/tools/hotplug/Linux/launch-xenstore.in 619 + @@ -32,5 +32,5 @@ timeout_xenstore () { 620 + echo -n . 621 + time=$(($time+1)) 622 + - sleep 1 623 + + @sleep@ 1 624 + done 625 + echo 626 + @@ -51,5 +51,5 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF 627 + [ "$XENSTORETYPE" = "" ] && XENSTORETYPE=daemon 628 + 629 + -/bin/mkdir -p @XEN_RUN_DIR@ 630 + +@mkdir@ -p @XEN_RUN_DIR@ 631 + 632 + [ "$XENSTORETYPE" = "daemon" ] && { 633 + @@ -72,5 +72,5 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF 634 + } 635 + [ -r /proc/sys/fs/nr_open ] && { 636 + - MAX_FDS=`cat /proc/sys/fs/nr_open` 637 + + MAX_FDS=`@cat@ /proc/sys/fs/nr_open` 638 + [ "$XENSTORED_MAX_OPEN_FDS" = "unlimited" ] && XENSTORED_MAX_OPEN_FDS=$MAX_FDS 639 + [ $XENSTORED_MAX_OPEN_FDS -gt $MAX_FDS ] && { 640 + @@ -81,11 +81,11 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF 641 + } 642 + 643 + - rm -f @XEN_RUN_DIR@/xenstored.pid 644 + + @rm@ -f @XEN_RUN_DIR@/xenstored.pid 645 + 646 + echo -n Starting $XENSTORED... 647 + - prlimit --nofile=$XENSTORED_MAX_OPEN_FDS $XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS 648 + + @prlimit@ --nofile=$XENSTORED_MAX_OPEN_FDS $XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS 649 + 650 + - systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || exit 1 651 + - XS_PID=`cat @XEN_RUN_DIR@/xenstored.pid` 652 + + @systemd-notify@ --booted 2>/dev/null || timeout_xenstore $XENSTORED || exit 1 653 + + XS_PID=`@cat@ @XEN_RUN_DIR@/xenstored.pid` 654 + echo $XS_OOM_SCORE >/proc/$XS_PID/oom_score_adj 655 + 656 + @@ -103,5 +103,5 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF 657 + echo -n Starting $XENSTORE_DOMAIN_KERNEL... 658 + ${LIBEXEC_BIN}/init-xenstore-domain $XENSTORE_DOMAIN_ARGS || exit 1 659 + - systemd-notify --ready 2>/dev/null 660 + + @systemd-notify@ --ready 2>/dev/null 661 + 662 + exit 0 663 + diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh 664 + index 2e6fb35f02..5860157657 100644 665 + --- a/tools/hotplug/Linux/locking.sh 666 + +++ b/tools/hotplug/Linux/locking.sh 667 + @@ -36,5 +36,5 @@ _setlockfd() 668 + claim_lock() 669 + { 670 + - mkdir -p "$LOCK_BASEDIR" 671 + + @mkdir@ -p "$LOCK_BASEDIR" 672 + _setlockfd $1 673 + # The locking strategy is identical to that from with-lock-ex(1) 674 + @@ -45,5 +45,5 @@ claim_lock() 675 + while true; do 676 + eval "exec $_lockfd<>$_lockfile" 677 + - flock -x $_lockfd || return $? 678 + + @flock@ -x $_lockfd || return $? 679 + # Although /dev/stdin (i.e. /proc/self/fd/0) looks like a symlink, 680 + # stat(2) bypasses the synthetic symlink and directly accesses the 681 + @@ -53,5 +53,5 @@ claim_lock() 682 + # YY.ZZZ 683 + # which need to be separated and compared. 684 + - if stat=$( stat -L -c '%D.%i' /dev/stdin $_lockfile 0<&$_lockfd 2>/dev/null ) 685 + + if stat=$( @stat@ -L -c '%D.%i' /dev/stdin $_lockfile 0<&$_lockfd 2>/dev/null ) 686 + then 687 + local file_stat 688 + @@ -75,5 +75,5 @@ release_lock() 689 + { 690 + _setlockfd $1 691 + - rm "$_lockfile" 692 + + @rm@ "$_lockfile" 693 + } 694 + 695 + diff --git a/tools/hotplug/Linux/logging.sh b/tools/hotplug/Linux/logging.sh 696 + index 3e94df1a9e..fa99d8c4c7 100644 697 + --- a/tools/hotplug/Linux/logging.sh 698 + +++ b/tools/hotplug/Linux/logging.sh 699 + @@ -18,4 +18,4 @@ log() { 700 + local level="$1" 701 + shift 702 + - logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2 703 + + @logger@ -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2 704 + } 705 + diff --git a/tools/hotplug/Linux/remus-netbuf-setup b/tools/hotplug/Linux/remus-netbuf-setup 706 + index 87dfa69778..fe4f7b6e36 100644 707 + --- a/tools/hotplug/Linux/remus-netbuf-setup 708 + +++ b/tools/hotplug/Linux/remus-netbuf-setup 709 + @@ -75,5 +75,5 @@ 710 + # Unlike other vif scripts, vif-common is not needed here as it executes vif 711 + #specific setup code such as renaming. 712 + -dir=$(dirname "$0") 713 + +dir=$(@dirname@ "$0") 714 + . "$dir/xen-hotplug-common.sh" 715 + 716 + @@ -93,11 +93,11 @@ evalVariables "$@" 717 + 718 + check_libnl_tools() { 719 + - if ! command -v nl-qdisc-list > /dev/null 2>&1; then 720 + + if ! command -v @nl-qdisc-list@ > /dev/null 2>&1; then 721 + fatal "Unable to find nl-qdisc-list tool" 722 + fi 723 + - if ! command -v nl-qdisc-add > /dev/null 2>&1; then 724 + + if ! command -v @nl-qdisc-add@ > /dev/null 2>&1; then 725 + fatal "Unable to find nl-qdisc-add tool" 726 + fi 727 + - if ! command -v nl-qdisc-delete > /dev/null 2>&1; then 728 + + if ! command -v @nl-qdisc-delete@ > /dev/null 2>&1; then 729 + fatal "Unable to find nl-qdisc-delete tool" 730 + fi 731 + @@ -111,5 +111,5 @@ check_modules() { 732 + for m in ifb sch_plug sch_ingress act_mirred cls_u32 733 + do 734 + - if ! modinfo $m > /dev/null 2>&1; then 735 + + if ! @modinfo@ $m > /dev/null 2>&1; then 736 + fatal "Unable to find $m kernel module" 737 + fi 738 + @@ -119,5 +119,5 @@ check_modules() { 739 + #return 0 if the ifb is free 740 + check_ifb() { 741 + - local installed=`nl-qdisc-list -d $1` 742 + + local installed=`@nl-qdisc-list@ -d $1` 743 + [ -n "$installed" ] && return 1 744 + 745 + @@ -140,5 +140,5 @@ check_ifb() { 746 + setup_ifb() { 747 + 748 + - for ifb in `ifconfig -a -s|egrep ^ifb|cut -d ' ' -f1` 749 + + for ifb in `@ifconfig@ -a -s|@egrep@ ^ifb|@cut@ -d ' ' -f1` 750 + do 751 + check_ifb "$ifb" || continue 752 + @@ -155,5 +155,5 @@ setup_ifb() { 753 + #because we need to cleanup 754 + xenstore_write "$XENBUS_PATH/ifb" "$REMUS_IFB" 755 + - do_or_die ip link set dev "$REMUS_IFB" up 756 + + do_or_die @ip@ link set dev "$REMUS_IFB" up 757 + } 758 + 759 + @@ -162,12 +162,12 @@ redirect_vif_traffic() { 760 + local ifb=$2 761 + 762 + - do_or_die tc qdisc add dev "$vif" ingress 763 + + do_or_die @tc@ qdisc add dev "$vif" ingress 764 + 765 + - tc filter add dev "$vif" parent ffff: proto ip prio 10 \ 766 + + @tc@ filter add dev "$vif" parent ffff: proto ip prio 10 \ 767 + u32 match u32 0 0 action mirred egress redirect dev "$ifb" >/dev/null 2>&1 768 + 769 + if [ $? -ne 0 ] 770 + then 771 + - do_without_error tc qdisc del dev "$vif" ingress 772 + + do_without_error @tc@ qdisc del dev "$vif" ingress 773 + fatal "Failed to redirect traffic from $vif to $ifb" 774 + fi 775 + @@ -178,13 +178,13 @@ add_plug_qdisc() { 776 + local ifb=$2 777 + 778 + - nl-qdisc-add --dev="$ifb" --parent root plug >/dev/null 2>&1 779 + + @nl-qdisc-add@ --dev="$ifb" --parent root plug >/dev/null 2>&1 780 + if [ $? -ne 0 ] 781 + then 782 + - do_without_error tc qdisc del dev "$vif" ingress 783 + + do_without_error @tc@ qdisc del dev "$vif" ingress 784 + fatal "Failed to add plug qdisc to $ifb" 785 + fi 786 + 787 + #set ifb buffering limit in bytes. Its okay if this command fails 788 + - nl-qdisc-add --dev="$ifb" --parent root \ 789 + + @nl-qdisc-add@ --dev="$ifb" --parent root \ 790 + --update plug --limit=10000000 >/dev/null 2>&1 || true 791 + } 792 + @@ -201,9 +201,9 @@ teardown_netbuf() { 793 + 794 + if [[ "$ifb2" && "$ifb2" == "$ifb" ]]; then 795 + - do_without_error ip link set dev "$ifb" down 796 + - do_without_error nl-qdisc-delete --dev="$ifb" --parent root plug >/dev/null 2>&1 797 + + do_without_error @ip@ link set dev "$ifb" down 798 + + do_without_error @nl-qdisc-delete@ --dev="$ifb" --parent root plug >/dev/null 2>&1 799 + xenstore-rm -t "$XENBUS_PATH/ifb" 2>/dev/null || true 800 + fi 801 + - do_without_error tc qdisc del dev "$vif" ingress 802 + + do_without_error @tc@ qdisc del dev "$vif" ingress 803 + xenstore-rm -t "$XENBUS_PATH/hotplug-status" 2>/dev/null || true 804 + xenstore-rm -t "$XENBUS_PATH/hotplug-error" 2>/dev/null || true 805 + diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in 806 + index 98779b8507..cc75339377 100644 807 + --- a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in 808 + +++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in 809 + @@ -9,5 +9,5 @@ Type=oneshot 810 + RemainAfterExit=true 811 + EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons 812 + -ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities 813 + +ExecStartPre=@grep@ -q control_d /proc/xen/capabilities 814 + ExecStart=@LIBEXEC_BIN@/xen-init-dom0 $XEN_DOM0_UUID 815 + 816 + diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in 817 + index f56775bc87..a9091047da 100644 818 + --- a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in 819 + +++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in 820 + @@ -10,6 +10,6 @@ ConditionPathExists=/proc/xen/capabilities 821 + Type=simple 822 + PIDFile=@XEN_RUN_DIR@/qemu-dom0.pid 823 + -ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities 824 + -ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ 825 + +ExecStartPre=@grep@ -q control_d /proc/xen/capabilities 826 + +ExecStartPre=@mkdir@ -p @XEN_RUN_DIR@ 827 + ExecStart=@qemu_xen_systemd@ -xen-domid 0 \ 828 + -xen-attach -name dom0 -nographic -M xenpv -daemonize \ 829 + diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in 830 + index d84c09aa9c..68317246ae 100644 831 + --- a/tools/hotplug/Linux/systemd/xenconsoled.service.in 832 + +++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in 833 + @@ -11,6 +11,6 @@ Environment=XENCONSOLED_TRACE=none 834 + Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console 835 + EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons 836 + -ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities 837 + -ExecStartPre=/bin/mkdir -p ${XENCONSOLED_LOG_DIR} @XEN_RUN_DIR@ 838 + +ExecStartPre=@grep@ -q control_d /proc/xen/capabilities 839 + +ExecStartPre=@mkdir@ -p ${XENCONSOLED_LOG_DIR} @XEN_RUN_DIR@ 840 + ExecStart=@sbindir@/xenconsoled -i --log=${XENCONSOLED_TRACE} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS 841 + 842 + diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in 843 + index c7bfb61eb4..314ed9e91a 100644 844 + --- a/tools/hotplug/Linux/systemd/xendomains.service.in 845 + +++ b/tools/hotplug/Linux/systemd/xendomains.service.in 846 + @@ -11,5 +11,5 @@ Conflicts=libvirtd.service 847 + Type=oneshot 848 + RemainAfterExit=true 849 + -ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities 850 + +ExecStartPre=@grep@ -q control_d /proc/xen/capabilities 851 + ExecStart=-@LIBEXEC_BIN@/xendomains start 852 + ExecStop=@LIBEXEC_BIN@/xendomains stop 853 + diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in 854 + index 261077dc92..7daf7369b8 100644 855 + --- a/tools/hotplug/Linux/systemd/xenstored.service.in 856 + +++ b/tools/hotplug/Linux/systemd/xenstored.service.in 857 + @@ -11,5 +11,5 @@ Type=notify 858 + NotifyAccess=all 859 + RemainAfterExit=true 860 + -ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities 861 + +ExecStartPre=@grep@ -q control_d /proc/xen/capabilities 862 + ExecStart=@XEN_SCRIPT_DIR@/launch-xenstore 863 + 864 + diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge 865 + index 906047e82f..e110013b14 100644 866 + --- a/tools/hotplug/Linux/vif-bridge 867 + +++ b/tools/hotplug/Linux/vif-bridge 868 + @@ -26,5 +26,5 @@ 869 + #============================================================================ 870 + 871 + -dir=$(dirname "$0") 872 + +dir=$(@dirname@ "$0") 873 + . "$dir/vif-common.sh" 874 + 875 + @@ -33,8 +33,8 @@ bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge") 876 + 877 + if [ -z "$bridge" ]; then 878 + - if which brctl >&/dev/null; then 879 + - bridge=$(brctl show | awk 'NR==2{print$1}') 880 + + if @which@ @brctl@ >&/dev/null; then 881 + + bridge=$(@brctl@ show | @awk@ 'NR==2{print$1}') 882 + else 883 + - bridge=$(bridge link | cut -d" " -f7) 884 + + bridge=$(@bridge@ link | @cut@ -d" " -f7) 885 + fi 886 + if [ -z "$bridge" ] 887 + @@ -71,5 +71,5 @@ fi 888 + 889 + RET=0 890 + -ip link show dev "$bridge" 1>/dev/null 2>&1 || RET=1 891 + +@ip@ link show dev "$bridge" 1>/dev/null 2>&1 || RET=1 892 + if [ "$RET" -eq 1 ] 893 + then 894 + diff --git a/tools/hotplug/Linux/vif-common.sh b/tools/hotplug/Linux/vif-common.sh 895 + index a8e65178f9..28eb851f94 100644 896 + --- a/tools/hotplug/Linux/vif-common.sh 897 + +++ b/tools/hotplug/Linux/vif-common.sh 898 + @@ -16,5 +16,5 @@ 899 + 900 + 901 + -dir=$(dirname "$0") 902 + +dir=$(@dirname@ "$0") 903 + . "$dir/xen-hotplug-common.sh" 904 + . "$dir/xen-network-common.sh" 905 + @@ -73,9 +73,9 @@ rename_vif() { 906 + # that interface (e.g. another running domU) because it's likely a 907 + # configuration error 908 + - if ip link show "$vifname" >&/dev/null 909 + + if @ip@ link show "$vifname" >&/dev/null 910 + then 911 + fatal "Cannot rename interface $dev. An interface with name $vifname already exists." 912 + fi 913 + - do_or_die ip link set "$dev" name "$vifname" 914 + + do_or_die @ip@ link set "$dev" name "$vifname" 915 + } 916 + 917 + @@ -135,10 +135,10 @@ iptables_w() 918 + { 919 + if ! $IPTABLES_WAIT_RUNE_CHECKED ; then 920 + - iptables $IPTABLES_WAIT_RUNE -L -n >& /dev/null 921 + + @iptables@ $IPTABLES_WAIT_RUNE -L -n >& /dev/null 922 + if [[ $? == 0 ]] ; then 923 + # If we succeed, then -w is supported; don't check again 924 + IPTABLES_WAIT_RUNE_CHECKED=true 925 + elif [[ $? == 2 ]] ; then 926 + - iptables -L -n >& /dev/null 927 + + @iptables@ -L -n >& /dev/null 928 + if [[ $? != 2 ]] ; then 929 + # If we fail with PARAMETER_PROBLEM (2) with -w and 930 + @@ -150,5 +150,5 @@ iptables_w() 931 + fi 932 + fi 933 + - iptables $IPTABLES_WAIT_RUNE "$@" 934 + + @iptables@ $IPTABLES_WAIT_RUNE "$@" 935 + } 936 + 937 + @@ -221,5 +221,5 @@ handle_iptable() 938 + ip_of() 939 + { 940 + - ip -4 -o addr show primary dev "$1" | awk '$3 == "inet" {split($4,i,"/"); print i[1]; exit}' 941 + + @ip@ -4 -o addr show primary dev "$1" | @awk@ '$3 == "inet" {split($4,i,"/"); print i[1]; exit}' 942 + } 943 + 944 + diff --git a/tools/hotplug/Linux/vif-nat b/tools/hotplug/Linux/vif-nat 945 + index fd34afbb96..8921de58f3 100644 946 + --- a/tools/hotplug/Linux/vif-nat 947 + +++ b/tools/hotplug/Linux/vif-nat 948 + @@ -22,5 +22,5 @@ 949 + 950 + 951 + -dir=$(dirname "$0") 952 + +dir=$(@dirname@ "$0") 953 + . "$dir/vif-common.sh" 954 + 955 + @@ -62,5 +62,5 @@ ip_from_dom() 956 + routing_ip() 957 + { 958 + - echo $(echo $1 | awk -F. '{print $1"."$2"."$3"."$4 + 127}') 959 + + echo $(echo $1 | @awk@ -F. '{print $1"."$2"."$3"."$4 + 127}') 960 + } 961 + 962 + @@ -84,5 +84,5 @@ router_ip=$(routing_ip "$ip") 963 + 964 + # Split the given IP/bits pair. 965 + -vif_ip=`echo ${ip} | awk -F/ '{print $1}'` 966 + +vif_ip=`echo ${ip} | @awk@ -F/ '{print $1}'` 967 + 968 + hostname=dom$domid 969 + @@ -94,11 +94,11 @@ fi 970 + dhcparg_remove_entry() 971 + { 972 + - local tmpfile=$(mktemp) 973 + - sed -e "s/${dev} //" "$dhcpd_arg_file" >"$tmpfile" 974 + - if ! diff "$tmpfile" "$dhcpd_arg_file" >/dev/null 975 + + local tmpfile=$(@mktemp@) 976 + + @sed@ -e "s/${dev} //" "$dhcpd_arg_file" >"$tmpfile" 977 + + if ! @diff@ "$tmpfile" "$dhcpd_arg_file" >/dev/null 978 + then 979 + - cp "$tmpfile" "$dhcpd_arg_file" 980 + + @cp@ "$tmpfile" "$dhcpd_arg_file" 981 + fi 982 + - rm "$tmpfile" 983 + + @rm@ "$tmpfile" 984 + } 985 + 986 + @@ -106,24 +106,24 @@ dhcparg_add_entry() 987 + { 988 + dhcparg_remove_entry 989 + - local tmpfile=$(mktemp) 990 + + local tmpfile=$(@mktemp@) 991 + # handle Red Hat, SUSE, and Debian styles, with or without quotes 992 + - sed -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"${dev} "'"/' \ 993 + - "$dhcpd_arg_file" >"$tmpfile" && cp "$tmpfile" "$dhcpd_arg_file" 994 + - sed -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"${dev} "'"/' \ 995 + - "$dhcpd_arg_file" >"$tmpfile" && cp "$tmpfile" "$dhcpd_arg_file" 996 + - sed -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"${dev} "'"/' \ 997 + - "$dhcpd_arg_file" >"$tmpfile" && cp "$tmpfile" "$dhcpd_arg_file" 998 + - rm -f "$tmpfile" 999 + + @sed@ -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"${dev} "'"/' \ 1000 + + "$dhcpd_arg_file" >"$tmpfile" && @cp@ "$tmpfile" "$dhcpd_arg_file" 1001 + + @sed@ -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"${dev} "'"/' \ 1002 + + "$dhcpd_arg_file" >"$tmpfile" && @cp@ "$tmpfile" "$dhcpd_arg_file" 1003 + + @sed@ -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"${dev} "'"/' \ 1004 + + "$dhcpd_arg_file" >"$tmpfile" && @cp@ "$tmpfile" "$dhcpd_arg_file" 1005 + + @rm@ -f "$tmpfile" 1006 + } 1007 + 1008 + dhcp_remove_entry() 1009 + { 1010 + - local tmpfile=$(mktemp) 1011 + - grep -v "host $hostname" "$dhcpd_conf_file" >"$tmpfile" 1012 + - if ! diff "$tmpfile" "$dhcpd_conf_file" >/dev/null 1013 + + local tmpfile=$(@mktemp@) 1014 + + @grep@ -v "host $hostname" "$dhcpd_conf_file" >"$tmpfile" 1015 + + if ! @diff@ "$tmpfile" "$dhcpd_conf_file" >/dev/null 1016 + then 1017 + - cp "$tmpfile" "$dhcpd_conf_file" 1018 + + @cp@ "$tmpfile" "$dhcpd_conf_file" 1019 + fi 1020 + - rm "$tmpfile" 1021 + + @rm@ "$tmpfile" 1022 + dhcparg_remove_entry 1023 + } 1024 + @@ -159,5 +159,5 @@ dhcp_down() 1025 + case "$command" in 1026 + online) 1027 + - if ip route | grep -q "dev ${dev}" 1028 + + if @ip@ route | @grep@ -q "dev ${dev}" 1029 + then 1030 + log debug "${dev} already up" 1031 + @@ -165,7 +165,7 @@ case "$command" in 1032 + fi 1033 + 1034 + - do_or_die ip link set dev "${dev}" up arp on 1035 + - do_or_die ip addr add "$router_ip" dev "${dev}" 1036 + - do_or_die ip route add "$vif_ip" dev "${dev}" src "$router_ip" 1037 + + do_or_die @ip@ link set dev "${dev}" up arp on 1038 + + do_or_die @ip@ addr add "$router_ip" dev "${dev}" 1039 + + do_or_die @ip@ route add "$vif_ip" dev "${dev}" src "$router_ip" 1040 + echo 1 >/proc/sys/net/ipv4/conf/${dev}/proxy_arp 1041 + [ "$dhcp" != 'no' ] && dhcp_up 1042 + @@ -173,5 +173,5 @@ case "$command" in 1043 + offline) 1044 + [ "$dhcp" != 'no' ] && dhcp_down 1045 + - do_without_error ifconfig "${dev}" down 1046 + + do_without_error @ifconfig@ "${dev}" down 1047 + ;; 1048 + esac 1049 + diff --git a/tools/hotplug/Linux/vif-openvswitch b/tools/hotplug/Linux/vif-openvswitch 1050 + index 18bfb6cefb..ea983481a3 100644 1051 + --- a/tools/hotplug/Linux/vif-openvswitch 1052 + +++ b/tools/hotplug/Linux/vif-openvswitch 1053 + @@ -25,13 +25,13 @@ 1054 + #============================================================================ 1055 + 1056 + -dir=$(dirname "$0") 1057 + +dir=$(@dirname@ "$0") 1058 + . "$dir/vif-common.sh" 1059 + 1060 + check_tools() 1061 + { 1062 + - if ! command -v ovs-vsctl > /dev/null 2>&1; then 1063 + + if ! command -v @ovs-vsctl@ > /dev/null 2>&1; then 1064 + fatal "Unable to find ovs-vsctl tool" 1065 + fi 1066 + - if ! command -v ip > /dev/null 2>&1; then 1067 + + if ! command -v @ip@ > /dev/null 2>&1; then 1068 + fatal "Unable to find ip tool" 1069 + fi 1070 + @@ -80,8 +80,8 @@ add_to_openvswitch () { 1071 + local vif_details="$(openvswitch_external_id_all $dev)" 1072 + 1073 + - do_or_die ovs-vsctl --timeout=30 \ 1074 + + do_or_die @ovs-vsctl@ --timeout=30 \ 1075 + -- --if-exists del-port $dev \ 1076 + -- add-port "$bridge" $dev $tag_arg $trunk_arg $vif_details 1077 + - do_or_die ip link set $dev up 1078 + + do_or_die @ip@ link set $dev up 1079 + } 1080 + 1081 + @@ -94,7 +94,7 @@ case "$command" in 1082 + 1083 + remove|offline) 1084 + - do_without_error ovs-vsctl --timeout=30 \ 1085 + + do_without_error @ovs-vsctl@ --timeout=30 \ 1086 + -- --if-exists del-port $dev 1087 + - do_without_error ip link set $dev down 1088 + + do_without_error @ip@ link set $dev down 1089 + ;; 1090 + esac 1091 + diff --git a/tools/hotplug/Linux/vif-route b/tools/hotplug/Linux/vif-route 1092 + index 9cd417a005..98d67a8659 100755 1093 + --- a/tools/hotplug/Linux/vif-route 1094 + +++ b/tools/hotplug/Linux/vif-route 1095 + @@ -17,5 +17,5 @@ 1096 + #============================================================================ 1097 + 1098 + -dir=$(dirname "$0") 1099 + +dir=$(@dirname@ "$0") 1100 + . "${dir}/vif-common.sh" 1101 + 1102 + @@ -24,5 +24,5 @@ main_ip=$(dom0_ip) 1103 + case "${command}" in 1104 + add|online) 1105 + - ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up 1106 + + @ifconfig@ ${dev} ${main_ip} netmask 255.255.255.255 up 1107 + echo 1 >/proc/sys/net/ipv4/conf/${dev}/proxy_arp 1108 + ipcmd='add' 1109 + @@ -51,5 +51,5 @@ esac 1110 + # the guest using those addresses. 1111 + for addr in ${ip} ; do 1112 + - ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} src ${main_ip} metric ${metric} 1113 + + ${cmdprefix} @ip@ route ${ipcmd} ${addr} dev ${dev} src ${main_ip} metric ${metric} 1114 + done 1115 + 1116 + diff --git a/tools/hotplug/Linux/vscsi b/tools/hotplug/Linux/vscsi 1117 + index 5ac26147ec..8f297e05df 100644 1118 + --- a/tools/hotplug/Linux/vscsi 1119 + +++ b/tools/hotplug/Linux/vscsi 1120 + @@ -5,5 +5,5 @@ 1121 + # 1122 + 1123 + -dir=$(dirname "$0") 1124 + +dir=$(@dirname@ "$0") 1125 + . "$dir/xen-hotplug-common.sh" 1126 + 1127 + diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh.in b/tools/hotplug/Linux/xen-hotplug-common.sh.in 1128 + index 8c2cb9e25a..e9c64efcb0 100644 1129 + --- a/tools/hotplug/Linux/xen-hotplug-common.sh.in 1130 + +++ b/tools/hotplug/Linux/xen-hotplug-common.sh.in 1131 + @@ -15,5 +15,5 @@ 1132 + # 1133 + 1134 + -dir=$(dirname "$0") 1135 + +dir=$(@dirname@ "$0") 1136 + . "$dir/hotplugpath.sh" 1137 + . "$dir/logging.sh" 1138 + @@ -26,5 +26,5 @@ export PATH="${bindir}:${sbindir}:${LIBEXEC_BIN}:/sbin:/bin:/usr/bin:/usr/sbin:$ 1139 + export LD_LIBRARY_PATH="${libdir}${LD_LIBRARY_PATH+:}$LD_LIBRARY_PATH" 1140 + export LANG="POSIX" 1141 + -unset $(set | grep ^LC_ | cut -d= -f1) 1142 + +unset $(set | @grep@ ^LC_ | @cut@ -d= -f1) 1143 + 1144 + fatal() { 1145 + diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh 1146 + index 42fa704e8d..f6cf1b11c0 100644 1147 + --- a/tools/hotplug/Linux/xen-network-common.sh 1148 + +++ b/tools/hotplug/Linux/xen-network-common.sh 1149 + @@ -27,5 +27,5 @@ 1150 + # been renamed. 1151 + 1152 + -if ! which ifup >/dev/null 2>/dev/null 1153 + +if ! @which@ ifup >/dev/null 2>/dev/null 1154 + then 1155 + preiftransfer() 1156 + @@ -85,5 +85,5 @@ _setup_bridge_port() { 1157 + 1158 + # take interface down ... 1159 + - ip link set dev ${dev} down 1160 + + @ip@ link set dev ${dev} down 1161 + 1162 + if [ $virtual -ne 0 ] ; then 1163 + @@ -92,9 +92,9 @@ _setup_bridge_port() { 1164 + # stolen by an Ethernet bridge for STP purposes. 1165 + # (FE:FF:FF:FF:FF:FF) 1166 + - ip link set dev ${dev} address fe:ff:ff:ff:ff:ff || true 1167 + + @ip@ link set dev ${dev} address fe:ff:ff:ff:ff:ff || true 1168 + fi 1169 + 1170 + # ... and configure it 1171 + - ip address flush dev ${dev} 1172 + + @ip@ address flush dev ${dev} 1173 + } 1174 + 1175 + @@ -112,10 +112,10 @@ create_bridge () { 1176 + # Don't create the bridge if it already exists. 1177 + if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then 1178 + - if which brctl >&/dev/null; then 1179 + - brctl addbr ${bridge} 1180 + - brctl stp ${bridge} off 1181 + - brctl setfd ${bridge} 0 1182 + + if @which@ @brctl@ >&/dev/null; then 1183 + + @brctl@ addbr ${bridge} 1184 + + @brctl@ stp ${bridge} off 1185 + + @brctl@ setfd ${bridge} 0 1186 + else 1187 + - ip link add name ${bridge} type bridge stp_state 0 forward_delay 0 1188 + + @ip@ link add name ${bridge} type bridge stp_state 0 forward_delay 0 1189 + fi 1190 + fi 1191 + @@ -130,8 +130,8 @@ add_to_bridge () { 1192 + if [ ! -e "/sys/class/net/${bridge}/brif/${dev}" ]; then 1193 + log debug "adding $dev to bridge $bridge" 1194 + - if which brctl >&/dev/null; then 1195 + - brctl addif ${bridge} ${dev} 1196 + + if @which@ @brctl@ >&/dev/null; then 1197 + + @brctl@ addif ${bridge} ${dev} 1198 + else 1199 + - ip link set ${dev} master ${bridge} 1200 + + @ip@ link set ${dev} master ${bridge} 1201 + fi 1202 + else 1203 + @@ -139,5 +139,5 @@ add_to_bridge () { 1204 + fi 1205 + 1206 + - ip link set dev ${dev} up 1207 + + @ip@ link set dev ${dev} up 1208 + } 1209 + 1210 + @@ -146,13 +146,13 @@ remove_from_bridge () { 1211 + local dev=$2 1212 + 1213 + - do_without_error ip link set dev ${dev} down 1214 + + do_without_error @ip@ link set dev ${dev} down 1215 + 1216 + # Don't remove $dev from $bridge if it's not on the bridge. 1217 + if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then 1218 + log debug "removing $dev from bridge $bridge" 1219 + - if which brctl >&/dev/null; then 1220 + - do_without_error brctl delif ${bridge} ${dev} 1221 + + if @which@ @brctl@ >&/dev/null; then 1222 + + do_without_error @brctl@ delif ${bridge} ${dev} 1223 + else 1224 + - do_without_error ip link set ${dev} nomaster 1225 + + do_without_error @ip@ link set ${dev} nomaster 1226 + fi 1227 + else 1228 + @@ -172,5 +172,5 @@ set_mtu () { 1229 + if [ -z "$mtu" ] 1230 + then 1231 + - mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`" 1232 + + mtu="`@ip@ link show dev ${bridge}| @awk@ '/mtu/ { print $5 }'`" 1233 + if [ -n "$mtu" ] 1234 + then 1235 + @@ -181,5 +181,5 @@ set_mtu () { 1236 + then 1237 + log debug "setting $dev MTU to $mtu" 1238 + - ip link set dev ${dev} mtu ${mtu} || : 1239 + + @ip@ link set dev ${dev} mtu ${mtu} || : 1240 + 1241 + if [ ${type_if} = vif ] 1242 + diff --git a/tools/hotplug/Linux/xendomains.in b/tools/hotplug/Linux/xendomains.in 1243 + index 70f4129ef4..b066404b0d 100644 1244 + --- a/tools/hotplug/Linux/xendomains.in 1245 + +++ b/tools/hotplug/Linux/xendomains.in 1246 + @@ -151,5 +151,5 @@ else 1247 + fi 1248 + 1249 + -if ! which usleep >&/dev/null 1250 + +if ! @which@ usleep >&/dev/null 1251 + then 1252 + usleep() 1253 + @@ -157,5 +157,5 @@ then 1254 + if [ -n "$1" ] 1255 + then 1256 + - sleep $(( $1 / 1000000 )) 1257 + + @sleep@ $(( $1 / 1000000 )) 1258 + fi 1259 + } 1260 + @@ -171,5 +171,5 @@ rc_reset 1261 + contains_something() 1262 + { 1263 + - if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ] 1264 + + if [ -d "$1" ] && [ `@ls@ $1 | wc -l` -gt 0 ] 1265 + then 1266 + return 0 1267 + @@ -183,5 +183,5 @@ rdname() 1268 + { 1269 + NM=$($CMD create --quiet --dryrun --defconfig "$1" | 1270 + - sed -n 's/^.*(name \(.*\))$/\1/p;s/^.*"name": "\(.*\)",$/\1/p') 1271 + + @sed@ -n 's/^.*(name \(.*\))$/\1/p;s/^.*"name": "\(.*\)",$/\1/p') 1272 + } 1273 + 1274 + @@ -218,11 +218,11 @@ parseln() 1275 + name=;id= 1276 + elif [[ "$1" =~ '(name' ]]; then 1277 + - name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/') 1278 + + name=$(echo $1 | @sed@ -e 's/^.*(name \(.*\))$/\1/') 1279 + elif [[ "$1" =~ '(domid' ]]; then 1280 + - id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/') 1281 + + id=$(echo $1 | @sed@ -e 's/^.*(domid \(.*\))$/\1/') 1282 + elif [[ "$1" =~ '"name":' ]]; then 1283 + - name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/') 1284 + + name=$(echo $1 | @sed@ -e 's/^.*"name": "\(.*\)",$/\1/') 1285 + elif [[ "$1" =~ '"domid":' ]]; then 1286 + - id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/') 1287 + + id=$(echo $1 | @sed@ -e 's/^.*"domid": \(.*\),$/\1/') 1288 + fi 1289 + 1290 + @@ -245,5 +245,5 @@ is_running() 1291 + ;; 1292 + esac 1293 + - done < <($CMD list -l | grep "$LIST_GREP") 1294 + + done < <($CMD list -l | @grep@ "$LIST_GREP") 1295 + return $RC 1296 + } 1297 + @@ -256,5 +256,5 @@ start() 1298 + fi 1299 + 1300 + - mkdir -p $(dirname "$LOCKFILE") 1301 + + @mkdir@ -p $(@dirname@ "$LOCKFILE") 1302 + touch $LOCKFILE 1303 + 1304 + @@ -267,5 +267,5 @@ start() 1305 + for dom in $XENDOMAINS_SAVE/*; do 1306 + if [ -f $dom ] ; then 1307 + - HEADER=`head -c 16 $dom | head -n 1 2> /dev/null` 1308 + + HEADER=`@head@ -c 16 $dom | @head@ -n 1 2> /dev/null` 1309 + if [ "$HEADER" = "$HEADCOMP" ]; then 1310 + echo -n " ${dom##*/}" 1311 + @@ -278,5 +278,5 @@ start() 1312 + else 1313 + # mv $dom ${dom%/*}/.${dom##*/} 1314 + - rm $dom 1315 + + @rm@ $dom 1316 + fi 1317 + fi 1318 + @@ -300,6 +300,6 @@ start() 1319 + for dom in $XENDOMAINS_AUTO/*; do 1320 + echo -n " ${dom##*/}" 1321 + - shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p') 1322 + - echo $saved_domains | grep -w $shortdom > /dev/null 1323 + + shortdom=$(echo $dom | @sed@ -n 's/^.*\/\(.*\)$/\1/p') 1324 + + echo $saved_domains | @grep@ -w $shortdom > /dev/null 1325 + if [ $? -eq 0 ] || is_running $dom; then 1326 + echo -n "(skip)" 1327 + @@ -329,5 +329,5 @@ all_zombies() 1328 + return 1; 1329 + fi 1330 + - done < <($CMD list -l | grep "$LIST_GREP") 1331 + + done < <($CMD list -l | @grep@ "$LIST_GREP") 1332 + return 0 1333 + } 1334 + @@ -346,14 +346,14 @@ watchdog_xencmd() 1335 + 1336 + usleep 20000 1337 + - for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do 1338 + + for no in `@seq@ 0 $XENDOMAINS_STOP_MAXWAIT`; do 1339 + # exit if $CMD save/migrate/shutdown is finished 1340 + - PSAX=`ps axlw | grep "$CMD $1" | grep -v grep` 1341 + + PSAX=`ps axlw | @grep@ "$CMD $1" | @grep@ -v grep` 1342 + if test -z "$PSAX"; then exit; fi 1343 + if ! test -n "$3"; then echo -n '.'; fi 1344 + - sleep 1 1345 + + @sleep@ 1 1346 + # go to kill immediately if there's only zombies left 1347 + if all_zombies && test -n "$2"; then break; fi 1348 + done 1349 + - sleep 1 1350 + + @sleep@ 1 1351 + read PSF PSUID PSPID PSPPID < <(echo "$PSAX") 1352 + # kill $CMD $1 1353 + @@ -435,5 +435,5 @@ stop() 1354 + watchdog_xencmd save & 1355 + WDOG_PID=$! 1356 + - mkdir -p "$XENDOMAINS_SAVE" 1357 + + @mkdir@ -p "$XENDOMAINS_SAVE" 1358 + XMR=`$CMD save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null` 1359 + if test $? -ne 0; then 1360 + @@ -462,5 +462,5 @@ stop() 1361 + kill $WDOG_PID >/dev/null 2>&1 1362 + fi 1363 + - done < <($CMD list -l | grep "$LIST_GREP") 1364 + + done < <($CMD list -l | @grep@ "$LIST_GREP") 1365 + 1366 + # NB. this shuts down ALL Xen domains (politely), not just the ones in 1367 + @@ -483,5 +483,5 @@ stop() 1368 + 1369 + # Unconditionally delete lock file 1370 + - rm -f $LOCKFILE 1371 + + @rm@ -f $LOCKFILE 1372 + 1373 + exec 2>&3 1374 + @@ -499,5 +499,5 @@ check_domain_up() 1375 + ;; 1376 + esac 1377 + - done < <($CMD list -l | grep "$LIST_GREP") 1378 + + done < <($CMD list -l | @grep@ "$LIST_GREP") 1379 + return 1 1380 + } 1381 + @@ -532,5 +532,5 @@ check_all_saved_domains_up() 1382 + return 0 1383 + fi 1384 + - missing=`/bin/ls $XENDOMAINS_SAVE` 1385 + + missing=`@ls@ $XENDOMAINS_SAVE` 1386 + echo -n " MISS SAVED: " $missing 1387 + return 1 1388 + -- 1389 + 2.49.0 1390 +
+401 -6
pkgs/by-name/xe/xen/package.nix
··· 1 1 { 2 - buildXenPackage, 2 + lib, 3 + stdenv, 4 + testers, 5 + fetchgit, 6 + fetchpatch, 7 + replaceVars, 8 + 9 + # Xen 10 + acpica-tools, 11 + autoPatchelfHook, 12 + binutils-unwrapped-all-targets, 13 + bison, 14 + bzip2, 15 + cmake, 16 + dev86, 17 + e2fsprogs, 18 + flex, 19 + libnl, 20 + libuuid, 21 + lzo, 22 + ncurses, 23 + ocamlPackages, 24 + perl, 25 + pkg-config, 3 26 python3Packages, 4 - fetchpatch, 27 + systemd, 28 + xz, 29 + yajl, 30 + zlib, 31 + zstd, 32 + 33 + # Optional Components 34 + withFlask ? false, 35 + checkpolicy, 36 + withIPXE ? true, 37 + ipxe, 38 + withOVMF ? true, 39 + OVMF, 40 + withSeaBIOS ? true, 41 + seabios-qemu, 42 + 43 + # Documentation 44 + pandoc, 45 + 46 + # Scripts 47 + bridge-utils, 48 + coreutils, 49 + diffutils, 50 + drbd, 51 + gawk, 52 + gnugrep, 53 + gnused, 54 + inetutils, 55 + iproute2, 56 + iptables, 57 + kmod, 58 + multipath-tools, 59 + nbd, 60 + openiscsi, 61 + openvswitch, 62 + psmisc, 63 + util-linux, 64 + which, 5 65 }: 6 66 7 - buildXenPackage.override { inherit python3Packages; } { 67 + let 68 + inherit (lib) 69 + enableFeature 70 + genAttrs 71 + getExe 72 + getExe' 73 + licenses 74 + optionalString 75 + optionals 76 + systems 77 + teams 78 + versionOlder 79 + versions 80 + warn 81 + ; 82 + inherit (systems.inspect.patterns) isLinux isAarch64; 83 + inherit (licenses) 84 + cc-by-40 85 + gpl2Only 86 + lgpl21Only 87 + mit 88 + ; 89 + 90 + # Mark versions older than minSupportedVersion as EOL. 91 + minSupportedVersion = "4.17"; 92 + 93 + scriptDeps = 94 + let 95 + mkTools = pkg: tools: genAttrs tools (tool: getExe' pkg tool); 96 + in 97 + (genAttrs [ 98 + "CONFIG_DIR" 99 + "CONFIG_LEAF_DIR" 100 + "LIBEXEC_BIN" 101 + "XEN_LOG_DIR" 102 + "XEN_RUN_DIR" 103 + "XEN_SCRIPT_DIR" 104 + "qemu_xen_systemd" 105 + "sbindir" 106 + ] (_: null)) 107 + // (mkTools coreutils [ 108 + "basename" 109 + "cat" 110 + "cp" 111 + "cut" 112 + "dirname" 113 + "head" 114 + "ls" 115 + "mkdir" 116 + "mktemp" 117 + "readlink" 118 + "rm" 119 + "seq" 120 + "sleep" 121 + "stat" 122 + ]) 123 + // (mkTools drbd [ 124 + "drbdadm" 125 + "drbdsetup" 126 + ]) 127 + // (mkTools gnugrep [ 128 + "egrep" 129 + "grep" 130 + ]) 131 + // (mkTools iproute2 [ 132 + "bridge" 133 + "ip" 134 + "tc" 135 + ]) 136 + // (mkTools iptables [ 137 + "arptables" 138 + "ip6tables" 139 + "iptables" 140 + ]) 141 + // (mkTools kmod [ 142 + "modinfo" 143 + "modprobe" 144 + "rmmod" 145 + ]) 146 + // (mkTools libnl [ 147 + "nl-qdisc-add" 148 + "nl-qdisc-delete" 149 + "nl-qdisc-list" 150 + ]) 151 + // (mkTools util-linux [ 152 + "flock" 153 + "logger" 154 + "losetup" 155 + "prlimit" 156 + ]) 157 + // { 158 + awk = getExe' gawk "awk"; 159 + brctl = getExe bridge-utils; 160 + diff = getExe' diffutils "diff"; 161 + ifconfig = getExe' inetutils "ifconfig"; 162 + iscsiadm = getExe' openiscsi "iscsiadm"; 163 + killall = getExe' psmisc "killall"; 164 + multipath = getExe' multipath-tools "multipath"; 165 + nbd-client = getExe' nbd "nbd-client"; 166 + ovs-vsctl = getExe' openvswitch "ovs-vsctl"; 167 + sed = getExe gnused; 168 + systemd-notify = getExe' systemd "systemd-notify"; 169 + which = getExe which; 170 + }; 171 + in 172 + 173 + stdenv.mkDerivation (finalAttrs: { 8 174 pname = "xen"; 9 175 version = "4.20.0"; 176 + 177 + # This attribute can be overriden to correct the file paths in 178 + # `passthru` when building an unstable Xen. 179 + upstreamVersion = finalAttrs.version; 180 + # Useful for further identifying downstream Xen variants. (i.e. Qubes) 181 + vendor = "nixos"; 182 + 10 183 patches = [ 184 + ./0001-makefile-efi-output-directory.patch 185 + 186 + (replaceVars ./0002-scripts-external-executable-calls.patch scriptDeps) 187 + 188 + # XSA #469 11 189 (fetchpatch { 12 190 url = "https://xenbits.xenproject.org/xsa/xsa469/xsa469-4.20-01.patch"; 13 191 hash = "sha256-go743oBhYDuxsK0Xc6nK/WxutQQwc2ERtLKhCU9Dnng="; ··· 36 214 url = "https://xenbits.xenproject.org/xsa/xsa469/xsa469-4.20-07.patch"; 37 215 hash = "sha256-+BsCJa01R2lrbu7tEluGrYSAqu2jJcrpFNUoLMY466c="; 38 216 }) 217 + 218 + # XSA #470 39 219 (fetchpatch { 40 220 url = "https://xenbits.xenproject.org/xsa/xsa470.patch"; 41 221 hash = "sha256-zhMZ6pCZtt0ocgsMFVqthMaof46lMMTaYmlepMXVJqM="; 42 222 }) 43 223 ]; 44 - rev = "3ad5d648cda5add395f49fc3704b2552aae734f7"; 45 - hash = "sha256-v2DRJv+1bym8zAgU74lo1HQ/9rUcyK3qc4Eec4RpcEY="; 46 - } 224 + 225 + outputs = [ 226 + "out" 227 + "man" 228 + "doc" 229 + "dev" 230 + "boot" 231 + ]; 232 + 233 + src = fetchgit { 234 + url = "https://xenbits.xenproject.org/git-http/xen.git"; 235 + rev = "3ad5d648cda5add395f49fc3704b2552aae734f7"; 236 + hash = "sha256-v2DRJv+1bym8zAgU74lo1HQ/9rUcyK3qc4Eec4RpcEY="; 237 + }; 238 + 239 + strictDeps = true; 240 + 241 + nativeBuildInputs = 242 + [ 243 + acpica-tools 244 + autoPatchelfHook 245 + bison 246 + cmake 247 + dev86 248 + flex 249 + pandoc 250 + perl 251 + pkg-config 252 + 253 + # oxenstored 254 + ocamlPackages.findlib 255 + ocamlPackages.ocaml 256 + ] 257 + ++ (with python3Packages; [ 258 + python 259 + setuptools 260 + wrapPython 261 + ]); 262 + 263 + buildInputs = 264 + [ 265 + bzip2 266 + e2fsprogs.dev 267 + libnl 268 + libuuid 269 + lzo 270 + ncurses 271 + xz 272 + yajl 273 + zlib 274 + zstd 275 + ] 276 + ++ optionals withFlask [ checkpolicy ] 277 + ++ optionals (versionOlder finalAttrs.version "4.19") [ systemd ]; 278 + 279 + configureFlags = [ 280 + "--enable-systemd" 281 + "--disable-qemu-traditional" 282 + "--with-system-qemu" 283 + (if withSeaBIOS then "--with-system-seabios=${seabios-qemu.firmware}" else "--disable-seabios") 284 + (if withOVMF then "--with-system-ovmf=${OVMF.mergedFirmware}" else "--disable-ovmf") 285 + (if withIPXE then "--with-system-ipxe=${ipxe.firmware}" else "--disable-ipxe") 286 + (enableFeature withFlask "xsmpolicy") 287 + ]; 288 + 289 + makeFlags = 290 + [ 291 + "SUBSYSTEMS=${toString finalAttrs.buildFlags}" 292 + 293 + "PREFIX=$(out)" 294 + "BASH_COMPLETION_DIR=$(PREFIX)/share/bash-completion/completions" 295 + 296 + "XEN_WHOAMI=${finalAttrs.pname}" 297 + "XEN_DOMAIN=${finalAttrs.vendor}" 298 + 299 + "GIT=${getExe' coreutils "false"}" 300 + "WGET=${getExe' coreutils "false"}" 301 + "EFI_VENDOR=${finalAttrs.vendor}" 302 + "INSTALL_EFI_STRIP=1" 303 + "LD=${getExe' binutils-unwrapped-all-targets "ld"}" 304 + ] 305 + # These flags set the CONFIG_* options in /boot/xen.config 306 + # and define if the default policy file is built. However, 307 + # the Flask binaries always get compiled by default. 308 + ++ optionals withFlask [ 309 + "XSM_ENABLE=y" 310 + "FLASK_ENABLE=y" 311 + ]; 312 + 313 + buildFlags = [ 314 + "xen" 315 + "tools" 316 + "docs" 317 + ]; 318 + 319 + enableParallelBuilding = true; 320 + 321 + env.NIX_CFLAGS_COMPILE = toString [ 322 + "-Wno-error=maybe-uninitialized" 323 + "-Wno-error=array-bounds" 324 + ]; 325 + 326 + dontUseCmakeConfigure = true; 327 + 328 + # Remove in-tree QEMU sources, we don't need them in any circumstance. 329 + prePatch = "rm -rf tools/qemu-xen tools/qemu-xen-traditional"; 330 + 331 + installPhase = '' 332 + runHook preInstall 333 + 334 + mkdir -p $out $out/share $boot 335 + cp -prvd dist/install/nix/store/*/* $out/ 336 + cp -prvd dist/install/etc $out 337 + cp -prvd dist/install/boot $boot 338 + 339 + runHook postInstall 340 + ''; 341 + 342 + postInstall = 343 + # Wrap xencov_split, xenmon and xentrace_format. 344 + # We also need to wrap pygrub, which lies in $out/libexec/xen/bin. 345 + '' 346 + wrapPythonPrograms 347 + wrapPythonProgramsIn "$out/libexec/xen/bin" "$out $pythonPath" 348 + ''; 349 + 350 + postFixup = 351 + '' 352 + addAutoPatchelfSearchPath $out/lib 353 + autoPatchelf $out/libexec/xen/bin 354 + '' 355 + # Flask is particularly hard to disable. Even after 356 + # setting the make flags to `n`, it still gets compiled. 357 + # If withFlask is disabled, delete the extra binaries. 358 + + optionalString (!withFlask) '' 359 + rm -f $out/bin/flask-* 360 + ''; 361 + 362 + passthru = { 363 + efi = "boot/xen-${finalAttrs.upstreamVersion}.efi"; 364 + flaskPolicy = 365 + if withFlask then 366 + warn "This Xen was compiled with FLASK support, but the FLASK file may not match the Xen version number. Please hardcode the path to the FLASK file instead." "boot/xenpolicy-${finalAttrs.upstreamVersion}" 367 + else 368 + throw "This Xen was compiled without FLASK support."; 369 + # This test suite is very simple, as Xen's userspace 370 + # utilities require the hypervisor to be booted. 371 + tests = { 372 + pkg-config = testers.hasPkgConfigModules { 373 + package = finalAttrs.finalPackage; 374 + moduleNames = [ 375 + "xencall" 376 + "xencontrol" 377 + "xendevicemodel" 378 + "xenevtchn" 379 + "xenforeignmemory" 380 + "xengnttab" 381 + "xenguest" 382 + "xenhypfs" 383 + "xenlight" 384 + "xenstat" 385 + "xenstore" 386 + "xentoolcore" 387 + "xentoollog" 388 + "xenvchan" 389 + "xlutil" 390 + ]; 391 + }; 392 + }; 393 + }; 394 + 395 + meta = { 396 + branch = versions.majorMinor finalAttrs.version; 397 + 398 + description = "Type-1 hypervisor intended for embedded and hyperscale use cases"; 399 + longDescription = 400 + '' 401 + The Xen Project Hypervisor is a virtualisation technology defined as a *type-1 402 + hypervisor*, which allows multiple virtual machines, known as domains, to run 403 + concurrently with the host on the physical machine. On a typical *type-2 404 + hypervisor*, the virtual machines run as applications on top of the 405 + host. NixOS runs as the privileged **Domain 0**, and can paravirtualise or fully 406 + virtualise **Unprivileged Domains**. 407 + 408 + Use with the `qemu_xen` package. 409 + '' 410 + + "\nIncludes:\n* `xen.efi`: The Xen Project's [EFI binary](https://xenbits.xenproject.org/docs/${finalAttrs.meta.branch}-testing/misc/efi.html), available on the `boot` output of this package." 411 + + optionalString withFlask "\n* `xsm-flask`: The [FLASK Xen Security Module](https://wiki.xenproject.org/wiki/Xen_Security_Modules_:_XSM-FLASK). The `xenpolicy` file is available on the `boot` output of this package." 412 + + optionalString withSeaBIOS "\n* `seabios`: Support for the SeaBIOS boot firmware on HVM domains." 413 + + optionalString withOVMF "\n* `ovmf`: Support for the OVMF UEFI boot firmware on HVM domains." 414 + + optionalString withIPXE "\n* `ipxe`: Support for the iPXE boot firmware on HVM domains."; 415 + 416 + homepage = "https://xenproject.org/"; 417 + downloadPage = "https://downloads.xenproject.org/release/xen/${finalAttrs.version}/"; 418 + changelog = "https://wiki.xenproject.org/wiki/Xen_Project_${finalAttrs.meta.branch}_Release_Notes"; 419 + 420 + license = [ 421 + # Documentation. 422 + cc-by-40 423 + # Most of Xen is licensed under the GPL v2.0. 424 + gpl2Only 425 + # Xen Libraries and the `xl` command-line utility. 426 + lgpl21Only 427 + # Development headers in $dev/include. 428 + mit 429 + ]; 430 + 431 + teams = [ teams.xen ]; 432 + knownVulnerabilities = optionals (versionOlder finalAttrs.version minSupportedVersion) [ 433 + "The Xen Project Hypervisor version ${finalAttrs.version} is no longer supported by the Xen Project Security Team. See https://xenbits.xenproject.org/docs/unstable/support-matrix.html" 434 + ]; 435 + 436 + mainProgram = "xl"; 437 + 438 + platforms = [ isLinux ]; 439 + badPlatforms = [ isAarch64 ]; 440 + }; 441 + })
+1
pkgs/top-level/aliases.nix
··· 373 373 buildBarebox = throw "buildBarebox has been removed due to lack of interest in maintaining it in nixpkgs"; # Added 2025-04-19 374 374 buildGo122Module = throw "Go 1.22 is end-of-life, and 'buildGo122Module' has been removed. Please use a newer builder version."; # Added 2025-03-28 375 375 buildGoPackage = throw "`buildGoPackage` has been deprecated and removed, see the Go section in the nixpkgs manual for details"; # Added 2024-11-18 376 + buildXenPackage = throw "'buildXenPackage' has been removed as a custom Xen build can now be achieved by simply overriding 'xen'."; # Added 2025-05-12 376 377 377 378 inherit (libsForQt5.mauiPackages) buho; # added 2022-05-17 378 379 bwidget = tclPackages.bwidget; # Added 2024-10-02
-2
pkgs/top-level/all-packages.nix
··· 14367 14367 ; 14368 14368 }; 14369 14369 14370 - buildXenPackage = callPackage ../build-support/xen { }; 14371 - 14372 14370 gxneur = callPackage ../applications/misc/gxneur { 14373 14371 inherit (gnome2) libglade GConf; 14374 14372 };