Applied, thanks
On Sat, Jan 31, 2026 at 2:02 PM Osama Abdelkader via busybox <[email protected]> wrote: > > Add a simple uuidgen utility that generates RFC 4122 compliant > UUIDs (version 4, random). Uses the existing generate_uuid() > function from libbb and volume_id_set_uuid() for formatting. > > Implementation suggested by Ulli. > > Features: > - Generates standard format UUIDs: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx > - RFC 4122 version 4 compliant > - Minimal implementation (~1.1 kb) > - NOFORK applet for efficiency > - Uses existing volume_id infrastructure for UUID formatting > > Signed-off-by: Osama Abdelkader <[email protected]> > --- > v3: use puts() instead of printf() > --- > util-linux/uuidgen.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > create mode 100644 util-linux/uuidgen.c > > diff --git a/util-linux/uuidgen.c b/util-linux/uuidgen.c > new file mode 100644 > index 000000000..20e55ca7a > --- /dev/null > +++ b/util-linux/uuidgen.c > @@ -0,0 +1,43 @@ > +/* vi: set sw=4 ts=4: */ > +/* > + * Mini uuidgen implementation for busybox > + * > + * Licensed under GPLv2 or later, see file LICENSE in this source tree. > + */ > +//config:config UUIDGEN > +//config: bool "uuidgen (1.1 kb)" > +//config: default y > +//config: help > +//config: Generate a UUID (Universally Unique Identifier) in RFC 4122 > format. > + > +//applet:IF_UUIDGEN(APPLET_NOFORK(uuidgen, uuidgen, BB_DIR_USR_BIN, > BB_SUID_DROP, uuidgen)) > + > +//kbuild:lib-$(CONFIG_UUIDGEN) += uuidgen.o > + > +//usage:#define uuidgen_trivial_usage > +//usage: "" > +//usage:#define uuidgen_full_usage "\n\n" > +//usage: "Generate a UUID (Universally Unique Identifier)" > + > +#include "libbb.h" > +#include "volume_id/volume_id_internal.h" > + > +/* This is a NOFORK applet. Be very careful! */ > + > +int uuidgen_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; > +int uuidgen_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) > +{ > + struct volume_id id; > + uint8_t uuid[16]; > + > + if (argv[1]) { > + bb_show_usage(); > + } > + > + generate_uuid(uuid); > + volume_id_set_uuid(&id, uuid, UUID_DCE); > + puts(id.uuid); > + > + return 0; > +} > + > -- > 2.43.0 > > _______________________________________________ > busybox mailing list > [email protected] > https://lists.busybox.net/mailman/listinfo/busybox _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
