Commit ae7fad75 authored by Natanael Copa's avatar Natanael Copa

main/busybox: 1.14.4. backport support for uuid on swap in fstab

parent fe3e3291
From 455b23172de8f1fe8378c7c9470bf7041c242305 Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 17 Sep 2009 09:33:59 +0000
Subject: [PATCH 1/2] mount: move resolve_mount_spec() to volume_id/
This is so it can be reused by other applets like swaponoff.
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
include/volume_id.h | 6 ++++++
util-linux/mount.c | 17 -----------------
util-linux/volume_id/get_devname.c | 16 ++++++++++++++++
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/include/volume_id.h b/include/volume_id.h
index bba32c0..cef5e9a 100644
--- a/include/volume_id.h
+++ b/include/volume_id.h
@@ -21,3 +21,9 @@
char *get_devname_from_label(const char *spec);
char *get_devname_from_uuid(const char *spec);
void display_uuid_cache(void);
+
+#if ENABLE_FEATURE_MOUNT_LABEL
+void resolve_mount_spec(char **fsname);
+#else
+#define resolve_mount_spec(fsname) ((void)0)
+#endif
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 478dc24..0d12506 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -290,23 +290,6 @@ static int verbose_mount(const char *source, const char *target,
#define verbose_mount(...) mount(__VA_ARGS__)
#endif
-#if ENABLE_FEATURE_MOUNT_LABEL
-static void resolve_mount_spec(char **fsname)
-{
- char *tmp = NULL;
-
- if (!strncmp(*fsname, "UUID=", 5))
- tmp = get_devname_from_uuid(*fsname + 5);
- else if (!strncmp(*fsname, "LABEL=", 6))
- tmp = get_devname_from_label(*fsname + 6);
-
- if (tmp)
- *fsname = tmp;
-}
-#else
-#define resolve_mount_spec(fsname) ((void)0)
-#endif
-
// Append mount options to string
static void append_mount_options(char **oldopts, const char *newopts)
{
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 0686a07..a613b85 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -260,3 +260,19 @@ char *get_devname_from_uuid(const char *spec)
}
return NULL;
}
+
+#if ENABLE_FEATURE_MOUNT_LABEL
+void resolve_mount_spec(char **fsname)
+{
+ char *tmp = NULL;
+
+ if (!strncmp(*fsname, "UUID=", 5))
+ tmp = get_devname_from_uuid(*fsname + 5);
+ else if (!strncmp(*fsname, "LABEL=", 6))
+ tmp = get_devname_from_label(*fsname + 6);
+
+ if (tmp)
+ *fsname = tmp;
+}
+#endif
+
--
1.6.4.2
From 3e3d6337d442225cc951a2084191dc61afb34661 Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 17 Sep 2009 11:19:20 +0000
Subject: [PATCH 2/2] swaponoff: add uuid/label support
This allows swapon -a enable swap when the swap partition is specified by
either UUID=... or LABEL=... in /etc/fstab
We could have made a separate config option for this but it makes sense
to have it with MOUNT_LABEL as you will need that to parse the rest of
fstab anyway.
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
util-linux/Config.in | 1 +
util-linux/swaponoff.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/util-linux/Config.in b/util-linux/Config.in
index 5f5adc0..49c57e1 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -689,6 +689,7 @@ config FEATURE_MOUNT_LABEL
help
This allows for specifying a device by label or uuid, rather than by
name. This feature utilizes the same functionality as blkid/findfs.
+ This also enables label or uuid support for swapon.
config FEATURE_MOUNT_NFS
bool "Support mounting NFS file systems"
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 863f773..d69301f 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -11,6 +11,10 @@
#include <mntent.h>
#include <sys/swap.h>
+#if ENABLE_FEATURE_MOUNT_LABEL
+#include "volume_id.h"
+#endif
+
#if ENABLE_FEATURE_SWAPON_PRI
struct globals {
int flags;
@@ -26,6 +30,9 @@ static int swap_enable_disable(char *device)
int status;
struct stat st;
+#if ENABLE_FEATURE_MOUNT_LABEL
+ resolve_mount_spec(&device);
+#endif
xstat(device, &st);
#if ENABLE_DESKTOP
--
1.6.4.2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.14.3
pkgrel=7
pkgver=1.14.4
pkgrel=0
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
license="GPL-2"
......@@ -13,10 +13,13 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0001-install-compat-fix-for-mode-of-created-files.patch
0001-add-simple-beep-applet.patch
0002-add-config-knob-for-default-freq-and-length.patch
0001-mount-move-resolve_mount_spec-to-volume_id.patch
0002-swaponoff-add-uuid-label-support.patch
bb-tar-numeric-owner.patch
busybox-sed-3.patch
busyboxconfig"
build() {
cd "$srcdir"/$pkgname-$pkgver
......@@ -47,11 +50,13 @@ build() {
ln -s /bin/busybox "$pkgdir"/bin/sh
}
md5sums="d170bf5f97a41aec3a505eab690d5699 busybox-1.14.3.tar.bz2
md5sums="ad6d0b271e60783a3c767c4ccbc7f98e busybox-1.14.4.tar.bz2
4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch
73d39c57483084298c7e46bdbbbea8d1 0001-install-compat-fix-for-mode-of-created-files.patch
aa6869db437e11af86b5bf6c7d44b0a5 0001-add-simple-beep-applet.patch
e55b64d4510aebb83661dac3271e12d3 0002-add-config-knob-for-default-freq-and-length.patch
f928cadef10307c2f14202cfaf3c038c 0001-mount-move-resolve_mount_spec-to-volume_id.patch
82310729ab41d703f3584bc9920dd712 0002-swaponoff-add-uuid-label-support.patch
0b5b2d7db201f90cd08f4a3164ee29a1 bb-tar-numeric-owner.patch
b75c3f419f8392dfdadd92aa24fdba8c busybox-sed-3.patch
59d9b2e920505abce869de7a3abac050 busyboxconfig"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment