integ/filesystem/parted/debian/patches/0002-add-resizepart.sh.patch
Takamasa Takenaka 0e7fef247a Add debian package for parted
- Copied 1 patch from CentOS. Another patch is already applied in 3.4.
- Copied the resizepart.sh file from CentOS.
- Suppress to apply debian/patches in debian source package
  because they are already applied.

Test:
- Create debian package for parted
- Create ISO with parted package included

Story: 2009101
Task: 43526

Signed-off-by: Takamasa Takenaka <takamasa.takenaka@windriver.com>
Change-Id: I9a2c0781c07a7e53e7a61800813dc634ed9d5beb
2021-10-22 18:31:51 -03:00

48 lines
1.3 KiB
Diff

From 1af84a759edaf5029fd8531363538e7dee970d34 Mon Sep 17 00:00:00 2001
From: Takamasa Takenaka <takamasa.takenaka@windriver.com>
Date: Tue, 5 Oct 2021 12:00:52 -0300
Subject: [PATCH 2/2] add resizepart.sh
resizepart.sh is a script without needing to handle command
prompts interactively (clean copied from CentOS)
Signed-off-by: Takamasa Takenaka <takamasa.takenaka@windriver.com>
---
resizepart.sh | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 resizepart.sh
diff --git a/resizepart.sh b/resizepart.sh
new file mode 100644
index 0000000..29be2a0
--- /dev/null
+++ b/resizepart.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+################################################################################
+# Copyright (c) 2015 Wind River Systems, Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+################################################################################
+
+DEVICE=$1
+PARTITION=$2
+SIZE=$(blockdev --getsize64 ${DEVICE})
+SIZE_MB=$((SIZE / (1024*1024)))
+
+## This is a workaround to allow cloud-init to invoke parted without needing to
+## handle command prompts interactively. Support for non-interactive parted
+## commands are not supported on mounted partitions.
+##
+/usr/sbin/parted ---pretend-input-tty ${DEVICE} resizepart ${PARTITION} << EOF
+yes
+${SIZE_MB}
+EOF
+
+exit $?
--
2.25.1