cloud-utils: 0.29 -> 0.30
This commit is contained in:
parent
61adee9e55
commit
2354e0f05a
@ -24,7 +24,12 @@ with lib;
|
||||
copy_bin_and_libs ${pkgs.gnused}/bin/sed
|
||||
copy_bin_and_libs ${pkgs.utillinux}/sbin/sfdisk
|
||||
copy_bin_and_libs ${pkgs.utillinux}/sbin/lsblk
|
||||
cp -v ${pkgs.cloud-utils}/bin/.growpart-wrapped $out/bin/growpart
|
||||
|
||||
substitute "${pkgs.cloud-utils}/bin/.growpart-wrapped" "$out/bin/growpart" \
|
||||
--replace "${pkgs.bash}/bin/sh" "/bin/sh" \
|
||||
--replace "awk" "gawk" \
|
||||
--replace "sed" "gnused"
|
||||
|
||||
ln -s sed $out/bin/gnused
|
||||
'';
|
||||
|
||||
|
@ -1,27 +1,34 @@
|
||||
{ stdenv, fetchurl, makeWrapper, gawk, gnused, utillinux }:
|
||||
{ stdenv, fetchurl, makeWrapper
|
||||
, gawk, gnused, utillinux, file
|
||||
, wget, python3, qemu, euca2ools
|
||||
, e2fsprogs, cdrkit }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation rec {
|
||||
# NOTICE: if you bump this, make sure to run
|
||||
# $ nix-build nixos/release-combined.nix -A nixos.tests.ec2-nixops
|
||||
name = "cloud-utils-0.29";
|
||||
# growpart is needed in initrd in nixos/modules/virtualisation/grow-partition.nix
|
||||
name = "cloud-utils-${version}";
|
||||
version = "0.30";
|
||||
src = fetchurl {
|
||||
url = "https://launchpad.net/cloud-utils/trunk/0.29/+download/cloud-utils-0.29.tar.gz";
|
||||
sha256 = "0z15gs8gmpy5gqxl7yiyjj7a6s8iw44djj6axvbci627b9pvd8cy";
|
||||
url = "https://launchpad.net/cloud-utils/trunk/0.3/+download/cloud-utils-${version}.tar.gz";
|
||||
sha256 = "19ca9ckwwsvlqrjz19bc93rq4gv3y4ak7551li2qk95caqyxsq3k";
|
||||
};
|
||||
buildInputs = [ makeWrapper ];
|
||||
buildPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp bin/growpart $out/bin/growpart
|
||||
sed -i 's|awk|gawk|' $out/bin/growpart
|
||||
sed -i 's|sed|gnused|' $out/bin/growpart
|
||||
ln -s sed $out/bin/gnused
|
||||
wrapProgram $out/bin/growpart --prefix PATH : "${stdenv.lib.makeBinPath [ gnused gawk utillinux ]}:$out/bin"
|
||||
'';
|
||||
dontInstall = true;
|
||||
dontPatchShebangs = true;
|
||||
dontStrip = true;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ python3 ];
|
||||
installFlags = [ "LIBDIR=$(out)/lib" "BINDIR=$(out)/bin" "MANDIR=$(out)/man/man1" "DOCDIR=$(out)/doc" ];
|
||||
|
||||
meta = {
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
};
|
||||
# according to https://packages.ubuntu.com/source/zesty/cloud-utils
|
||||
binDeps = [
|
||||
wget e2fsprogs file gnused gawk utillinux qemu euca2ools cdrkit
|
||||
];
|
||||
|
||||
postFixup = ''
|
||||
for i in $out/bin/*; do
|
||||
wrapProgram $i --prefix PATH : "${stdenv.lib.makeBinPath binDeps}:$out/bin"
|
||||
done
|
||||
'';
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
meta.platforms = stdenv.lib.platforms.unix;
|
||||
}
|
||||
|
@ -1,88 +0,0 @@
|
||||
From 1895d10a7539d055a4e0206af1e7a9e5ea32a4f7 Mon Sep 17 00:00:00 2001
|
||||
From: Juerg Haefliger <juerg.haefliger@hp.com>
|
||||
Date: Wed, 25 Mar 2015 13:59:20 +0100
|
||||
Subject: [PATCH] Support new sfdisk version 2.26
|
||||
|
||||
The sfdisk usage with version 2.26 changed. Specifically, the option
|
||||
--show-pt-geometry and functionality for CHS have been removed.
|
||||
Also, restoring a backup MBR now needs to be done using dd.
|
||||
---
|
||||
bin/growpart | 28 ++++++++++------------------
|
||||
1 file changed, 10 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/bin/growpart b/bin/growpart
|
||||
index 595c40b..d4c995b 100755
|
||||
--- a/bin/growpart
|
||||
+++ b/bin/growpart
|
||||
@@ -28,7 +28,6 @@ PART=""
|
||||
PT_UPDATE=false
|
||||
DRY_RUN=0
|
||||
|
||||
-MBR_CHS=""
|
||||
MBR_BACKUP=""
|
||||
GPT_BACKUP=""
|
||||
_capture=""
|
||||
@@ -133,7 +132,8 @@ bad_Usage() {
|
||||
}
|
||||
|
||||
mbr_restore() {
|
||||
- sfdisk --no-reread "${DISK}" ${MBR_CHS} -I "${MBR_BACKUP}"
|
||||
+ dd if="${MBR_BACKUP}-${DISK#/dev/}-0x00000000.bak" of="${DISK}" bs=1 \
|
||||
+ conv=notrunc
|
||||
}
|
||||
|
||||
sfdisk_worked_but_blkrrpart_failed() {
|
||||
@@ -148,34 +148,26 @@ sfdisk_worked_but_blkrrpart_failed() {
|
||||
|
||||
mbr_resize() {
|
||||
RESTORE_HUMAN="${TEMP_D}/recovery"
|
||||
- MBR_BACKUP="${TEMP_D}/orig.save"
|
||||
+ MBR_BACKUP="${TEMP_D}/backup"
|
||||
|
||||
local change_out=${TEMP_D}/change.out
|
||||
local dump_out=${TEMP_D}/dump.out
|
||||
local new_out=${TEMP_D}/new.out
|
||||
local dump_mod=${TEMP_D}/dump.mod
|
||||
- local tmp="${TEMP_D}/tmp.out"
|
||||
- local err="${TEMP_D}/err.out"
|
||||
|
||||
- local _devc cyl _w1 heads _w2 sectors _w3 tot dpart
|
||||
+ local tot dpart
|
||||
local pt_start pt_size pt_end max_end new_size change_info
|
||||
|
||||
- # --show-pt-geometry outputs something like
|
||||
- # /dev/sda: 164352 cylinders, 4 heads, 32 sectors/track
|
||||
- rqe sfd_geom sfdisk "${DISK}" --show-pt-geometry >"${tmp}" &&
|
||||
- read _devc cyl _w1 heads _w2 sectors _w3 <"${tmp}" &&
|
||||
- MBR_CHS="-C ${cyl} -H ${heads} -S ${sectors}" ||
|
||||
- fail "failed to get CHS from ${DISK}"
|
||||
+ tot=$(sfdisk --list "${DISK}" | awk '{ print $(NF-1) ; exit }') ||
|
||||
+ fail "failed to get total number of sectors from ${DISK}"
|
||||
|
||||
- tot=$((${cyl}*${heads}*${sectors}))
|
||||
+ debug 1 "total number of sectors of ${DISK} is ${tot}"
|
||||
|
||||
- debug 1 "geometry is ${MBR_CHS}. total size=${tot}"
|
||||
- rqe sfd_dump sfdisk ${MBR_CHS} --unit=S --dump "${DISK}" \
|
||||
+ rqe sfd_dump sfdisk --dump "${DISK}" \
|
||||
>"${dump_out}" ||
|
||||
fail "failed to dump sfdisk info for ${DISK}"
|
||||
-
|
||||
{
|
||||
- echo "## sfdisk ${MBR_CHS} --unit=S --dump ${DISK}"
|
||||
+ echo "## sfdisk --dump ${DISK}"
|
||||
cat "${dump_out}"
|
||||
} >"${RESTORE_HUMAN}"
|
||||
[ $? -eq 0 ] || fail "failed to save sfdisk -d output"
|
||||
@@ -237,7 +229,7 @@ mbr_resize() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
- LANG=C sfdisk --no-reread "${DISK}" ${MBR_CHS} --force \
|
||||
+ LANG=C sfdisk --no-reread "${DISK}" --force \
|
||||
-O "${MBR_BACKUP}" <"${new_out}" >"${change_out}" 2>&1
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] || RESTORE_FUNC="mbr_restore"
|
||||
--
|
||||
2.1.4
|
||||
|
Loading…
Reference in New Issue
Block a user