parted: New package (GNU parted)
This is a partition editor. While editing real disks requires root, this is useful to create partitioned images for VMs.
This commit is contained in:
parent
1ddd89e254
commit
24f7bf1c34
54
packages/parted/01_devmapper.patch
Normal file
54
packages/parted/01_devmapper.patch
Normal file
@ -0,0 +1,54 @@
|
||||
Fix disabling of libdevmapper.
|
||||
|
||||
Fix bugs related to disabling libdevmapper. Parted is rarely compiled without
|
||||
devmapper. So couple of syntax errors for the cas3 of disabled devmapper
|
||||
sneaked in.
|
||||
|
||||
diff -ur src-orig/libparted/arch/linux.c src/libparted/arch/linux.c
|
||||
--- src-orig/libparted/arch/linux.c 2017-08-31 15:47:07.007674598 +0200
|
||||
+++ src/libparted/arch/linux.c 2017-08-31 15:50:01.487860337 +0200
|
||||
@@ -2304,6 +2304,7 @@
|
||||
return r < 0 ? NULL : resultp;
|
||||
}
|
||||
|
||||
+#ifdef ENABLE_DEVICE_MAPPER
|
||||
static char *
|
||||
dm_canonical_path (PedDevice const *dev)
|
||||
{
|
||||
@@ -2326,12 +2327,17 @@
|
||||
err:
|
||||
return NULL;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static char*
|
||||
_device_get_part_path (PedDevice const *dev, int num)
|
||||
{
|
||||
+#ifdef ENABLE_DEVICE_MAPPER
|
||||
char *devpath = (dev->type == PED_DEVICE_DM
|
||||
? dm_canonical_path (dev) : dev->path);
|
||||
+#else
|
||||
+ char *devpath = dev->path;
|
||||
+#endif
|
||||
size_t path_len = strlen (devpath);
|
||||
char *result;
|
||||
/* Check for devfs-style /disc => /partN transformation
|
||||
@@ -2946,10 +2948,18 @@
|
||||
|
||||
|
||||
if (disk->dev->type == PED_DEVICE_DM) {
|
||||
+#ifdef ENABLE_DEVICE_MAPPER
|
||||
add_partition = _dm_add_partition;
|
||||
remove_partition = _dm_remove_partition;
|
||||
resize_partition = _dm_resize_partition;
|
||||
get_partition_start_and_length = _dm_get_partition_start_and_length;
|
||||
+#else
|
||||
+ ped_exception_throw (
|
||||
+ PED_EXCEPTION_BUG,
|
||||
+ PED_EXCEPTION_CANCEL,
|
||||
+ "This parted is compiled without devmapper support");
|
||||
+ return 0;
|
||||
+#endif
|
||||
} else {
|
||||
add_partition = _blkpg_add_partition;
|
||||
remove_partition = _blkpg_remove_partition;
|
34
packages/parted/02_lseek.patch
Normal file
34
packages/parted/02_lseek.patch
Normal file
@ -0,0 +1,34 @@
|
||||
Change 64-bit offset code to Android variant.
|
||||
|
||||
Parted uses a workaround in case when off_t is 32-bit. This happens i.a.
|
||||
on arm android. Use android functions rather than syscall.
|
||||
|
||||
--- src-orig/libparted/arch/linux.c 2018-06-21 02:53:48.635160013 +0200
|
||||
+++ src/libparted/arch/linux.c 2018-06-21 02:59:37.842096052 +0200
|
||||
@@ -1712,25 +1712,10 @@
|
||||
|
||||
#if SIZEOF_OFF_T < 8
|
||||
|
||||
-static _syscall5(int,_llseek,
|
||||
- unsigned int, fd,
|
||||
- unsigned long, offset_high,
|
||||
- unsigned long, offset_low,
|
||||
- loff_t*, result,
|
||||
- unsigned int, origin)
|
||||
-
|
||||
loff_t
|
||||
llseek (unsigned int fd, loff_t offset, unsigned int whence)
|
||||
{
|
||||
- loff_t result;
|
||||
- int retval;
|
||||
-
|
||||
- retval = _llseek(fd,
|
||||
- ((unsigned long long)offset) >> 32,
|
||||
- ((unsigned long long)offset) & 0xffffffff,
|
||||
- &result,
|
||||
- whence);
|
||||
- return (retval==-1 ? (loff_t) retval : result);
|
||||
+ return lseek64(fd, offset, whence);
|
||||
}
|
||||
|
||||
#endif /* SIZEOF_OFF_T < 8 */
|
31
packages/parted/03_minormajor.patch
Normal file
31
packages/parted/03_minormajor.patch
Normal file
@ -0,0 +1,31 @@
|
||||
Add missing major() and minor().
|
||||
|
||||
Based on glibc version of this functions. Parted relies on those
|
||||
functions and they're not provided by bionic libc.
|
||||
|
||||
diff -ur src-orig/libparted/arch/linux.c src/libparted/arch/linux.c
|
||||
--- src-orig/libparted/arch/linux.c 2017-08-31 15:47:07.007674598 +0200
|
||||
+++ src/libparted/arch/linux.c 2017-08-31 15:50:01.487860337 +0200
|
||||
@@ -86,6 +86,22 @@
|
||||
#define WR_MODE (O_WRONLY)
|
||||
#define RW_MODE (O_RDWR)
|
||||
|
||||
+unsigned int major(dev_t __dev)
|
||||
+{
|
||||
+ unsigned int __major;
|
||||
+ __major = ((__dev & (dev_t) 0x00000000000fff00u) >> 8);
|
||||
+ __major |= ((__dev & (dev_t) 0xfffff00000000000u) >> 32);
|
||||
+ return __major;
|
||||
+}
|
||||
+
|
||||
+unsigned int minor(dev_t __dev)
|
||||
+{
|
||||
+ unsigned int __minor;
|
||||
+ __minor = ((__dev & (dev_t) 0x00000000000000ffu) >> 0);
|
||||
+ __minor |= ((__dev & (dev_t) 0x00000ffffff00000u) >> 12);
|
||||
+ return __minor;
|
||||
+}
|
||||
+
|
||||
struct hd_geometry {
|
||||
unsigned char heads;
|
||||
unsigned char sectors;
|
13
packages/parted/build.sh
Normal file
13
packages/parted/build.sh
Normal file
@ -0,0 +1,13 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/parted/
|
||||
TERMUX_PKG_DESCRIPTION="Versatile partition editor"
|
||||
TERMUX_PKG_VERSION=3.2
|
||||
TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/parted/parted-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_SHA256=858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4
|
||||
TERMUX_PKG_DEPENDS="libuuid, readline"
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||
--disable-device-mapper
|
||||
"
|
||||
|
||||
termux_step_pre_configure () {
|
||||
CFLAGS+=" -Wno-gnu-designator"
|
||||
}
|
Loading…
Reference in New Issue
Block a user