mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
google-guest-configs: init at 20211116.00
This commit is contained in:
parent
6c3dd634ef
commit
c3f278bfba
52
pkgs/tools/virtualization/google-guest-configs/default.nix
Normal file
52
pkgs/tools/virtualization/google-guest-configs/default.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{ stdenv, lib, fetchFromGitHub, makeWrapper, substituteAll
|
||||
, ipcalc, iproute2, util-linux, coreutils, ethtool, gnugrep, gnused, nvme-cli }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "google-guest-configs";
|
||||
version = "20211116.00";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "GoogleCloudPlatform";
|
||||
repo = "guest-configs";
|
||||
rev = version;
|
||||
sha256 = "sha256-0SRu6p/DsHNNI20mkXJitt/Ee5S2ooiy5hNmD+ndecM=";
|
||||
};
|
||||
|
||||
binDeps = lib.makeBinPath [ coreutils util-linux gnugrep gnused ethtool ipcalc iproute2 ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
postPatch = ''
|
||||
substitute ${./fix-paths.patch} fix-paths.patch \
|
||||
--subst-var out \
|
||||
--subst-var-by nvme "${nvme-cli}/bin/nvme" \
|
||||
--subst-var-by sh "${stdenv.shell}" \
|
||||
--subst-var-by umount "${util-linux}/bin/umount" \
|
||||
--subst-var-by logger "${util-linux}/bin/logger"
|
||||
patch -p1 < ./fix-paths.patch
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,etc,lib}
|
||||
cp -r src/etc/{modprobe.d,sysctl.d} $out/etc
|
||||
cp -r src/lib/udev $out/lib
|
||||
cp -r src/sbin/* $out/bin
|
||||
cp -r src/usr/bin/* $out/bin
|
||||
|
||||
for i in $out/bin/* $out/lib/udev/google_nvme_id; do
|
||||
wrapProgram "$i" \
|
||||
--prefix "PATH" ":" "$binDeps"
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/GoogleCloudPlatform/guest-configs";
|
||||
description = "Linux Guest Environment for Google Compute Engine";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ abbradar ];
|
||||
};
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
diff -ru3 source.old/src/lib/udev/google_nvme_id source.new/src/lib/udev/google_nvme_id
|
||||
--- source.old/src/lib/udev/google_nvme_id 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ source.new/src/lib/udev/google_nvme_id 2022-02-05 13:30:00.986242869 +0300
|
||||
@@ -17,7 +17,7 @@
|
||||
# the metadata server
|
||||
|
||||
# Locations of the script's dependencies
|
||||
-readonly nvme_cli_bin=/usr/sbin/nvme
|
||||
+readonly nvme_cli_bin=@nvme@
|
||||
|
||||
# Bash regex to parse device paths and controller identification
|
||||
readonly NAMESPACE_NUMBER_REGEX="/dev/nvme[[:digit:]]+n([[:digit:]]+).*"
|
||||
diff -ru3 source.old/src/lib/udev/rules.d/64-gce-disk-removal.rules source.new/src/lib/udev/rules.d/64-gce-disk-removal.rules
|
||||
--- source.old/src/lib/udev/rules.d/64-gce-disk-removal.rules 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ source.new/src/lib/udev/rules.d/64-gce-disk-removal.rules 2022-02-05 13:27:42.635300567 +0300
|
||||
@@ -14,4 +14,4 @@
|
||||
#
|
||||
# When a disk is removed, unmount any remaining attached volumes.
|
||||
|
||||
-ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*|vd*|nvme*", RUN+="/bin/sh -c '/bin/umount -fl /dev/$name && /usr/bin/logger -p daemon.warn -s WARNING: hot-removed /dev/$name that was still mounted, data may have been corrupted'"
|
||||
+ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*|vd*|nvme*", RUN+="@sh@ -c '@umount@ -fl /dev/$name && @logger@ -p daemon.warn -s WARNING: hot-removed /dev/$name that was still mounted, data may have been corrupted'"
|
||||
diff -ru3 source.old/src/lib/udev/rules.d/65-gce-disk-naming.rules source.new/src/lib/udev/rules.d/65-gce-disk-naming.rules
|
||||
--- source.old/src/lib/udev/rules.d/65-gce-disk-naming.rules 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ source.new/src/lib/udev/rules.d/65-gce-disk-naming.rules 2022-02-05 13:27:05.053107964 +0300
|
||||
@@ -21,11 +21,11 @@
|
||||
KERNEL=="sd*|vd*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode"
|
||||
|
||||
# NVME Local SSD naming
|
||||
-KERNEL=="nvme*n*", ATTRS{model}=="nvme_card", PROGRAM="/bin/sh -c 'nsid=$$(echo %k|sed -re s/nvme[0-9]+n\([0-9]+\).\*/\\1/); echo $$((nsid-1))'", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-%c"
|
||||
+KERNEL=="nvme*n*", ATTRS{model}=="nvme_card", PROGRAM="@sh@ -c 'nsid=$$(echo %k|sed -re s/nvme[0-9]+n\([0-9]+\).\*/\\1/); echo $$((nsid-1))'", ENV{ID_SERIAL_SHORT}="local-nvme-ssd-%c"
|
||||
KERNEL=="nvme*", ATTRS{model}=="nvme_card", ENV{ID_SERIAL}="Google_EphemeralDisk_$env{ID_SERIAL_SHORT}"
|
||||
|
||||
# NVME Persistent Disk Naming
|
||||
-KERNEL=="nvme*n*", ATTRS{model}=="nvme_card-pd", IMPORT{program}="google_nvme_id -d $tempnode"
|
||||
+KERNEL=="nvme*n*", ATTRS{model}=="nvme_card-pd", IMPORT{program}="@out@/lib/udev/google_nvme_id -d $tempnode"
|
||||
|
||||
# Symlinks
|
||||
KERNEL=="sd*|vd*|nvme*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/google-$env{ID_SERIAL_SHORT}"
|
||||
diff -ru3 source.old/src/sbin/google-dhclient-script source.new/src/sbin/google-dhclient-script
|
||||
--- source.old/src/sbin/google-dhclient-script 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ source.new/src/sbin/google-dhclient-script 2022-02-05 13:29:37.430058984 +0300
|
||||
@@ -31,7 +31,6 @@
|
||||
# This script is found in EL 7 and used to fix local routing in EL 6.
|
||||
# ----------
|
||||
|
||||
-PATH=/bin:/usr/bin:/sbin
|
||||
# scripts in dhclient.d/ use $SAVEDIR (#833054)
|
||||
SAVEDIR=/var/lib/dhclient
|
||||
|
||||
@@ -58,9 +57,9 @@
|
||||
if need_hostname; then
|
||||
status=1
|
||||
if [ -n "${new_ip_address}" ]; then
|
||||
- eval $(/bin/ipcalc --silent --hostname ${new_ip_address} ; echo "status=$?")
|
||||
+ eval $(ipcalc --silent --hostname ${new_ip_address} ; echo "status=$?")
|
||||
elif [ -n "${new_ip6_address}" ]; then
|
||||
- eval $(/bin/ipcalc --silent --hostname ${new_ip6_address} ; echo "status=$?")
|
||||
+ eval $(ipcalc --silent --hostname ${new_ip6_address} ; echo "status=$?")
|
||||
fi
|
||||
|
||||
if [ ${status} -eq 0 ]; then
|
@ -6111,6 +6111,8 @@ with pkgs;
|
||||
|
||||
google-guest-agent = callPackage ../tools/virtualization/google-guest-agent { };
|
||||
|
||||
google-guest-configs = callPackage ../tools/virtualization/google-guest-configs { };
|
||||
|
||||
gdown = with python3Packages; toPythonApplication gdown;
|
||||
|
||||
gopro = callPackage ../tools/video/gopro { };
|
||||
|
Loading…
Reference in New Issue
Block a user