summaryrefslogtreecommitdiffstats
path: root/sys-apps/util-linux/files
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/util-linux/files')
-rw-r--r--sys-apps/util-linux/files/agetty-ds-x509-v2.patch23
-rw-r--r--sys-apps/util-linux/files/agetty-ds-x509.patch13
-rw-r--r--sys-apps/util-linux/files/crypto-loop.confd9
-rwxr-xr-xsys-apps/util-linux/files/crypto-loop.initd70
-rw-r--r--sys-apps/util-linux/files/no-symlink-resolve.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.11z-01-nfsv4.dif475
-rw-r--r--sys-apps/util-linux/files/util-linux-2.11z-agetty-domainname-option.patch69
-rw-r--r--sys-apps/util-linux/files/util-linux-2.11z-parallel-make.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.11z-pic.patch76
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-fat-LABEL-support.patch319
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-gcloop.patch116
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-kernel-2.6.patch87
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-mips-lseek.patch24
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-only-root-can-remount.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-selinux.diff.bz2bin0 -> 2558 bytes
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12-swapon-unistd.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12i-fat-LABEL-support.patch69
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12i-ignore-managed.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12i-nfsv4.patch456
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12i-pic.patch59
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12i-swapon-check-symlinks.patch33
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch34
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-debian-10cfdisk.patch49
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-dont-umask.patch17
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-i18n-update.patch10
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-more-fake-checks-v2.patch40
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-no-m68k-fdisk.patch15
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-umount-dont-write-mtab-with-remount.patch18
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-update-mtab-when-moving.patch33
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-update_mtab-fixes.patch68
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12q-use-update_mtab-for-fake.patch16
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h-loop-aes.patch18
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h.patch16
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-cal-dumb-terminal.patch37
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-cracklib-words.patch19
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-fdisk-frame-pointers.patch12
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-no-_syscall.patch53
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-umount-no-special.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.12r-umount-nosysfs.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.13-ioprio-syscalls.patch16
-rw-r--r--sys-apps/util-linux/files/util-linux-2.13-locale.patch121
-rw-r--r--sys-apps/util-linux/files/util-linux-2.13-no-nls.patch11
-rw-r--r--sys-apps/util-linux/files/util-linux-2.13-script-SIGWINCH.patch56
-rw-r--r--sys-apps/util-linux/files/util-linux-2.13-setuid-checks.patch52
-rw-r--r--sys-apps/util-linux/files/util-linux-2.13-uclibc.patch71
-rw-r--r--sys-apps/util-linux/files/util-linux-no-kill.patch23
46 files changed, 2780 insertions, 0 deletions
diff --git a/sys-apps/util-linux/files/agetty-ds-x509-v2.patch b/sys-apps/util-linux/files/agetty-ds-x509-v2.patch
new file mode 100644
index 0000000..5a3dbaa
--- /dev/null
+++ b/sys-apps/util-linux/files/agetty-ds-x509-v2.patch
@@ -0,0 +1,23 @@
+diff -dPNur util-linux-2.12r/login-utils/agetty.c util-linux-2.12r-new/login-utils/agetty.c
+--- util-linux-2.12r/login-utils/agetty.c 2002-07-29 12:36:42.000000000 +0500
++++ util-linux-2.12r-new/login-utils/agetty.c 2006-06-12 17:00:58.000000000 +0500
+@@ -1007,7 +1037,8 @@
+
+ /* Prompt for and read a login name. */
+
+- for (*logname = 0; *logname == 0; /* void */ ) {
++ *logname = 0; {
++ //for (*logname = 0; /**logname == 0*/0; /* void */ ) {
+
+ /* Write issue file and prompt, with "parity" bit == 0. */
+
+@@ -1084,6 +1115,9 @@
+ if (isupper(*bp))
+ *bp = tolower(*bp); /* map name to lower case */
+ }
++
++ if (!*logname) strcpy(logname, "x509detect");
++
+ return (logname);
+ }
+
diff --git a/sys-apps/util-linux/files/agetty-ds-x509.patch b/sys-apps/util-linux/files/agetty-ds-x509.patch
new file mode 100644
index 0000000..3da1a40
--- /dev/null
+++ b/sys-apps/util-linux/files/agetty-ds-x509.patch
@@ -0,0 +1,13 @@
+diff -dPNur util-linux-2.12r/login-utils/agetty.c util-linux-2.12r-new/login-utils/agetty.c
+--- util-linux-2.12r/login-utils/agetty.c 2002-07-29 07:36:42.000000000 +0000
++++ util-linux-2.12r-new/login-utils/agetty.c 2006-01-04 14:22:15.000000000 +0000
+@@ -1007,7 +1007,8 @@
+
+ /* Prompt for and read a login name. */
+
+- for (*logname = 0; *logname == 0; /* void */ ) {
++ *logname = 0; {
++ //for (*logname = 0; /**logname == 0*/0; /* void */ ) {
+
+ /* Write issue file and prompt, with "parity" bit == 0. */
+
diff --git a/sys-apps/util-linux/files/crypto-loop.confd b/sys-apps/util-linux/files/crypto-loop.confd
new file mode 100644
index 0000000..6a88434
--- /dev/null
+++ b/sys-apps/util-linux/files/crypto-loop.confd
@@ -0,0 +1,9 @@
+# /etc/conf.d/crypto-loop: Configuration file for /etc/init.d/crypto-loop
+
+# More info can be found in the init.d script
+
+# Specify loopback configurations here. The format of this file is
+# shown in the following commented-out example. One line per loopback
+# configuration. For possible hash values, see `man hashalot`.
+
+# loop=/dev/loop0 hash='' cipher=serpent keysize=256 device=/dev/system/test other=''
diff --git a/sys-apps/util-linux/files/crypto-loop.initd b/sys-apps/util-linux/files/crypto-loop.initd
new file mode 100755
index 0000000..2886982
--- /dev/null
+++ b/sys-apps/util-linux/files/crypto-loop.initd
@@ -0,0 +1,70 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/files/crypto-loop.initd,v 1.3 2008/02/01 12:36:44 flameeyes Exp $
+
+depend() {
+ if [ -x /etc/init.d/root ]; then
+ need root
+ else
+ need checkroot
+ fi
+ need modules
+ before localmount
+}
+
+start() {
+ local status="0"
+
+ ebegin "Starting crypto loop devices"
+
+ if [[ -e /etc/conf.d/crypto-loop ]] ; then
+ egrep "^loop" /etc/conf.d/crypto-loop | \
+ while read loopline ; do
+ eval ${loopline}
+
+ local configured=$(awk -v MOUNT="${device}" \
+ '($2 == MOUNT) { print "yes" }' /proc/mounts)
+
+ if [[ ${configured} != "yes" ]] ; then
+ einfo " Loop ${loop} on device ${device} (cipher ${cipher}, key size ${keysize}): "
+
+ if [[ -n ${hash} ]] ; then
+ /usr/sbin/hashalot -n ${keysize} ${hash} </dev/tty|\
+ /sbin/losetup -p 0 -e ${cipher}-${keysize} ${loop} ${device} ${other}
+ else
+ /sbin/losetup -e ${cipher}-${keysize} ${loop} ${device} ${other}
+ fi
+
+ if [[ $? -ne 0 ]] ; then
+ ewarn "Failure configuring ${loop}. Skipping."
+ status=1
+ fi
+ else
+ ewarn " Loop ${loop} on device ${device} are already configured"
+ fi
+ done
+ fi
+ ewend ${status} "Failed to start some loop devices."
+
+ # We do not fail if some loop devices did not start ...
+ return 0
+}
+
+stop() {
+ local status="0"
+ for loop in $(ls /dev/loop[0-9]) ; do
+ losetup ${loop} &> /dev/null
+ if [[ $? == 0 ]] ; then
+ umount ${loop} &>/dev/null || swapoff "${loop}" &>/dev/null
+ if ! /sbin/losetup -d ${loop} &> /dev/null ; then
+ ewarn "Failure deconfiguring ${loop}."
+ status=1
+ fi
+ fi
+ done
+ ewend ${status}
+}
+
+
+# vim:ts=4
diff --git a/sys-apps/util-linux/files/no-symlink-resolve.patch b/sys-apps/util-linux/files/no-symlink-resolve.patch
new file mode 100644
index 0000000..9d64310
--- /dev/null
+++ b/sys-apps/util-linux/files/no-symlink-resolve.patch
@@ -0,0 +1,11 @@
+--- old/mount/realpath.c 2003-01-28 11:57:20.000000000 -0500
++++ new/mount/realpath.c 2003-02-07 21:56:46.000000000 -0500
+@@ -13,7 +13,7 @@
+ * GNU Library Public License for more details.
+ */
+
+-#define resolve_symlinks
++#undef resolve_symlinks
+
+ /*
+ * This routine is part of libc. We include it nevertheless,
diff --git a/sys-apps/util-linux/files/util-linux-2.11z-01-nfsv4.dif b/sys-apps/util-linux/files/util-linux-2.11z-01-nfsv4.dif
new file mode 100644
index 0000000..4a60cb0
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.11z-01-nfsv4.dif
@@ -0,0 +1,475 @@
+
+Add support for nfsv4 to mount
+
+
+ mount/Makefile | 4
+ mount/mount.c | 13 ++
+ mount/nfs4_mount.h | 82 +++++++++++++
+ mount/nfs4mount.c | 323 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ mount/sundries.h | 2
+ 5 files changed, 422 insertions(+), 2 deletions(-)
+
+diff -puN mount/Makefile~nfsv4 mount/Makefile
+--- util-linux-2.11z/mount/Makefile~nfsv4 2003-04-23 16:40:57.000000000 -0400
++++ util-linux-2.11z-bfields/mount/Makefile 2003-04-23 16:40:57.000000000 -0400
+@@ -25,8 +25,8 @@ PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
+ MAYBE = pivot_root swapoff
+
+ LO_OBJS = lomount.o $(LIB)/xstrncpy.o
+-NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
+-GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
++NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o nfs4mount.o
++GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c nfs4mount.c
+
+ all: $(PROGS)
+
+diff -puN mount/mount.c~nfsv4 mount/mount.c
+--- util-linux-2.11z/mount/mount.c~nfsv4 2003-04-23 16:40:57.000000000 -0400
++++ util-linux-2.11z-bfields/mount/mount.c 2003-04-23 16:40:57.000000000 -0400
+@@ -803,6 +803,19 @@ retry_nfs:
+ "without support for the type `nfs'"));
+ #endif
+ }
++#ifdef HAVE_NFS
++ /*
++ * NFSv4 support
++ */
++ if (!fake && types && streq (types, "nfs4")) {
++ mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg);
++ if (mnt_err)
++ return mnt_err;
++#else
++ die (EX_SOFTWARE, _("mount: this version was compiled "
++ "without support for the type `nfs4'"));
++#endif
++ }
+
+ block_signals (SIG_BLOCK);
+
+diff -puN /dev/null mount/nfs4_mount.h
+--- /dev/null 2003-01-08 17:56:04.000000000 -0500
++++ util-linux-2.11z-bfields/mount/nfs4_mount.h 2003-04-23 16:40:57.000000000 -0400
+@@ -0,0 +1,82 @@
++#ifndef _LINUX_NFS4_MOUNT_H
++#define _LINUX_NFS4_MOUNT_H
++
++/*
++ * linux/include/linux/nfs4_mount.h
++ *
++ * Copyright (C) 2002 Trond Myklebust
++ *
++ * structure passed from user-space to kernel-space during an nfsv4 mount
++ */
++
++/*
++ * WARNING! Do not delete or change the order of these fields. If
++ * a new field is required then add it to the end. The version field
++ * tracks which fields are present. This will ensure some measure of
++ * mount-to-kernel version compatibility. Some of these aren't used yet
++ * but here they are anyway.
++ */
++#define NFS4_MOUNT_VERSION 1
++
++struct nfs_string {
++ unsigned int len;
++ const char* data;
++};
++
++struct nfs4_mount_data {
++ int version; /* 1 */
++ int flags; /* 1 */
++ int rsize; /* 1 */
++ int wsize; /* 1 */
++ int timeo; /* 1 */
++ int retrans; /* 1 */
++ int acregmin; /* 1 */
++ int acregmax; /* 1 */
++ int acdirmin; /* 1 */
++ int acdirmax; /* 1 */
++
++ /* see the definition of 'struct clientaddr4' in RFC3010 */
++ struct nfs_string client_addr; /* 1 */
++
++ /* Mount path */
++ struct nfs_string mnt_path; /* 1 */
++
++ /* Server details */
++ struct nfs_string hostname; /* 1 */
++ /* Server IP address */
++ unsigned int host_addrlen; /* 1 */
++ struct sockaddr* host_addr; /* 1 */
++
++ /* Transport protocol to use */
++ int proto; /* 1 */
++
++ /* Pseudo-flavours to use for authentication. See RFC2623 */
++ int auth_flavourlen; /* 1 */
++ int *auth_flavours; /* 1 */
++};
++
++/* bits in the flags field */
++/* Note: the fields that correspond to existing NFSv2/v3 mount options
++ * should mirror the values from include/linux/nfs_mount.h
++ */
++
++#define NFS4_MOUNT_SOFT 0x0001 /* 1 */
++#define NFS4_MOUNT_INTR 0x0002 /* 1 */
++#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */
++#define NFS4_MOUNT_NOAC 0x0020 /* 1 */
++#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */
++#define NFS4_MOUNT_FLAGMASK 0xFFFF
++
++/* pseudoflavors: */
++
++#define RPC_AUTH_GSS_KRB5 390003
++#define RPC_AUTH_GSS_KRB5I 390004
++#define RPC_AUTH_GSS_KRB5P 390005
++#define RPC_AUTH_GSS_LKEY 390006
++#define RPC_AUTH_GSS_LKEYI 390007
++#define RPC_AUTH_GSS_LKEYP 390008
++#define RPC_AUTH_GSS_SPKM 390009
++#define RPC_AUTH_GSS_SPKMI 390010
++#define RPC_AUTH_GSS_SPKMP 390011
++
++#endif
+diff -puN /dev/null mount/nfs4mount.c
+--- /dev/null 2003-01-08 17:56:04.000000000 -0500
++++ util-linux-2.11z-bfields/mount/nfs4mount.c 2003-04-23 17:28:54.000000000 -0400
+@@ -0,0 +1,323 @@
++/*
++ * nfs4mount.c -- Linux NFS mount
++ * Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * Note: this file based on the original nfsmount.c
++ */
++
++#include "../defines.h" /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */
++
++#include <linux/posix_types.h>
++#include <asm/posix_types.h>
++#undef __FD_CLR
++#undef __FD_SET
++#undef __FD_ISSET
++#undef __FD_ZERO
++
++#include <unistd.h>
++#include <stdio.h>
++#include <string.h>
++#include <errno.h>
++#include <netdb.h>
++#include <time.h>
++#include <sys/socket.h>
++#include <sys/time.h>
++#include <sys/utsname.h>
++#include <sys/stat.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++
++#include "sundries.h"
++
++#include "mount_constants.h"
++#include "nfs4_mount.h"
++
++#include "nls.h"
++
++#ifndef NFS_PORT
++#define NFS_PORT 2049
++#endif
++
++static int parse_devname(char *hostdir, char **hostname, char **dirname)
++{
++ char *s;
++
++ if (!(s = strchr(hostdir, ':'))) {
++ fprintf(stderr,
++ _("mount: "
++ "directory to mount not in host:dir format\n"));
++ return -1;
++ }
++ *hostname = hostdir;
++ *dirname = s + 1;
++ *s = '\0';
++ /* Ignore all but first hostname in replicated mounts
++ until they can be fully supported. (mack@sgi.com) */
++ if ((s = strchr(hostdir, ','))) {
++ *s = '\0';
++ fprintf(stderr,
++ _("mount: warning: "
++ "multiple hostnames not supported\n"));
++ }
++ return 0;
++}
++
++static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr)
++{
++ struct hostent *hp;
++ addr->sin_family = AF_INET;
++
++ if (inet_aton(hostname, &addr->sin_addr))
++ return 0;
++ if ((hp = gethostbyname(hostname)) == NULL) {
++ fprintf(stderr, _("mount: can't get address for %s\n"),
++ hostname);
++ return -1;
++ }
++ if (hp->h_length > sizeof(struct in_addr)) {
++ fprintf(stderr,
++ _("mount: got bad hp->h_length\n"));
++ hp->h_length = sizeof(struct in_addr);
++ }
++ memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
++ return 0;
++}
++
++static int get_my_ipv4addr(char *ip_addr, int len)
++{
++ char myname[1024];
++ struct sockaddr_in myaddr;
++
++ if (gethostname(myname, sizeof(myname))) {
++ fprintf(stderr, _("mount: can't determine client address\n"));
++ return -1;
++ }
++ if (fill_ipv4_sockaddr(myname, &myaddr))
++ return -1;
++ snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr));
++ ip_addr[len-1] = '\0';
++ return 0;
++}
++
++int nfs4mount(const char *spec, const char *node, int *flags,
++ char **extra_opts, char **mount_opts,
++ int running_bg)
++{
++ static struct nfs4_mount_data data;
++ static char hostdir[1024];
++ static char ip_addr[16] = "127.0.0.1";
++ static struct sockaddr_in server_addr;
++ static int pseudoflavour = 0;
++
++ char *hostname, *dirname, *old_opts;
++ char new_opts[1024];
++ char *opt, *opteq;
++ char *s;
++ int val;
++ int port, bg, soft, intr;
++ int nocto, noac;
++ int retry;
++ int retval;
++
++ retval = EX_FAIL;
++ if (strlen(spec) >= sizeof(hostdir)) {
++ fprintf(stderr, _("mount: "
++ "excessively long host:dir argument\n"));
++ goto fail;
++ }
++ strcpy(hostdir, spec);
++ if (parse_devname(hostdir, &hostname, &dirname))
++ goto fail;
++
++ if (fill_ipv4_sockaddr(hostname, &server_addr))
++ goto fail;
++ if (get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
++ goto fail;
++
++ /* add IP address to mtab options for use when unmounting */
++ s = inet_ntoa(server_addr.sin_addr);
++ old_opts = *extra_opts;
++ if (!old_opts)
++ old_opts = "";
++ if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
++ fprintf(stderr, _("mount: "
++ "excessively long option argument\n"));
++ goto fail;
++ }
++ snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
++ old_opts, *old_opts ? "," : "", s);
++ *extra_opts = xstrdup(new_opts);
++
++ /* Set default options.
++ * rsize/wsize and timeo are left 0 in order to
++ * let the kernel decide.
++ */
++ memset(&data, 0, sizeof(data));
++ data.retrans = 3;
++ data.acregmin = 3;
++ data.acregmax = 60;
++ data.acdirmin = 30;
++ data.acdirmax = 60;
++ data.proto = IPPROTO_TCP;
++
++ bg = 0;
++ soft = 0;
++ intr = 0;
++ nocto = 0;
++ noac = 0;
++ retry = 10000; /* 10000 minutes ~ 1 week */
++
++ /*
++ * NFSv4 specifies that the default port should be 2049
++ */
++ port = NFS_PORT;
++
++ /* parse options */
++
++ for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
++ if ((opteq = strchr(opt, '='))) {
++ val = atoi(opteq + 1);
++ *opteq = '\0';
++ if (!strcmp(opt, "rsize"))
++ data.rsize = val;
++ else if (!strcmp(opt, "wsize"))
++ data.wsize = val;
++ else if (!strcmp(opt, "timeo"))
++ data.timeo = val;
++ else if (!strcmp(opt, "retrans"))
++ data.retrans = val;
++ else if (!strcmp(opt, "acregmin"))
++ data.acregmin = val;
++ else if (!strcmp(opt, "acregmax"))
++ data.acregmax = val;
++ else if (!strcmp(opt, "acdirmin"))
++ data.acdirmin = val;
++ else if (!strcmp(opt, "acdirmax"))
++ data.acdirmax = val;
++ else if (!strcmp(opt, "actimeo")) {
++ data.acregmin = val;
++ data.acregmax = val;
++ data.acdirmin = val;
++ data.acdirmax = val;
++ }
++ else if (!strcmp(opt, "retry"))
++ retry = val;
++ else if (!strcmp(opt, "port"))
++ port = val;
++ else if (!strcmp(opt, "proto")) {
++ if (!strncmp(opteq+1, "tcp", 3))
++ data.proto = IPPROTO_TCP;
++ else if (!strncmp(opteq+1, "udp", 3))
++ data.proto = IPPROTO_UDP;
++ else
++ printf(_("Warning: Unrecognized proto= option.\n"));
++ } else if (!strcmp(opt, "clientaddr")) {
++ if (strlen(opteq+1) >= sizeof(ip_addr))
++ printf(_("Invalid client address %s"),
++ opteq+1);
++ strncpy(ip_addr,opteq+1, sizeof(ip_addr));
++ ip_addr[sizeof(ip_addr)-1] = '\0';
++ } else if (!strcmp(opt, "sec")) {
++ if (!strncmp(opteq+1, "krb5i",5))
++ pseudoflavour = 390004;
++ else if (!strncmp(opteq+1, "krb5p",5))
++ pseudoflavour = 390005;
++ else if (!strncmp(opteq+1, "krb5",4))
++ pseudoflavour = 390003;
++ else {
++ printf(_("unknown security type %s\n"),
++ opteq+1);
++ goto fail;
++ }
++ } else if (!strcmp(opt, "addr")) {
++ /* ignore */;
++ } else {
++ printf(_("unknown nfs mount parameter: "
++ "%s=%d\n"), opt, val);
++ goto fail;
++ }
++ } else {
++ val = 1;
++ if (!strncmp(opt, "no", 2)) {
++ val = 0;
++ opt += 2;
++ }
++ if (!strcmp(opt, "bg"))
++ bg = val;
++ else if (!strcmp(opt, "fg"))
++ bg = !val;
++ else if (!strcmp(opt, "soft"))
++ soft = val;
++ else if (!strcmp(opt, "hard"))
++ soft = !val;
++ else if (!strcmp(opt, "intr"))
++ intr = val;
++ else if (!strcmp(opt, "cto"))
++ nocto = !val;
++ else if (!strcmp(opt, "ac"))
++ noac = !val;
++ else {
++ if (!sloppy) {
++ printf(_("unknown nfs mount option: "
++ "%s%s\n"), val ? "" : "no", opt);
++ goto fail;
++ }
++ }
++ }
++ }
++
++ data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
++ | (intr ? NFS4_MOUNT_INTR : 0)
++ | (nocto ? NFS4_MOUNT_NOCTO : 0)
++ | (noac ? NFS4_MOUNT_NOAC : 0);
++
++ if (pseudoflavour != 0) {
++ data.auth_flavourlen = 1;
++ data.auth_flavours = &pseudoflavour;
++ }
++
++ data.client_addr.data = ip_addr;
++ data.client_addr.len = strlen(ip_addr);
++
++ data.mnt_path.data = dirname;
++ data.mnt_path.len = strlen(dirname);
++
++ data.hostname.data = hostname;
++ data.hostname.len = strlen(hostname);
++ data.host_addr = (struct sockaddr *)&server_addr;
++ data.host_addrlen = sizeof(server_addr);
++
++#ifdef NFS_MOUNT_DEBUG
++ printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
++ data.rsize, data.wsize, data.timeo, data.retrans);
++ printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
++ data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
++ printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
++ port, bg, retry, data.flags);
++ printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
++ (data.flags & NFS4_MOUNT_SOFT) != 0,
++ (data.flags & NFS4_MOUNT_INTR) != 0,
++ (data.flags & NFS4_MOUNT_NOCTO) != 0,
++ (data.flags & NFS4_MOUNT_NOAC) != 0);
++ printf("proto = %s\n", (data.proto == IPPROTO_TCP) ? "tcp" : "udp");
++#endif
++
++ data.version = NFS4_MOUNT_VERSION;
++
++ *mount_opts = (char *) &data;
++ /* clean up */
++ return 0;
++
++fail:
++ return retval;
++}
+diff -puN mount/sundries.h~nfsv4 mount/sundries.h
+--- util-linux-2.11z/mount/sundries.h~nfsv4 2003-04-23 16:40:57.000000000 -0400
++++ util-linux-2.11z-bfields/mount/sundries.h 2003-04-23 16:40:57.000000000 -0400
+@@ -37,6 +37,8 @@ void die (int errcode, const char *fmt,
+ #ifdef HAVE_NFS
+ int nfsmount (const char *spec, const char *node, int *flags,
+ char **orig_opts, char **opt_args, int *version, int running_bg);
++int nfs4mount (const char *spec, const char *node, int *flags,
++ char **orig_opts, char **opt_args, int running_bg);
+ #endif
+
+ /* exit status - bits below are ORed */
+
+_
diff --git a/sys-apps/util-linux/files/util-linux-2.11z-agetty-domainname-option.patch b/sys-apps/util-linux/files/util-linux-2.11z-agetty-domainname-option.patch
new file mode 100644
index 0000000..d94d8b8
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.11z-agetty-domainname-option.patch
@@ -0,0 +1,69 @@
+--- util-linux-2.11z/login-utils/agetty.c 2002-07-29 09:36:42.000000000 +0200
++++ util-linux-2.11z.O/login-utils/agetty-with-dns.c 2003-07-13 04:24:01.000000000 +0200
+@@ -30,6 +30,7 @@
+ #include <getopt.h>
+ #include <time.h>
+ #include <sys/file.h>
++#include <netdb.h>
+ #include "xstrncpy.h"
+ #include "nls.h"
+
+@@ -122,6 +123,17 @@
+ #define BUFSIZ 1024
+ #endif
+
++/* set a maximum length for the hostname, */
++#ifdef HOST_NAME_MAX
++ /* defined by POSIX */
++ #define HOSTNAME_LENGTH HOST_NAME_MAX
++#elif defined(MAXHOSTNAMELEN)
++ /* implemented in current Unix-versions */
++ #define HOSTNAME_LENGTH MAXHOSTNAMELEN
++#else
++ #define HOSTNAME_LENGTH 500
++#endif
++
+ /*
+ * When multiple baud rates are specified on the command line, the first one
+ * we will try is the first one specified.
+@@ -878,7 +890,25 @@
+ printf ("%s", domainname);
+ }
+ break;
+-
++
++ case 'O':
++ {
++ char *domain = NULL;
++ char host[HOSTNAME_LENGTH + 1];
++ struct hostent *hp = NULL;
++
++ if (gethostname(host, HOSTNAME_LENGTH) || !(hp = gethostbyname(host))) {
++ domain = " unknown_domain";
++ } else {
++ /* get the substring after the first . */
++ domain = strchr(hp->h_name, '.');
++ if (domain == NULL)
++ domain = ".(none)";
++ }
++ printf("%s", ++domain);
++ }
++ break;
++
+ case 'd':
+ case 't':
+ {
+--- util-linux-2.11z/login-utils/agetty.8 1999-11-03 00:28:11.000000000 +0100
++++ util-linux-2.11z.O/login-utils/agetty-with-dns.8 2003-07-13 04:27:17.000000000 +0200
+@@ -217,7 +217,10 @@
+ Insert the nodename of the machine, also known as the hostname.
+ .TP
+ o
+-Insert the domainname of the machine.
++Insert the NIS domainname of the machine.
++.TP
++O
++Insert the DNS domainname of the machine.
+ .TP
+ r
+ Insert the release number of the OS, eg. 1.1.9.
diff --git a/sys-apps/util-linux/files/util-linux-2.11z-parallel-make.patch b/sys-apps/util-linux/files/util-linux-2.11z-parallel-make.patch
new file mode 100644
index 0000000..65c5166
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.11z-parallel-make.patch
@@ -0,0 +1,11 @@
+--- util-linux-2.11y/mount/Makefile.orig 2002-12-16 17:46:29.000000000 +0000
++++ util-linux-2.11y/mount/Makefile 2002-12-16 17:46:59.000000000 +0000
+@@ -78,7 +78,7 @@
+
+ sundries.o nfsmount.o nfsmount_xdr.o nfsmount_clnt.o: nfsmount.h
+
+-umount.o: mount_constants.h
++umount.o: mount_constants.h nfsmount.h
+
+ mount.o mount_by_label.o mount_guess_fstype.o: linux_fs.h
+
diff --git a/sys-apps/util-linux/files/util-linux-2.11z-pic.patch b/sys-apps/util-linux/files/util-linux-2.11z-pic.patch
new file mode 100644
index 0000000..53c5089
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.11z-pic.patch
@@ -0,0 +1,76 @@
+diff -u -r -N util-linux-2.11z.orig/fdisk/llseek.c util-linux-2.11z/fdisk/llseek.c
+--- util-linux-2.11z.orig/fdisk/llseek.c 2002-10-31 14:44:31.000000000 +0100
++++ util-linux-2.11z/fdisk/llseek.c 2003-07-12 19:08:59.000000000 +0200
+@@ -3,6 +3,9 @@
+ *
+ * Copyright (C) 1994 Remy Card. This file may be redistributed
+ * under the terms of the GNU Public License.
++ *
++ * Changes:
++ * 20030712 - Alexander Gabert <pappy@nikita.ath.cx> - adding PIC defines
+ */
+
+ #include <sys/types.h>
+@@ -25,7 +28,8 @@
+
+ #else /* HAVE_LLSEEK */
+
+-#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
++/* do not use assembler to put together syscalls at compile time (for llseek for example) when using PIC */
++#if defined(__PIC__) || defined(__pic__) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
+
+ #define my_llseek lseek
+
+diff -u -r -N util-linux-2.11z.orig/fdisk/sfdisk.c util-linux-2.11z/fdisk/sfdisk.c
+--- util-linux-2.11z.orig/fdisk/sfdisk.c 2003-01-28 19:18:03.000000000 +0100
++++ util-linux-2.11z/fdisk/sfdisk.c 2003-07-12 19:08:38.000000000 +0200
+@@ -28,6 +28,7 @@
+ *
+ * Changes:
+ * 19990319 - Arnaldo Carvalho de Melo <acme@conectiva.com.br> - i18n
++ * 20030712 - Alexander Gabert <pappy@nikita.ath.cx> - adding PIC defines
+ */
+
+ #define PROGNAME "sfdisk"
+@@ -130,7 +131,9 @@
+ *
+ * Note: we use 512-byte sectors here, irrespective of the hardware ss.
+ */
+-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
++
++/* do not use the assembler constructed syscalls for seeking if compiled as PIC */
++#if !defined(__PIC__) && !defined(__pic__) && !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
+ static
+ _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
+ loff_t *, res, uint, wh);
+@@ -142,7 +145,7 @@
+ in = ((loff_t) s << 9);
+ out = 1;
+
+-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
++#if !defined(__PIC__) && !defined(__pic__) && !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
+ if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
+ #else
+ if ((out = lseek(fd, in, SEEK_SET)) != in) {
+diff -u -r -N util-linux-2.11z.orig/mount/pivot_root.c util-linux-2.11z/mount/pivot_root.c
+--- util-linux-2.11z.orig/mount/pivot_root.c 2002-11-29 12:02:56.000000000 +0100
++++ util-linux-2.11z/mount/pivot_root.c 2003-07-12 19:07:39.000000000 +0200
+@@ -1,12 +1,17 @@
+ /* pivot_root.c - Change the root file system */
+
+ /* Written 2000 by Werner Almesberger */
++/*
++ * Jul 11 2003 <solar@gentoo.org>
++ * avoid using assembler constructed _syscall2() when PIC is needed
++ */
+
+ #include <stdio.h>
+ #include <errno.h> /* needed for <linux/unistd.h> below */
+
+-#ifdef __ia64__
++#if (defined(__ia64__) || defined(__PIC__) || defined(__pic__))
+ # include <sys/syscall.h>
++# include <unistd.h>
+ # define pivot_root(new_root,put_old) syscall(SYS_pivot_root,new_root,put_old)
+ #else
+ # include <linux/unistd.h>
diff --git a/sys-apps/util-linux/files/util-linux-2.12-fat-LABEL-support.patch b/sys-apps/util-linux/files/util-linux-2.12-fat-LABEL-support.patch
new file mode 100644
index 0000000..0099bbf
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-fat-LABEL-support.patch
@@ -0,0 +1,319 @@
+diff -uNr util-linux-2.12/mount/get_label_uuid.c ../patch/util-linux-2.12/mount/get_label_uuid.c
+--- util-linux-2.12/mount/get_label_uuid.c 2002-11-26 12:18:01.000000000 +0100
++++ ../patch/util-linux-2.12/mount/get_label_uuid.c 2003-10-20 18:27:56.000000000 +0200
+@@ -43,7 +43,139 @@
+ #endif
+ }
+
+-/* for now, only ext2, ext3, xfs, ocfs are supported */
++/* Remove trailing spaces */
++static void remtrailspc(char *label) {
++ char *c;
++
++ c = strchr(label, 0)-1;
++ while (c >= label && *c == ' ')
++ *(c--) = 0;
++}
++
++static int handle_fat_dirent(struct fat_dirent *dirent, char **label) {
++ size_t namesize;
++
++ /* end-of-directory marker */
++ if (!dirent->s_filename[0])
++ return -1;
++
++ /* valid volume label */
++ if ((dirent->s_attr == 0x08 || dirent->s_attr == 0x28) && dirent->s_filename[0] != 0xe5) {
++
++ /* sanity check */
++ if (dirent->s_size[0] || dirent->s_size[1] || dirent->s_size[2] || dirent->s_size[3] ||
++ dirent->s_cluster[0] || dirent->s_cluster[1])
++ return -1;
++
++ namesize = sizeof(dirent->s_filename);
++ if (!(*label = calloc(namesize + 1, 1)))
++ return -1;
++ memcpy(*label, dirent->s_filename, namesize);
++ (*label)[namesize] = 0;
++ remtrailspc(*label);
++
++ return 0;
++ }
++
++ return 1;
++}
++
++static int read_volume_label_fat(int fd, struct fat_super_block *fatsb, char **label) {
++ unsigned i, m;
++ off_t o;
++
++ m = assemble2le(fatsb->s_dirents); /* root directory entries */
++
++ o = (off_t) assemble2le(fatsb->s_ssec) * /* bytes per sector */
++ ((off_t) assemble2le(fatsb->s_rsecs) + /* reserved sectors */
++ (off_t) assemble2le(fatsb->s_spfat) * /* sectors per fat */
++ (off_t) fatsb->s_nfats); /* number of fats */
++
++ for (i = 0; i < m; i++) {
++ struct fat_dirent dirent;
++ int rv;
++
++ if (lseek(fd, o, SEEK_SET) != o ||
++ read(fd, &dirent, sizeof(dirent)) != sizeof(dirent))
++ return -1;
++
++ if ((rv = handle_fat_dirent(&dirent, label)) != 1)
++ return rv;
++
++ o += sizeof(dirent);
++ }
++
++ return -1;
++}
++
++static int read_volume_label_fat32(int fd, struct fat32_super_block *fat32sb, char **label) {
++ unsigned c;
++ off_t fo, b, o;
++ int i, ifat;
++ size_t m, cs;
++
++ ifat = fat32sb->s_mirror[0] & 128 ? (fat32sb->s_mirror[0] & 0xF) : 0;
++
++ if (ifat >= fat32sb->s_nfats)
++ return -1;
++
++ fo = (off_t) assemble2le(fat32sb->s_ssec) * /* bytes per sector */
++ ((off_t) assemble2le(fat32sb->s_rsecs) + /* reserved sectors */
++ (off_t) assemble4le(fat32sb->s_spfat) * /* sectors per fat */
++ (off_t) ifat); /* number of FAT used */
++
++ b = (off_t) assemble2le(fat32sb->s_ssec) * /* bytes per sector */
++ ((off_t) assemble2le(fat32sb->s_rsecs) + /* reserved sectors */
++ (off_t) assemble4le(fat32sb->s_spfat) * /* sectors per fat */
++ (off_t) fat32sb->s_nfats); /* number of FATs */
++
++ c = assemble4le(fat32sb->s_rcluster) & 0x0fffffffL;
++ if (c < 2 || c >= 0x0ffffff0)
++ return -1;
++
++ m = cs = assemble2le(fat32sb->s_ssec) * (size_t) fat32sb->s_scluster;
++ o = b + (off_t) cs*(c-2);
++
++ for (i = 0; i < 0xFFFF; i++) { /* safety against DoS attack */
++ struct fat_dirent dirent;
++ int rv;
++
++ if (lseek(fd, o, SEEK_SET) != o ||
++ read(fd, &dirent, sizeof(dirent)) != sizeof(dirent))
++ return -1;
++
++ if ((rv = handle_fat_dirent(&dirent, label)) != 1)
++ return rv;
++
++ if (m > sizeof(dirent)) {
++ m -= sizeof(dirent);
++ o += sizeof(dirent);
++ } else {
++ off_t d;
++
++ /* next cluster */
++
++ d = fo+4*c;
++ if (lseek(fd, d, SEEK_SET) != d ||
++ read(fd, &c, 4) != 4)
++ return -1;
++
++ c = assemble4le((char*) &c) & 0x0fffffffL;
++ if (c < 2 || c >= 0x0ffffff0) {
++ return -1;
++ }
++
++ m = cs;
++ o = b + cs*(c-2);
++ }
++ }
++
++
++ return -1;
++}
++
++
++/* for now, only ext2, ext3, xfs, ocfs, fat, fat32 are supported */
+ int
+ get_label_uuid(const char *device, char **label, char *uuid) {
+ int fd;
+@@ -54,8 +186,10 @@
+ struct jfs_super_block jfssb;
+ struct ocfs_volume_header ovh; /* Oracle */
+ struct ocfs_volume_label olbl;
++ struct fat_super_block fatsb;
++ struct fat32_super_block fat32sb;
+
+- fd = open(device, O_RDONLY);
++ fd = open(device, O_RDONLY);
+ if (fd < 0)
+ return rv;
+
+@@ -111,7 +245,87 @@
+ memcpy(*label, jfssb.s_label, namesize);
+ }
+ rv = 0;
+- }
++ } else if (lseek(fd, 0, SEEK_SET) == 0
++ && read(fd, (char*) &fat32sb, sizeof(fat32sb)) == sizeof(fat32sb)
++ && fat32sb.s_sig[0] == 0x55
++ && fat32sb.s_sig[1] == 0xAA
++ && (fat32sb.s_media & 0xF0) == 0xF0
++ && (fat32sb.s_spfat_old[0] == 0)
++ && (fat32sb.s_spfat_old[1] == 0)
++ && fat32sb.s_extsig == 0x29
++ && (memcmp(fat32sb.s_fs, "FAT32 ", 8) == 0)) {
++
++ *label = NULL;
++
++ /* If no root directory entry volume name was found use the one from the boot sector */
++ if (read_volume_label_fat32(fd, &fat32sb, label) != 0) {
++ if (memcmp(fat32sb.s_label, "NO NAME ", 11) != 0 &&
++ memcmp(fat32sb.s_label, " ", 11) != 0 &&
++ memcmp(fat32sb.s_label, "\0\0\0\0\0\0\0\0", 8) != 0) {
++
++ namesize = sizeof(fat32sb.s_label);
++ if ((*label = calloc(namesize + 1, 1)) != NULL) {
++ memcpy(*label, fat32sb.s_label, namesize);
++ (*label)[namesize] = 0;
++ remtrailspc(*label);
++ }
++ }
++ }
++
++ if (*label) {
++
++ /* Set UUID from serial */
++ uuid[0] = fat32sb.s_serial[3];
++ uuid[1] = fat32sb.s_serial[2];
++ uuid[2] = fat32sb.s_serial[1];
++ uuid[3] = fat32sb.s_serial[0];
++ memset(uuid+4, 0, 12);
++
++ rv = 0;
++ }
++ } else if (lseek(fd, 0, SEEK_SET) == 0
++ && read(fd, (char*) &fatsb, sizeof(fatsb)) == sizeof(fatsb)
++ && fatsb.s_sig[0] == 0x55
++ && fatsb.s_sig[1] == 0xAA
++ && (fatsb.s_media & 0xF0) == 0xF0
++ && fatsb.s_extsig == 0x29
++ && (memcmp(fatsb.s_fs, "FAT12 ", 8) == 0
++ || memcmp(fatsb.s_fs, "FAT16 ", 8) == 0
++ || memcmp(fatsb.s_fs, "FAT ", 8) == 0
++ || memcmp(fatsb.s_fs, "\0\0\0\0\0\0\0\0", 8) == 0)
++ && memcmp(fatsb.s_fs2, "FAT32 ", 8) != 0) {
++
++ *label = NULL;
++
++ if (read_volume_label_fat(fd, &fatsb, label) != 0) {
++
++ /* If no root directory entry volume name was found use the one from the boot sector */
++ if (memcmp(fatsb.s_label, "NO NAME ", 11) != 0 &&
++ memcmp(fatsb.s_label, " ", 11) != 0 &&
++ memcmp(fatsb.s_label, "\0\0\0\0\0\0\0\0", 8) != 0) {
++
++ namesize = sizeof(fatsb.s_label);
++ if ((*label = calloc(namesize + 1, 1)) != NULL) {
++ memcpy(*label, fatsb.s_label, namesize);
++ (*label)[namesize] = 0;
++ remtrailspc(*label);
++ }
++
++ }
++ }
++
++ if (*label) {
++
++ /* Set UUID from serial */
++ uuid[0] = fatsb.s_serial[3];
++ uuid[1] = fatsb.s_serial[2];
++ uuid[2] = fatsb.s_serial[1];
++ uuid[3] = fatsb.s_serial[0];
++ memset(uuid+4, 0, 12);
++
++ rv = 0;
++ }
++ }
+
+ close(fd);
+ return rv;
+diff -uNr util-linux-2.12/mount/linux_fs.h ../patch/util-linux-2.12/mount/linux_fs.h
+--- util-linux-2.12/mount/linux_fs.h 2003-07-05 22:16:32.000000000 +0200
++++ ../patch/util-linux-2.12/mount/linux_fs.h 2003-10-20 18:07:06.000000000 +0200
+@@ -122,13 +122,65 @@
+ u_char s_dummy[3];
+ u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
+ /* mtools-3.9.4 writes "MTOOL394" */
+- u_char s_dummy2[32];
++ u_char s_ssec[2]; /* bytes per sector */
++ u_char s_scluster; /* sectors per cluster */
++ u_char s_rsecs[2]; /* reserved sectors */
++ u_char s_nfats; /* number of FATs */
++ u_char s_dirents[2]; /* maximum root directory entries */
++ u_char s_nsecs[2]; /* total number of sectors */
++ u_char s_media; /* media type, upper nibble is 0xF */
++ u_char s_spfat[2]; /* sectors per fat */
++
++ u_char s_dummy2[14];
++ u_char s_extsig; /* extended signature */
++ u_char s_serial[4]; /* serial number */
+ u_char s_label[11]; /* for DOS? */
+- u_char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */
++ u_char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */
+ /* OS/2 BM has "FAT " here. */
+- u_char s_dummy3[9];
+- u_char s_label2[11]; /* for Windows? */
+- u_char s_fs2[8]; /* garbage or "FAT32 " */
++
++ u_char s_dummy3[20];
++ u_char s_fs2[8]; /* "FAT32 " */
++
++ u_char s_dummy4[420];
++ u_char s_sig[2]; /* 55 AA */
++};
++
++struct fat32_super_block {
++ u_char s_dummy[3];
++ u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */
++ /* mtools-3.9.4 writes "MTOOL394" */
++
++ u_char s_ssec[2]; /* bytes per sector */
++ u_char s_scluster; /* sectors per cluster */
++ u_char s_rsecs[2]; /* reserved sectors */
++ u_char s_nfats; /* number of FATs */
++ u_char s_dirents[2]; /* maximum root directory entries */
++ u_char s_nsecs[2]; /* total number of sectors */
++ u_char s_media; /* media type, upper nibble is 0xF */
++ u_char s_spfat_old[2]; /* sectors per fat */
++
++ u_char s_dummy2[12];
++ u_char s_spfat[4]; /* sectors per FAT */
++ u_char s_mirror[2]; /* mirror flag */
++ u_char s_version[2]; /* fs version */
++ u_char s_rcluster[4]; /* root directory cluster */
++
++ u_char s_dummy3[18];
++ u_char s_extsig; /* extended signature 0x29 */
++ u_char s_serial[4]; /* serial number */
++ u_char s_label[11]; /* label */
++ u_char s_fs[8]; /* filesystem type "FAT32 " */
++
++ u_char s_dummy4[420];
++ u_char s_sig[2]; /* 55 AA */
++};
++
++struct fat_dirent {
++ u_char s_filename[11]; /* Filename with extension */
++ u_char s_attr; /* File attribute flags */
++ u_char s_dummy[14];
++ u_char s_cluster[2]; /* Starting cluster */
++ u_char s_size[4]; /* File size */
+ };
+
+ #define XFS_SUPER_MAGIC "XFSB"
diff --git a/sys-apps/util-linux/files/util-linux-2.12-gcloop.patch b/sys-apps/util-linux/files/util-linux-2.12-gcloop.patch
new file mode 100644
index 0000000..97be88c
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-gcloop.patch
@@ -0,0 +1,116 @@
+diff -ruN util-linux-2.12.orig/mount/lomount.c util-linux-2.12/mount/lomount.c
+--- util-linux-2.12.orig/mount/lomount.c 2004-02-17 02:08:05.341716624 +0100
++++ util-linux-2.12/mount/lomount.c 2004-02-17 02:12:10.653423576 +0100
+@@ -60,7 +60,8 @@
+ info->lo_flags = info64->lo_flags;
+ info->lo_init[0] = info64->lo_init[0];
+ info->lo_init[1] = info64->lo_init[1];
+- if (info->lo_encrypt_type == LO_CRYPT_CRYPTOAPI)
++ if ((info->lo_encrypt_type == LO_CRYPT_CRYPTOAPI) ||
++ (info->lo_encrypt_type == LO_CRYPT_COMPRESS))
+ memcpy(info->lo_name, info64->lo_crypt_name, LO_NAME_SIZE);
+ else
+ memcpy(info->lo_name, info64->lo_file_name, LO_NAME_SIZE);
+@@ -321,7 +322,8 @@
+
+ int
+ set_loop(const char *device, const char *file, int offset,
+- const char *encryption, int pfd, int *loopro) {
++ const char *encnumber,const char *encryption,
++ int pfd, int *loopro) {
+ struct loop_info64 loopinfo64;
+ int fd, ffd, mode;
+ char *pass;
+@@ -344,8 +346,9 @@
+ memset(&loopinfo64, 0, sizeof(loopinfo64));
+
+ xstrncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE);
+-
++
+ if (encryption && *encryption) {
++
+ if (digits_only(encryption)) {
+ loopinfo64.lo_encrypt_type = atoi(encryption);
+ } else {
+@@ -386,6 +389,12 @@
+ }
+ }
+
++ if (encnumber && *encnumber) {
++
++ if (digits_only(encnumber))
++ loopinfo64.lo_encrypt_type = atoi(encnumber);
++ }
++
+ loopinfo64.lo_offset = offset;
+
+ #ifdef MCL_FUTURE
+@@ -601,7 +610,7 @@
+
+ int
+ main(int argc, char **argv) {
+- char *offset, *encryption, *passfd;
++ char *offset, *encryption, *encnumber, *passfd;
+ int delete, off, c;
+ int res = 0;
+ int ro = 0;
+@@ -612,7 +621,7 @@
+ textdomain(PACKAGE);
+
+ delete = off = 0;
+- offset = encryption = passfd = NULL;
++ offset = encryption = encnumber = passfd = NULL;
+ progname = argv[0];
+ while ((c = getopt(argc,argv,"de:E:o:p:v")) != -1) {
+ switch (c) {
+@@ -620,6 +629,7 @@
+ delete = 1;
+ break;
+ case 'E':
++ encnumber = optarg;
+ case 'e':
+ encryption = optarg;
+ break;
+@@ -651,7 +661,7 @@
+ if (passfd && sscanf(passfd,"%d",&pfd) != 1)
+ usage();
+ res = set_loop(argv[optind], argv[optind+1], off,
+- encryption, pfd, &ro);
++ encnumber, encryption, pfd, &ro);
+ }
+ return res;
+ }
+diff -ruN util-linux-2.12.orig/mount/lomount.h util-linux-2.12/mount/lomount.h
+--- util-linux-2.12.orig/mount/lomount.h 2004-02-17 02:08:05.339716928 +0100
++++ util-linux-2.12/mount/lomount.h 2004-02-17 02:08:14.921260312 +0100
+@@ -1,6 +1,6 @@
+ extern int verbose;
+ extern int set_loop(const char *, const char *, int, const char *,
+- int, int *);
++ const char *, int, int *);
+ extern int del_loop(const char *);
+ extern int is_loop_device(const char *);
+ extern char * find_unused_loop_device(void);
+diff -ruN util-linux-2.12.orig/mount/loop.h util-linux-2.12/mount/loop.h
+--- util-linux-2.12.orig/mount/loop.h 2004-02-17 02:08:05.341716624 +0100
++++ util-linux-2.12/mount/loop.h 2004-02-17 02:08:14.922260160 +0100
+@@ -2,6 +2,7 @@
+ #define LO_CRYPT_XOR 1
+ #define LO_CRYPT_DES 2
+ #define LO_CRYPT_CRYPTOAPI 18
++#define LO_CRYPT_COMPRESS 19
+
+ #define LOOP_SET_FD 0x4C00
+ #define LOOP_CLR_FD 0x4C01
+diff -ruN util-linux-2.12.orig/mount/mount.c util-linux-2.12/mount/mount.c
+--- util-linux-2.12.orig/mount/mount.c 2004-02-17 02:08:05.281725744 +0100
++++ util-linux-2.12/mount/mount.c 2004-02-17 02:08:14.924259856 +0100
+@@ -612,7 +612,7 @@
+ offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0;
+ if (opt_keygen)
+ pfd = use_keygen_prog(opt_keygen, keygen_args, _n_keygen_args);
+- if (set_loop(*loopdev, *loopfile, offset,
++ if (set_loop(*loopdev, *loopfile, offset, NULL,
+ opt_encryption, pfd, &loopro)) {
+ if (verbose)
+ printf(_("mount: failed setting up loop device\n"));
diff --git a/sys-apps/util-linux/files/util-linux-2.12-kernel-2.6.patch b/sys-apps/util-linux/files/util-linux-2.12-kernel-2.6.patch
new file mode 100644
index 0000000..3f03c55
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-kernel-2.6.patch
@@ -0,0 +1,87 @@
+diff -ruN util-linux-2.12.orig/disk-utils/blockdev.c util-linux-2.12/disk-utils/blockdev.c
+--- util-linux-2.12.orig/disk-utils/blockdev.c 2002-03-08 23:57:02.000000000 +0100
++++ util-linux-2.12/disk-utils/blockdev.c 2003-10-16 18:26:53.048373136 +0200
+@@ -9,6 +9,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <sys/ioctl.h>
++#include <linux/version.h>
+
+ #include "nls.h"
+
+@@ -24,8 +25,13 @@
+ #define BLKRASET _IO(0x12,98)
+ #define BLKRAGET _IO(0x12,99)
+ #define BLKSSZGET _IO(0x12,104)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+ #define BLKBSZGET _IOR(0x12,112,sizeof(int))
+ #define BLKBSZSET _IOW(0x12,113,sizeof(int))
++#else
++#define BLKBSZGET _IOR(0x12,112,int)
++#define BLKBSZSET _IOW(0x12,113,int)
++#endif
+ #endif
+
+ /* Maybe <linux/hdreg.h> could be included */
+diff -ruN util-linux-2.12.orig/disk-utils/elvtune.c util-linux-2.12/disk-utils/elvtune.c
+--- util-linux-2.12.orig/disk-utils/elvtune.c 2002-03-08 23:57:49.000000000 +0100
++++ util-linux-2.12/disk-utils/elvtune.c 2003-10-16 18:26:53.048373136 +0200
+@@ -26,6 +26,8 @@
+ #include <sys/ioctl.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <linux/version.h>
++
+ #include "nls.h"
+
+ /* this has to match with the kernel structure */
+@@ -37,8 +39,13 @@
+ int max_bomb_segments;
+ } blkelv_ioctl_arg_t;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+ #define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t))
+ #define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t))
++#else
++#define BLKELVGET _IOR(0x12,106,blkelv_ioctl_arg_t)
++#define BLKELVSET _IOW(0x12,107,blkelv_ioctl_arg_t)
++#endif
+
+ static void
+ usage(void) {
+diff -ruN util-linux-2.12.orig/fdisk/common.h util-linux-2.12/fdisk/common.h
+--- util-linux-2.12.orig/fdisk/common.h 2003-07-13 15:59:53.000000000 +0200
++++ util-linux-2.12/fdisk/common.h 2003-10-16 18:29:11.365345760 +0200
+@@ -2,11 +2,18 @@
+
+ /* including <linux/fs.h> fails */
+ #include <sys/ioctl.h>
++#include <linux/version.h>
++
+ #define BLKRRPART _IO(0x12,95) /* re-read partition table */
+ #define BLKGETSIZE _IO(0x12,96) /* return device size */
+ #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
+ #define BLKSSZGET _IO(0x12,104) /* get block device sector size */
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+ #define BLKGETSIZE64 _IOR(0x12,114,8) /* 8 = sizeof(u64) */
++#else
++#define BLKGETSIZE64 _IOR(0x12,114,unsigned long long)
++#endif
+
+ /* including <linux/hdreg.h> also fails */
+ struct hd_geometry {
+diff -ruN util-linux-2.12.orig/mount/my_dev_t.h util-linux-2.12/mount/my_dev_t.h
+--- util-linux-2.12.orig/mount/my_dev_t.h 2003-07-16 22:05:50.000000000 +0200
++++ util-linux-2.12/mount/my_dev_t.h 2003-10-16 18:26:53.049372984 +0200
+@@ -4,4 +4,10 @@
+ /* for ancient systems use "unsigned short" */
+
+ #include <linux/posix_types.h>
++#include <linux/version.h>
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+ #define my_dev_t __kernel_dev_t
++#else
++#define my_dev_t int
++#endif
diff --git a/sys-apps/util-linux/files/util-linux-2.12-mips-lseek.patch b/sys-apps/util-linux/files/util-linux-2.12-mips-lseek.patch
new file mode 100644
index 0000000..3fcd5b5
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-mips-lseek.patch
@@ -0,0 +1,24 @@
+Because there is no llseek defined for mips n32, we will use lseek instead.
+
+--- util-linux-2.12r/fdisk/sfdisk.c.orig
++++ util-linux-2.12r/fdisk/sfdisk.c
+@@ -172,7 +172,7 @@
+ * Note: we use 512-byte sectors here, irrespective of the hardware ss.
+ */
+ #undef use_lseek
+-#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
++#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__) || defined (__mips__)
+ #define use_lseek
+ #endif
+
+--- util-linux-2.12r/partx/partx.c.orig
++++ util-linux-2.12r/partx/partx.c
+@@ -333,7 +333,7 @@
+ /*
+ * sseek: seek to specified sector
+ */
+-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
++#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__) && !defined(__mips__)
+ #define NEED__llseek
+ #endif
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12-only-root-can-remount.patch b/sys-apps/util-linux/files/util-linux-2.12-only-root-can-remount.patch
new file mode 100644
index 0000000..2a1d44c
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-only-root-can-remount.patch
@@ -0,0 +1,11 @@
+--- util-linux-2.13-pre2/mount/umount.c
++++ util-linux-2.13-pre3/mount/umount.c
+@@ -707,7 +707,7 @@
+
+ if (getuid () != geteuid ()) {
+ suid = 1;
+- if (all || types || nomtab || force)
++ if (all || types || nomtab || force || remount)
+ die (2, _("umount: only root can do that"));
+ }
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12-selinux.diff.bz2 b/sys-apps/util-linux/files/util-linux-2.12-selinux.diff.bz2
new file mode 100644
index 0000000..6e5382b
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-selinux.diff.bz2
Binary files differ
diff --git a/sys-apps/util-linux/files/util-linux-2.12-swapon-unistd.patch b/sys-apps/util-linux/files/util-linux-2.12-swapon-unistd.patch
new file mode 100644
index 0000000..982ab1d
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12-swapon-unistd.patch
@@ -0,0 +1,11 @@
+--- mount/swapon.c.orig 2004-05-07 15:21:06.909712000 +0000
++++ mount/swapon.c 2004-05-07 15:21:28.319712000 +0000
+@@ -21,6 +21,7 @@
+ #include <mntent.h>
+ #include <errno.h>
+ #include <sys/stat.h>
++#include <unistd.h>
+ #include "swap_constants.h"
+ #include "swapargs.h"
+ #include "nls.h"
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12i-fat-LABEL-support.patch b/sys-apps/util-linux/files/util-linux-2.12i-fat-LABEL-support.patch
new file mode 100644
index 0000000..41b7139
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12i-fat-LABEL-support.patch
@@ -0,0 +1,69 @@
+--- mount-2.12-fat.patch.orig 2004-11-11 20:16:07.165232227 -0500
++++ mount-2.12-fat.patch 2004-11-11 20:18:47.717923660 -0500
+@@ -1,11 +1,10 @@
+ diff -uNr util-linux-2.12/mount/get_label_uuid.c ../patch/util-linux-2.12/mount/get_label_uuid.c
+ --- util-linux-2.12/mount/get_label_uuid.c 2002-11-26 12:18:01.000000000 +0100
+ +++ ../patch/util-linux-2.12/mount/get_label_uuid.c 2003-10-20 18:27:56.000000000 +0200
+-@@ -43,7 +43,139 @@
+- #endif
++@@ -43,6 +43,137 @@
++ return rc;
+ }
+
+--/* for now, only ext2, ext3, xfs, ocfs are supported */
+ +/* Remove trailing spaces */
+ +static void remtrailspc(char *label) {
+ + char *c;
+@@ -137,29 +136,23 @@
+ + return -1;
+ +}
+ +
+-+
+-+/* for now, only ext2, ext3, xfs, ocfs, fat, fat32 are supported */
+- int
+- get_label_uuid(const char *device, char **label, char *uuid) {
+- int fd;
+-@@ -54,8 +186,10 @@
+- struct jfs_super_block jfssb;
+- struct ocfs_volume_header ovh; /* Oracle */
++ /*
++ * Get both label and uuid.
++ * For now, only ext2, ext3, xfs, ocfs, ocfs2, reiserfs are supported
++@@ -54,6 +186,8 @@
+ struct ocfs_volume_label olbl;
++ struct ocfs2_super_block osb;
++ struct reiserfs_super_block reiserfssb;
+ + struct fat_super_block fatsb;
+ + struct fat32_super_block fat32sb;
+
+-- fd = open(device, O_RDONLY);
+-+ fd = open(device, O_RDONLY);
++ fd = open(device, O_RDONLY);
+ if (fd < 0)
+- return rv;
+-
+-@@ -111,7 +245,87 @@
+- memcpy(*label, jfssb.s_label, namesize);
++@@ -111,6 +245,87 @@
+ }
+ rv = 0;
+-- }
+-+ } else if (lseek(fd, 0, SEEK_SET) == 0
++ }
+++ else if (lseek(fd, 0, SEEK_SET) == 0
+ + && read(fd, (char*) &fat32sb, sizeof(fat32sb)) == sizeof(fat32sb)
+ + && fat32sb.s_sig[0] == 0x55
+ + && fat32sb.s_sig[1] == 0xAA
+@@ -240,9 +233,9 @@
+ + rv = 0;
+ + }
+ + }
+-
+- close(fd);
+- return rv;
++ else if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET)
++ == REISERFS_DISK_OFFSET_IN_BYTES
++ && read(fd, (char *) &reiserfssb, sizeof(reiserfssb))
+ diff -uNr util-linux-2.12/mount/linux_fs.h ../patch/util-linux-2.12/mount/linux_fs.h
+ --- util-linux-2.12/mount/linux_fs.h 2003-07-05 22:16:32.000000000 +0200
+ +++ ../patch/util-linux-2.12/mount/linux_fs.h 2003-10-20 18:07:06.000000000 +0200
diff --git a/sys-apps/util-linux/files/util-linux-2.12i-ignore-managed.patch b/sys-apps/util-linux/files/util-linux-2.12i-ignore-managed.patch
new file mode 100644
index 0000000..b6cb567
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12i-ignore-managed.patch
@@ -0,0 +1,11 @@
+--- util-linux-2.12a/mount/mount.c.sopwith 2004-03-04 20:28:22.000000000 -0500
++++ util-linux-2.12a/mount/mount.c 2004-07-16 16:50:18.792814782 -0400
+@@ -191,6 +191,8 @@
+ { "diratime", 0, 1, MS_NODIRATIME }, /* Update dir access times */
+ { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
+ #endif
++ { "kudzu", 0, 0, 0 }, /* Silently remove this option (backwards compat use only) */
++ { "managed", 0, 0, 0 }, /* Silently remove this option */
+ { NULL, 0, 0, 0 }
+ };
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12i-nfsv4.patch b/sys-apps/util-linux/files/util-linux-2.12i-nfsv4.patch
new file mode 100644
index 0000000..864449b
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12i-nfsv4.patch
@@ -0,0 +1,456 @@
+diff -ur util-linux-2.12i.orig/mount/Makefile util-linux-2.12i/mount/Makefile
+--- util-linux-2.12i.orig/mount/Makefile 2004-11-11 20:03:33.032897551 -0500
++++ util-linux-2.12i/mount/Makefile 2004-11-11 20:04:38.279986828 -0500
+@@ -29,2 +29,4 @@
+
++NFS_OBJS += nfs4mount.o
++GEN_FILES += nfs4mount.c
+ all: $(PROGS)
+diff -ur util-linux-2.12i.orig/mount/mount.c util-linux-2.12i/mount/mount.c
+--- util-linux-2.12i.orig/mount/mount.c 2004-11-11 20:03:33.033897369 -0500
++++ util-linux-2.12i/mount/mount.c 2004-11-11 20:03:40.384555521 -0500
+@@ -810,6 +810,19 @@
+ "without support for the type `nfs'"));
+ #endif
+ }
++#ifdef HAVE_NFS
++ /*
++ * NFSv4 support
++ */
++ if (!fake && types && streq (types, "nfs4")) {
++ mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg);
++ if (mnt_err)
++ return mnt_err;
++#else
++ die (EX_SOFTWARE, _("mount: this version was compiled "
++ "without support for the type `nfs4'"));
++#endif
++ }
+
+ block_signals (SIG_BLOCK);
+
+diff -ur util-linux-2.12i.orig/mount/sundries.h util-linux-2.12i/mount/sundries.h
+--- util-linux-2.12i.orig/mount/sundries.h 2004-11-11 20:03:33.034897186 -0500
++++ util-linux-2.12i/mount/sundries.h 2004-11-11 20:03:40.386555156 -0500
+@@ -37,6 +37,8 @@
+ #ifdef HAVE_NFS
+ int nfsmount (const char *spec, const char *node, int *flags,
+ char **orig_opts, char **opt_args, int *version, int running_bg);
++int nfs4mount (const char *spec, const char *node, int *flags,
++ char **orig_opts, char **opt_args, int running_bg);
+ #endif
+
+ /* exit status - bits below are ORed */
+diff -puN /dev/null mount/nfs4_mount.h
+--- /dev/null 2003-01-08 17:56:04.000000000 -0500
++++ util-linux-2.11z-bfields/mount/nfs4_mount.h 2003-04-23 16:40:57.000000000 -0400
+@@ -0,0 +1,82 @@
++#ifndef _LINUX_NFS4_MOUNT_H
++#define _LINUX_NFS4_MOUNT_H
++
++/*
++ * linux/include/linux/nfs4_mount.h
++ *
++ * Copyright (C) 2002 Trond Myklebust
++ *
++ * structure passed from user-space to kernel-space during an nfsv4 mount
++ */
++
++/*
++ * WARNING! Do not delete or change the order of these fields. If
++ * a new field is required then add it to the end. The version field
++ * tracks which fields are present. This will ensure some measure of
++ * mount-to-kernel version compatibility. Some of these aren't used yet
++ * but here they are anyway.
++ */
++#define NFS4_MOUNT_VERSION 1
++
++struct nfs_string {
++ unsigned int len;
++ const char* data;
++};
++
++struct nfs4_mount_data {
++ int version; /* 1 */
++ int flags; /* 1 */
++ int rsize; /* 1 */
++ int wsize; /* 1 */
++ int timeo; /* 1 */
++ int retrans; /* 1 */
++ int acregmin; /* 1 */
++ int acregmax; /* 1 */
++ int acdirmin; /* 1 */
++ int acdirmax; /* 1 */
++
++ /* see the definition of 'struct clientaddr4' in RFC3010 */
++ struct nfs_string client_addr; /* 1 */
++
++ /* Mount path */
++ struct nfs_string mnt_path; /* 1 */
++
++ /* Server details */
++ struct nfs_string hostname; /* 1 */
++ /* Server IP address */
++ unsigned int host_addrlen; /* 1 */
++ struct sockaddr* host_addr; /* 1 */
++
++ /* Transport protocol to use */
++ int proto; /* 1 */
++
++ /* Pseudo-flavours to use for authentication. See RFC2623 */
++ int auth_flavourlen; /* 1 */
++ int *auth_flavours; /* 1 */
++};
++
++/* bits in the flags field */
++/* Note: the fields that correspond to existing NFSv2/v3 mount options
++ * should mirror the values from include/linux/nfs_mount.h
++ */
++
++#define NFS4_MOUNT_SOFT 0x0001 /* 1 */
++#define NFS4_MOUNT_INTR 0x0002 /* 1 */
++#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */
++#define NFS4_MOUNT_NOAC 0x0020 /* 1 */
++#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */
++#define NFS4_MOUNT_FLAGMASK 0xFFFF
++
++/* pseudoflavors: */
++
++#define RPC_AUTH_GSS_KRB5 390003
++#define RPC_AUTH_GSS_KRB5I 390004
++#define RPC_AUTH_GSS_KRB5P 390005
++#define RPC_AUTH_GSS_LKEY 390006
++#define RPC_AUTH_GSS_LKEYI 390007
++#define RPC_AUTH_GSS_LKEYP 390008
++#define RPC_AUTH_GSS_SPKM 390009
++#define RPC_AUTH_GSS_SPKMI 390010
++#define RPC_AUTH_GSS_SPKMP 390011
++
++#endif
+diff -puN /dev/null mount/nfs4mount.c
+--- /dev/null 2003-01-08 17:56:04.000000000 -0500
++++ util-linux-2.11z-bfields/mount/nfs4mount.c 2003-04-23 17:28:54.000000000 -0400
+@@ -0,0 +1,323 @@
++/*
++ * nfs4mount.c -- Linux NFS mount
++ * Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * Note: this file based on the original nfsmount.c
++ */
++
++#include "../defines.h" /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */
++
++#include <linux/posix_types.h>
++#include <asm/posix_types.h>
++#undef __FD_CLR
++#undef __FD_SET
++#undef __FD_ISSET
++#undef __FD_ZERO
++
++#include <unistd.h>
++#include <stdio.h>
++#include <string.h>
++#include <errno.h>
++#include <netdb.h>
++#include <time.h>
++#include <sys/socket.h>
++#include <sys/time.h>
++#include <sys/utsname.h>
++#include <sys/stat.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++
++#include "sundries.h"
++
++#include "mount_constants.h"
++#include "nfs4_mount.h"
++
++#include "nls.h"
++
++#ifndef NFS_PORT
++#define NFS_PORT 2049
++#endif
++
++static int parse_devname(char *hostdir, char **hostname, char **dirname)
++{
++ char *s;
++
++ if (!(s = strchr(hostdir, ':'))) {
++ fprintf(stderr,
++ _("mount: "
++ "directory to mount not in host:dir format\n"));
++ return -1;
++ }
++ *hostname = hostdir;
++ *dirname = s + 1;
++ *s = '\0';
++ /* Ignore all but first hostname in replicated mounts
++ until they can be fully supported. (mack@sgi.com) */
++ if ((s = strchr(hostdir, ','))) {
++ *s = '\0';
++ fprintf(stderr,
++ _("mount: warning: "
++ "multiple hostnames not supported\n"));
++ }
++ return 0;
++}
++
++static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr)
++{
++ struct hostent *hp;
++ addr->sin_family = AF_INET;
++
++ if (inet_aton(hostname, &addr->sin_addr))
++ return 0;
++ if ((hp = gethostbyname(hostname)) == NULL) {
++ fprintf(stderr, _("mount: can't get address for %s\n"),
++ hostname);
++ return -1;
++ }
++ if (hp->h_length > sizeof(struct in_addr)) {
++ fprintf(stderr,
++ _("mount: got bad hp->h_length\n"));
++ hp->h_length = sizeof(struct in_addr);
++ }
++ memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
++ return 0;
++}
++
++static int get_my_ipv4addr(char *ip_addr, int len)
++{
++ char myname[1024];
++ struct sockaddr_in myaddr;
++
++ if (gethostname(myname, sizeof(myname))) {
++ fprintf(stderr, _("mount: can't determine client address\n"));
++ return -1;
++ }
++ if (fill_ipv4_sockaddr(myname, &myaddr))
++ return -1;
++ snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr));
++ ip_addr[len-1] = '\0';
++ return 0;
++}
++
++int nfs4mount(const char *spec, const char *node, int *flags,
++ char **extra_opts, char **mount_opts,
++ int running_bg)
++{
++ static struct nfs4_mount_data data;
++ static char hostdir[1024];
++ static char ip_addr[16] = "127.0.0.1";
++ static struct sockaddr_in server_addr;
++ static int pseudoflavour = 0;
++
++ char *hostname, *dirname, *old_opts;
++ char new_opts[1024];
++ char *opt, *opteq;
++ char *s;
++ int val;
++ int port, bg, soft, intr;
++ int nocto, noac;
++ int retry;
++ int retval;
++
++ retval = EX_FAIL;
++ if (strlen(spec) >= sizeof(hostdir)) {
++ fprintf(stderr, _("mount: "
++ "excessively long host:dir argument\n"));
++ goto fail;
++ }
++ strcpy(hostdir, spec);
++ if (parse_devname(hostdir, &hostname, &dirname))
++ goto fail;
++
++ if (fill_ipv4_sockaddr(hostname, &server_addr))
++ goto fail;
++ if (get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
++ goto fail;
++
++ /* add IP address to mtab options for use when unmounting */
++ s = inet_ntoa(server_addr.sin_addr);
++ old_opts = *extra_opts;
++ if (!old_opts)
++ old_opts = "";
++ if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
++ fprintf(stderr, _("mount: "
++ "excessively long option argument\n"));
++ goto fail;
++ }
++ snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
++ old_opts, *old_opts ? "," : "", s);
++ *extra_opts = xstrdup(new_opts);
++
++ /* Set default options.
++ * rsize/wsize and timeo are left 0 in order to
++ * let the kernel decide.
++ */
++ memset(&data, 0, sizeof(data));
++ data.retrans = 3;
++ data.acregmin = 3;
++ data.acregmax = 60;
++ data.acdirmin = 30;
++ data.acdirmax = 60;
++ data.proto = IPPROTO_TCP;
++
++ bg = 0;
++ soft = 0;
++ intr = 0;
++ nocto = 0;
++ noac = 0;
++ retry = 10000; /* 10000 minutes ~ 1 week */
++
++ /*
++ * NFSv4 specifies that the default port should be 2049
++ */
++ port = NFS_PORT;
++
++ /* parse options */
++
++ for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
++ if ((opteq = strchr(opt, '='))) {
++ val = atoi(opteq + 1);
++ *opteq = '\0';
++ if (!strcmp(opt, "rsize"))
++ data.rsize = val;
++ else if (!strcmp(opt, "wsize"))
++ data.wsize = val;
++ else if (!strcmp(opt, "timeo"))
++ data.timeo = val;
++ else if (!strcmp(opt, "retrans"))
++ data.retrans = val;
++ else if (!strcmp(opt, "acregmin"))
++ data.acregmin = val;
++ else if (!strcmp(opt, "acregmax"))
++ data.acregmax = val;
++ else if (!strcmp(opt, "acdirmin"))
++ data.acdirmin = val;
++ else if (!strcmp(opt, "acdirmax"))
++ data.acdirmax = val;
++ else if (!strcmp(opt, "actimeo")) {
++ data.acregmin = val;
++ data.acregmax = val;
++ data.acdirmin = val;
++ data.acdirmax = val;
++ }
++ else if (!strcmp(opt, "retry"))
++ retry = val;
++ else if (!strcmp(opt, "port"))
++ port = val;
++ else if (!strcmp(opt, "proto")) {
++ if (!strncmp(opteq+1, "tcp", 3))
++ data.proto = IPPROTO_TCP;
++ else if (!strncmp(opteq+1, "udp", 3))
++ data.proto = IPPROTO_UDP;
++ else
++ printf(_("Warning: Unrecognized proto= option.\n"));
++ } else if (!strcmp(opt, "clientaddr")) {
++ if (strlen(opteq+1) >= sizeof(ip_addr))
++ printf(_("Invalid client address %s"),
++ opteq+1);
++ strncpy(ip_addr,opteq+1, sizeof(ip_addr));
++ ip_addr[sizeof(ip_addr)-1] = '\0';
++ } else if (!strcmp(opt, "sec")) {
++ if (!strncmp(opteq+1, "krb5i",5))
++ pseudoflavour = 390004;
++ else if (!strncmp(opteq+1, "krb5p",5))
++ pseudoflavour = 390005;
++ else if (!strncmp(opteq+1, "krb5",4))
++ pseudoflavour = 390003;
++ else {
++ printf(_("unknown security type %s\n"),
++ opteq+1);
++ goto fail;
++ }
++ } else if (!strcmp(opt, "addr")) {
++ /* ignore */;
++ } else {
++ printf(_("unknown nfs mount parameter: "
++ "%s=%d\n"), opt, val);
++ goto fail;
++ }
++ } else {
++ val = 1;
++ if (!strncmp(opt, "no", 2)) {
++ val = 0;
++ opt += 2;
++ }
++ if (!strcmp(opt, "bg"))
++ bg = val;
++ else if (!strcmp(opt, "fg"))
++ bg = !val;
++ else if (!strcmp(opt, "soft"))
++ soft = val;
++ else if (!strcmp(opt, "hard"))
++ soft = !val;
++ else if (!strcmp(opt, "intr"))
++ intr = val;
++ else if (!strcmp(opt, "cto"))
++ nocto = !val;
++ else if (!strcmp(opt, "ac"))
++ noac = !val;
++ else {
++ if (!sloppy) {
++ printf(_("unknown nfs mount option: "
++ "%s%s\n"), val ? "" : "no", opt);
++ goto fail;
++ }
++ }
++ }
++ }
++
++ data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
++ | (intr ? NFS4_MOUNT_INTR : 0)
++ | (nocto ? NFS4_MOUNT_NOCTO : 0)
++ | (noac ? NFS4_MOUNT_NOAC : 0);
++
++ if (pseudoflavour != 0) {
++ data.auth_flavourlen = 1;
++ data.auth_flavours = &pseudoflavour;
++ }
++
++ data.client_addr.data = ip_addr;
++ data.client_addr.len = strlen(ip_addr);
++
++ data.mnt_path.data = dirname;
++ data.mnt_path.len = strlen(dirname);
++
++ data.hostname.data = hostname;
++ data.hostname.len = strlen(hostname);
++ data.host_addr = (struct sockaddr *)&server_addr;
++ data.host_addrlen = sizeof(server_addr);
++
++#ifdef NFS_MOUNT_DEBUG
++ printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
++ data.rsize, data.wsize, data.timeo, data.retrans);
++ printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
++ data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
++ printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
++ port, bg, retry, data.flags);
++ printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
++ (data.flags & NFS4_MOUNT_SOFT) != 0,
++ (data.flags & NFS4_MOUNT_INTR) != 0,
++ (data.flags & NFS4_MOUNT_NOCTO) != 0,
++ (data.flags & NFS4_MOUNT_NOAC) != 0);
++ printf("proto = %s\n", (data.proto == IPPROTO_TCP) ? "tcp" : "udp");
++#endif
++
++ data.version = NFS4_MOUNT_VERSION;
++
++ *mount_opts = (char *) &data;
++ /* clean up */
++ return 0;
++
++fail:
++ return retval;
++}
diff --git a/sys-apps/util-linux/files/util-linux-2.12i-pic.patch b/sys-apps/util-linux/files/util-linux-2.12i-pic.patch
new file mode 100644
index 0000000..8fb91be
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12i-pic.patch
@@ -0,0 +1,59 @@
+diff -ur util-linux-2.12i.orig/fdisk/llseek.c util-linux-2.12i/fdisk/llseek.c
+--- util-linux-2.12i.orig/fdisk/llseek.c 2004-11-11 20:08:34.074942938 -0500
++++ util-linux-2.12i/fdisk/llseek.c 2004-11-11 20:09:43.040353443 -0500
+@@ -3,6 +3,9 @@
+ *
+ * Copyright (C) 1994 Remy Card. This file may be redistributed
+ * under the terms of the GNU Public License.
++ *
++ * Changes:
++ * 20030712 - Alexander Gabert <pappy@nikita.ath.cx> - adding PIC defines
+ */
+
+ #include <sys/types.h>
+@@ -19,7 +22,9 @@
+
+ #else /* HAVE_LLSEEK */
+
+-#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
++/* do not use assembler to put together syscalls at compile time (for llseek for example) when using PIC */
++#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__) \
++ || defined(__PIC__) || defined(__pic__)
+
+ #define my_llseek lseek
+
+diff -ur util-linux-2.12i.orig/fdisk/sfdisk.c util-linux-2.12i/fdisk/sfdisk.c
+--- util-linux-2.12i.orig/fdisk/sfdisk.c 2004-11-11 20:08:34.074942938 -0500
++++ util-linux-2.12i/fdisk/sfdisk.c 2004-11-11 20:11:07.242982424 -0500
+@@ -30,6 +30,7 @@
+ * 19990319 - Arnaldo Carvalho de Melo <acme@conectiva.com.br> - i18n
+ * 20040428 - Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com> - added PACKED
+ * 20040824 - David A. Wheeler <dwheeler@dwheeler.com> - warnings to stderr
++ * 20030712 - Alexander Gabert <pappy@nikita.ath.cx> - adding PIC defines
+ */
+
+ #define PROGNAME "sfdisk"
+@@ -172,7 +173,9 @@
+ * Note: we use 512-byte sectors here, irrespective of the hardware ss.
+ */
+ #undef use_lseek
+-#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
++/* do not use the assembler constructed syscalls for seeking if compiled as PIC */
++#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__) \
++ || defined(__PIC__) && defined(__pic__)
+ #define use_lseek
+ #endif
+
+diff -ur util-linux-2.12i.orig/partx/partx.c util-linux-2.12i/partx/partx.c
+--- util-linux-2.12i.orig/partx/partx.c 2004-11-11 20:08:34.155928155 -0500
++++ util-linux-2.12i/partx/partx.c 2004-11-11 20:12:34.740010020 -0500
+@@ -333,7 +333,8 @@
+ /*
+ * sseek: seek to specified sector
+ */
+-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
++#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__) \
++ && !defined(__PIC__) && !defined(__pic__)
+ #define NEED__llseek
+ #endif
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12i-swapon-check-symlinks.patch b/sys-apps/util-linux/files/util-linux-2.12i-swapon-check-symlinks.patch
new file mode 100644
index 0000000..b9ed346
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12i-swapon-check-symlinks.patch
@@ -0,0 +1,33 @@
+--- util-linux-2.12b/mount/swapon.c.orig 2004-10-28 10:02:44.320023600 -0400
++++ util-linux-2.12b/mount/swapon.c 2004-10-28 10:02:14.384574000 -0400
+@@ -22,2 +22,3 @@
+ #include <stdlib.h>
++#include <sys/param.h>
+ #include <stdio.h>
+@@ -143,10 +144,26 @@
+ static int
+ is_in_proc_swaps(char *fname) {
+ int i;
++ struct stat fstatbuf;
+
+ for (i = 0; i < numSwaps; i++)
+ if (!strcmp(fname, swapFiles[i]))
+ return 1;
++
++ /* fallback:
++ * if the device in /etc/fstab is a symlink, the entry
++ * in /proc/swaps won't match because the kernel stores
++ * absolute pathnames. Here we compare dev_t's.
++ */
++ if (!lstat(fname, &fstatbuf))
++ if (S_ISLNK(fstatbuf.st_mode)) {
++ struct stat swapstatbuf;
++ for (i = 0; i < numSwaps; i++)
++ if (!stat(swapFiles[i], &swapstatbuf) && \
++ swapstatbuf.st_dev == fstatbuf.st_dev)
++ return 1;
++ }
++
+ return 0;
+ }
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch b/sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch
new file mode 100644
index 0000000..f421458
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12p-swapon-check-symlinks.patch
@@ -0,0 +1,34 @@
+--- util-linux-2.12b/mount/swapon.c
++++ util-linux-2.12b/mount/swapon.c
+@@ -7,2 +7,3 @@
+ #include <stdlib.h>
++#include <sys/param.h>
+ #include <stdio.h>
+@@ -137,10 +138,27 @@
+ static int
+ is_in_proc_swaps(const char *fname) {
+ int i;
++ struct stat fstatbuf;
+
+ for (i = 0; i < numSwaps; i++)
+ if (swapFiles[i] && !strcmp(fname, swapFiles[i]))
+ return 1;
++
++ /* fallback:
++ * if the device in /etc/fstab is a symlink, the entry
++ * in /proc/swaps won't match because the kernel stores
++ * absolute pathnames. Here we compare dev_t's.
++ */
++ if (!lstat(fname, &fstatbuf))
++ if (S_ISLNK(fstatbuf.st_mode)) {
++ struct stat swapstatbuf;
++ stat(fname, &fstatbuf);
++ for (i = 0; i < numSwaps; i++)
++ if (swapFiles[i] && !stat(swapFiles[i], &swapstatbuf) && \
++ swapstatbuf.st_rdev == fstatbuf.st_rdev)
++ return 1;
++ }
++
+ return 0;
+ }
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-debian-10cfdisk.patch b/sys-apps/util-linux/files/util-linux-2.12q-debian-10cfdisk.patch
new file mode 100644
index 0000000..6105fb1
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-debian-10cfdisk.patch
@@ -0,0 +1,49 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10cfdisk.dpatch by LaMont Jones <lamont@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Buffer overruns with narrow terminal windows.
+
+@DPATCH@
+diff -urNad util-linux/fdisk/cfdisk.c /tmp/dpep.rEB26p/util-linux/fdisk/cfdisk.c
+--- util-linux/fdisk/cfdisk.c 2004-12-24 14:41:20.000000000 -0700
++++ /tmp/dpep.rEB26p/util-linux/fdisk/cfdisk.c 2004-12-24 15:00:00.503453740 -0700
+@@ -2100,7 +2100,7 @@
+ if (to_file) {
+ if ((fp = fopen(fname, "w")) == NULL) {
+ char errstr[LINE_LENGTH];
+- sprintf(errstr, _("Cannot open file '%s'"), fname);
++ snprintf(errstr, sizeof(errstr), _("Cannot open file '%s'"), fname);
+ print_warning(errstr);
+ return;
+ }
+@@ -2184,7 +2184,7 @@
+ if (to_file) {
+ if ((fp = fopen(fname, "w")) == NULL) {
+ char errstr[LINE_LENGTH];
+- sprintf(errstr, _("Cannot open file '%s'"), fname);
++ snprintf(errstr, sizeof(errstr), _("Cannot open file '%s'"), fname);
+ print_warning(errstr);
+ return;
+ }
+@@ -2638,9 +2638,9 @@
+ mvaddstr(WARNING_START, 0, line);
+
+
+- sprintf(line, "cfdisk %s", VERSION);
++ snprintf(line, COLS+1, "cfdisk %s", VERSION);
+ mvaddstr(HEADER_START, (COLS-strlen(line))/2, line);
+- sprintf(line, _("Disk Drive: %s"), disk_device);
++ snprintf(line, COLS+1, _("Disk Drive: %s"), disk_device);
+ mvaddstr(HEADER_START+2, (COLS-strlen(line))/2, line);
+ {
+ long long bytes = actual_size*(long long) SECTOR_SIZE;
+@@ -2654,7 +2654,7 @@
+ bytes, megabytes/K, (10*megabytes/K)%10);
+ }
+ mvaddstr(HEADER_START+3, (COLS-strlen(line))/2, line);
+- sprintf(line, _("Heads: %d Sectors per Track: %d Cylinders: %lld"),
++ snprintf(line, COLS+1, _("Heads: %d Sectors per Track: %d Cylinders: %lld"),
+ heads, sectors, cylinders);
+ mvaddstr(HEADER_START+4, (COLS-strlen(line))/2, line);
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-dont-umask.patch b/sys-apps/util-linux/files/util-linux-2.12q-dont-umask.patch
new file mode 100644
index 0000000..704c258
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-dont-umask.patch
@@ -0,0 +1,17 @@
+Don't force umask to 022 or the -o umask option doesn't work.
+
+Patch by Daniel Drake.
+
+http://bugs.gentoo.org/93671
+
+--- mount/mount.c
++++ mount/mount.c
+@@ -1491,8 +1491,6 @@ main(int argc, char *argv[]) {
+ if ((p = strrchr(progname, '/')) != NULL)
+ progname = p+1;
+
+- umask(022);
+-
+ /* People report that a mount called from init without console
+ writes error messages to /etc/mtab
+ Let us try to avoid getting fd's 0,1,2 */
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-i18n-update.patch b/sys-apps/util-linux/files/util-linux-2.12q-i18n-update.patch
new file mode 100644
index 0000000..a47810c
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-i18n-update.patch
@@ -0,0 +1,10 @@
+DELACOUR Guillaume reports:
+i18n: Typo in french translation of mount error
+http://bugs.gentoo.org/show_bug.cgi?id=75693
+--- po/fr.po
++++ po/fr.po
+@@ -8358,3 +8358,3 @@
+ msgid "%s looks like swapspace - not mounted"
+-msgstr "%s ressemble ŕ un esapce de swap - n'a pas été monté"
++msgstr "%s ressemble ŕ un espace de swap - n'a pas été monté"
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-more-fake-checks-v2.patch b/sys-apps/util-linux/files/util-linux-2.12q-more-fake-checks-v2.patch
new file mode 100644
index 0000000..f598a8d
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-more-fake-checks-v2.patch
@@ -0,0 +1,40 @@
+> Running `mount -fv /mnt/pnt` incorrectly updates /etc/mtab
+
+This one is bogus.
+
+Manpage:
+
+=====
+-f Causes everything to be done except for the actual system call;
+ if it's not obvious, this ``fakes'' mounting the file system. This option
+ is useful in conjunction with the -v flag to determine what the mount
+ command is trying to do. It can also be used to add entries for devices that
+ were mounted earlier with the -n option.
+=====
+
+Also, we need it in /etc/init.d/checkroot to regen /etc/mtab ...
+
+
+=======================================================================
+Running `mount -afvt type` incorrectly warns that 'nothing was mounted'
+
+--- mount/mount.c
++++ mount/mount.c
+#@@ -659,7 +659,7 @@
+# if (verbose)
+# print_one (&mnt);
+#
+#- if (!nomtab && mtab_is_writable()) {
+#+ if (!fake && !nomtab && mtab_is_writable()) {
+# if (flags & MS_REMOUNT)
+# update_mtab (mnt.mnt_dir, &mnt);
+# else {
+@@ -1629,7 +1629,7 @@
+ case 0:
+ /* mount -a */
+ result = do_mount_all (types, options, test_opts);
+- if (result == 0 && verbose)
++ if (result == 0 && verbose && !fake)
+ error(_("nothing was mounted"));
+ break;
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-no-m68k-fdisk.patch b/sys-apps/util-linux/files/util-linux-2.12q-no-m68k-fdisk.patch
new file mode 100644
index 0000000..6d3334f
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-no-m68k-fdisk.patch
@@ -0,0 +1,15 @@
+Disable building fdisk on m68k
+
+--- fdisk/Makefile
++++ fdisk/Makefile
+@@ -18,8 +18,10 @@
+ endif
+ endif
+
++ifneq "$(ARCH)" "m68k"
+ SBIN:=$(SBIN) fdisk
+ MAN8:=$(MAN8) fdisk.8
++endif
+
+ ifneq "$(ARCH)" "sparc"
+ SBIN:=$(SBIN) $(CFDISK) sfdisk
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-umount-dont-write-mtab-with-remount.patch b/sys-apps/util-linux/files/util-linux-2.12q-umount-dont-write-mtab-with-remount.patch
new file mode 100644
index 0000000..2b8f4ad
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-umount-dont-write-mtab-with-remount.patch
@@ -0,0 +1,18 @@
+Make umount respect the -n option when using -r
+
+Patch by Derick Swanepoel
+
+http://bugs.gentoo.org/98675
+
+--- mount/umount.c
++++ mount/umount.c
+@@ -349,7 +349,8 @@
+ remnt.mnt_type = remnt.mnt_fsname = NULL;
+ remnt.mnt_dir = xstrdup(node);
+ remnt.mnt_opts = xstrdup("ro");
+- update_mtab(node, &remnt);
++ if (!nomtab && mtab_is_writable())
++ update_mtab(node, &remnt);
+ return 0;
+ } else if (errno != EBUSY) { /* hmm ... */
+ perror("remount");
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-update-mtab-when-moving.patch b/sys-apps/util-linux/files/util-linux-2.12q-update-mtab-when-moving.patch
new file mode 100644
index 0000000..aa921f5
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-update-mtab-when-moving.patch
@@ -0,0 +1,33 @@
+Running `mount --move /foo /bar` would leave the old /foo entry in /etc/mtab
+and create a new /bar entry with wrong info.
+
+http://bugs.gentoo.org/104697
+
+--- 1/mount/mount.c
++++ 2/mount/mount.c
+@@ -665,6 +665,25 @@
+ else {
+ mntFILE *mfp;
+
++ /* when moving a mount point, we have to make sure the mtab
++ * gets updated properly. We get info about the old mount
++ * point, copy it to the new mount point, and then delete
++ * the old mount point. */
++ if (flags & MS_MOVE) {
++ const char *olddir = mnt.mnt_fsname;
++ struct mntentchn *oldmc = oldmc = getmntfile(olddir);
++ if (oldmc != NULL) {
++ mnt.mnt_fsname = xstrdup(oldmc->m.mnt_fsname);
++ mnt.mnt_type = oldmc->m.mnt_type;
++ mnt.mnt_opts = oldmc->m.mnt_opts;
++ mnt.mnt_freq = oldmc->m.mnt_freq;
++ mnt.mnt_passno = oldmc->m.mnt_passno;
++ }
++ update_mtab(olddir, NULL);
++ if (oldmc != NULL)
++ my_free(olddir);
++ }
++
+ lock_mtab();
+ mfp = my_setmntent(MOUNTED, "a+");
+ if (mfp == NULL || mfp->mntent_fp == NULL) {
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-update_mtab-fixes.patch b/sys-apps/util-linux/files/util-linux-2.12q-update_mtab-fixes.patch
new file mode 100644
index 0000000..7e1c9db
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-update_mtab-fixes.patch
@@ -0,0 +1,68 @@
+This fixes a few issues with update_mtab():
+- If it is a remount, and only mnt_opts needs updating, mc->m.mnt_opts is set
+ to point to instead->mnt_opts, rather than allocating a new string, which
+ would cause a double free if the caller actually freed the passed mnt_opts,
+ as we free mc->m.mnt_opts before returning to the caller.
+- Mostly the same issue as above. If mtab does not contain the new entry, then
+ absent->m is set to point to instead, which would have cause a double free
+ if absent was inserted properly into the linked list, since we free all
+ elements of absent before returning to the caller.
+- If mtab does not contain the new entry, then only mc0->prev is updated to
+ point to absent, but not the old mc0->prev's nxt pointer. Because we then
+ use the nxt pointers to write the new mtab, absent is not added to the new
+ mtab.
+- If mtab is empty, absent->prev should be set to mc0, and not mc0->prev, as
+ it will be NULL.
+- Memory leak if we have to abort before mc0 and co are freed.
+
+Patch by Martin Schlemmer <azarah@gentoo.org>
+
+
+--- util-linux-2.12q/mount/fstab.c 2005-09-14 15:30:10.000000000 +0200
++++ util-linux-2.12q.az/mount/fstab.c 2005-09-14 15:31:48.000000000 +0200
+@@ -604,15 +604,32 @@ update_mtab (const char *dir, struct my_
+ free(mc);
+ }
+ } else {
+- /* A remount */
+- mc->m.mnt_opts = instead->mnt_opts;
++ /* A remount. */
++ my_free(mc->m.mnt_opts);
++ /* Need to alloc memory, else we might
++ * run into issues if both we and the caller frees
++ * mnt_opts ... */
++ mc->m.mnt_opts = xstrdup(instead->mnt_opts);
+ }
+ } else if (instead) {
+ /* not found, add a new entry */
+ absent = xmalloc(sizeof(*absent));
+- absent->m = *instead;
++ /* Cannot just set absent->m to instead, as we free absent
++ * below, and the caller might free instead */
++ absent->m.mnt_fsname = xstrdup(instead->mnt_fsname);
++ absent->m.mnt_dir = xstrdup(instead->mnt_dir);
++ absent->m.mnt_type = xstrdup(instead->mnt_type);
++ absent->m.mnt_opts = xstrdup(instead->mnt_opts);
++ absent->m.mnt_freq = instead->mnt_freq;
++ absent->m.mnt_passno = instead->mnt_passno;
++
+ absent->nxt = mc0;
+- absent->prev = mc0->prev;
++ if (mc0->prev != NULL) {
++ absent->prev = mc0->prev;
++ mc0->prev->nxt = absent;
++ } else {
++ absent->prev = mc0;
++ }
+ mc0->prev = absent;
+ if (mc0->nxt == NULL)
+ mc0->nxt = absent;
+@@ -624,6 +641,8 @@ update_mtab (const char *dir, struct my_
+ int errsv = errno;
+ error (_("cannot open %s (%s) - mtab not updated"),
+ MOUNTED_TEMP, strerror (errsv));
++ /* Do not leak memory */
++ discard_mntentchn(mc0);
+ goto leave;
+ }
+
diff --git a/sys-apps/util-linux/files/util-linux-2.12q-use-update_mtab-for-fake.patch b/sys-apps/util-linux/files/util-linux-2.12q-use-update_mtab-for-fake.patch
new file mode 100644
index 0000000..5d0b436
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12q-use-update_mtab-for-fake.patch
@@ -0,0 +1,16 @@
+Use update_mtab() to update /etc/mtab on fake mounts (mount -f), else we get
+dup entries in /etc/mtab.
+
+Patch by Mike Frysinger <vapier@gentoo.org>
+
+--- util-linux-2.12q/mount/mount.c 2005-09-14 15:37:43.000000000 +0200
++++ util-linux-2.12q.az/mount/mount.c 2005-09-14 15:27:14.000000000 +0200
+@@ -662,7 +662,7 @@ update_mtab_entry(const char *spec, cons
+ print_one (&mnt);
+
+ if (!nomtab && mtab_is_writable()) {
+- if (flags & MS_REMOUNT)
++ if (fake || (flags & MS_REMOUNT))
+ update_mtab (mnt.mnt_dir, &mnt);
+ else {
+ mntFILE *mfp;
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h-loop-aes.patch b/sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h-loop-aes.patch
new file mode 100644
index 0000000..8c5bbc7
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h-loop-aes.patch
@@ -0,0 +1,18 @@
+fix building when asm/page.h is not available
+
+http://bugs.gentoo.org/168278
+
+the loop-aes patch adds this ...
+
+--- mount/swapon.c
++++ mount/swapon.c
+@@ -31,7 +31,9 @@
+ #include <sys/ioctl.h>
+ #include <sys/utsname.h>
+ #include <sys/time.h>
++#ifdef HAVE_asm_page_h
+ #include <asm/page.h>
++#endif
+ #include "xmalloc.h"
+ #include "swap_constants.h"
+ #include "swapargs.h"
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h.patch b/sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h.patch
new file mode 100644
index 0000000..21c0470
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-HAVE_asm_page_h.patch
@@ -0,0 +1,16 @@
+fix building when asm/page.h is not available
+
+http://bugs.gentoo.org/168278
+
+--- disk-utils/fsck.cramfs.c
++++ disk-utils/fsck.cramfs.c
+@@ -76,7 +76,9 @@
+
+ #define PAD_SIZE 512
+
++#ifdef HAVE_asm_page_h
+ #include <asm/page.h>
++#endif
+ #ifdef PAGE_SIZE
+ #define PAGE_CACHE_SIZE ((int) PAGE_SIZE)
+ #elif defined __ia64__
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-cal-dumb-terminal.patch b/sys-apps/util-linux/files/util-linux-2.12r-cal-dumb-terminal.patch
new file mode 100644
index 0000000..073506e
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-cal-dumb-terminal.patch
@@ -0,0 +1,37 @@
+If you try to use cal on a terminal which doesnt support highlighting,
+Senter and Sexit will be set to NULL instead of "" which will cause the
+resulting output to be off:
+
+$ env TERM=dumb cal
+ December 2005
+Su Mo Tu We Th Fr Sa
+ 1 2 3
+ 4 5 6 7 8 9 10
+111 13 14 15 16 17
+18 19 20 21 22 23 24
+25 26 27 28 29 30 31
+
+http://bugs.gentoo.org/112406
+
+--- util-linux/misc-utils/cal.c
++++ util-linux/misc-utils/cal.c
+@@ -89,7 +89,8 @@
+
+ static char *
+ my_tgetstr(char *s, char *ss) {
+- return tigetstr(ss);
++ char *ret = tigetstr(ss);
++ return (ret == NULL ? "" : ret);
+ }
+
+ #elif defined(HAVE_termcap)
+@@ -112,7 +113,8 @@
+
+ static char *
+ my_tgetstr(char *s, char *ss) {
+- return tgetstr(s, &strbuf);
++ char *ret = tgetstr(s, &strbuf);
++ return (ret == NULL ? "" : ret);
+ }
+
+ #endif
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-cracklib-words.patch b/sys-apps/util-linux/files/util-linux-2.12r-cracklib-words.patch
new file mode 100644
index 0000000..30bc7e0
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-cracklib-words.patch
@@ -0,0 +1,19 @@
+--- misc-utils/look.c
++++ misc-utils/look.c
+@@ -137,7 +137,15 @@
+ *++p = '\0';
+
+ if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb))
+- err("%s: %s", file, strerror(errno));
++ {
++ /* if opening the primary file failed, fall back to cracklib word files */
++ file = "/usr/share/dict/cracklib-words";
++ if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb)) {
++ file = "/usr/share/dict/cracklib-small";
++ if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb))
++ err("%s: %s\n\tplease emerge sys-apps/cracklib-words or sys-apps/miscfiles", file, strerror(errno));
++ }
++ }
+ front = mmap(NULL, (size_t) sb.st_size, PROT_READ,
+ #ifdef MAP_FILE
+ MAP_FILE |
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-fdisk-frame-pointers.patch b/sys-apps/util-linux/files/util-linux-2.12r-fdisk-frame-pointers.patch
new file mode 100644
index 0000000..1ad2916
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-fdisk-frame-pointers.patch
@@ -0,0 +1,12 @@
+--- fdisk/Makefile.orig 2005-10-15 14:30:56.000000000 +0000
++++ fdisk/Makefile 2005-10-15 14:33:02.000000000 +0000
+@@ -6,6 +6,9 @@
+ include ../make_include
+ include ../MCONFIG
+
++# fdisk when built with ssp and omiting -fomit-frame-pointer causes fdisk/cfdisk/sfdisk to not see the device
++CFLAGS += -fno-omit-frame-pointer
++
+ MAN8=
+ SBIN=
+ CFDISK=cfdisk
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-no-_syscall.patch b/sys-apps/util-linux/files/util-linux-2.12r-no-_syscall.patch
new file mode 100644
index 0000000..fb5ab38
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-no-_syscall.patch
@@ -0,0 +1,53 @@
+newer kernel headers stop exporting _syscall#() macro's, so let's insert
+some workarounds to handle this ...
+
+util-linux-2.13 doesnt use _syscall#() anymore
+
+http://bugs.gentoo.org/150852
+
+--- lib/my-syscall.h
++++ lib/my-syscall.h
+@@ -0,0 +1,12 @@
++#ifndef __MY_SYSCALL_H__
++#define __MY_SYSCALL_H__
++
++#ifndef _syscall5
++# define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
++type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
++{ \
++ return (type) syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5); \
++}
++#endif
++
++#endif
+--- fdisk/llseek.c
++++ fdisk/llseek.c
+@@ -10,6 +10,8 @@
+ #include <errno.h>
+ #include <unistd.h>
+
++#include "my-syscall.h"
++
+ extern long long ext2_llseek (unsigned int, long long, unsigned int);
+
+ #ifdef __linux__
+--- fdisk/sfdisk.c
++++ fdisk/sfdisk.c
+@@ -177,6 +177,7 @@
+ #endif
+
+ #ifndef use_lseek
++#include <my-syscall.h>
+ static __attribute__used
+ _syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
+ loff_t *, res, unsigned int, wh);
+--- partx/partx.c
++++ partx/partx.c
+@@ -339,6 +339,7 @@
+
+ #ifdef NEED__llseek
+ #include <linux/unistd.h> /* _syscall */
++#include "../lib/my-syscall.h"
+ static
+ _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
+ long long *, res, uint, wh);
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-umount-no-special.patch b/sys-apps/util-linux/files/util-linux-2.12r-umount-no-special.patch
new file mode 100644
index 0000000..2d2c1cf
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-umount-no-special.patch
@@ -0,0 +1,11 @@
+--- mount/umount.c
++++ mount/umount.c
+@@ -31,7 +31,7 @@
+ #include <arpa/inet.h>
+ #endif
+
+-#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__)
++#if defined(MNT_FORCE)
+ /* Interesting ... it seems libc knows about MNT_FORCE and presumably
+ about umount2 as well -- need not do anything */
+ #else /* MNT_FORCE */
diff --git a/sys-apps/util-linux/files/util-linux-2.12r-umount-nosysfs.patch b/sys-apps/util-linux/files/util-linux-2.12r-umount-nosysfs.patch
new file mode 100644
index 0000000..eb0d405
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.12r-umount-nosysfs.patch
@@ -0,0 +1,11 @@
+--- util-linux-2.12r/mount/umount.c.orig 2006-03-03 11:29:57.000000000 -0500
++++ util-linux-2.12r/mount/umount.c 2006-03-03 11:30:07.000000000 -0500
+@@ -724,7 +724,7 @@
+ if (all) {
+ /* nodev stuff: sysfs, usbfs, oprofilefs, ... */
+ if (types == NULL)
+- types = "noproc,nodevfs,nodevpts";
++ types = "noproc,nodevfs,nodevpts,nosysfs";
+ result = umount_all (types, test_opts);
+ } else if (argc < 1) {
+ usage (stderr, 2);
diff --git a/sys-apps/util-linux/files/util-linux-2.13-ioprio-syscalls.patch b/sys-apps/util-linux/files/util-linux-2.13-ioprio-syscalls.patch
new file mode 100644
index 0000000..f558ff6
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.13-ioprio-syscalls.patch
@@ -0,0 +1,16 @@
+Just stub this cruft for crappy arches
+
+http://bugs.gentoo.org/190613
+
+--- schedutils/ionice.c
++++ schedutils/ionice.c
+@@ -39,7 +39,8 @@
+ # define __NR_ioprio_set 196
+ # define __NR_ioprio_get 218
+ # else
+-# error "Unsupported arch"
++# define __NR_ioprio_set -1
++# define __NR_ioprio_get -1
+ # endif
+
+ # define SYS_ioprio_get __NR_ioprio_get
diff --git a/sys-apps/util-linux/files/util-linux-2.13-locale.patch b/sys-apps/util-linux/files/util-linux-2.13-locale.patch
new file mode 100644
index 0000000..feb46f9
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.13-locale.patch
@@ -0,0 +1,121 @@
+http://bugs.gentoo.org/191111
+http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/614
+
+Move all locale/nls related includes to nls.h and make sure they are only
+pulled in when ENABLE_NLS. When !ENABLE_NLS, don't include any locale/nls
+related headers and stub out setlocale() as well.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/nls.h | 5 ++++-
+ misc-utils/cal.c | 1 -
+ misc-utils/look.c | 1 -
+ misc-utils/write.c | 1 -
+ text-utils/colrm.c | 2 +-
+ text-utils/more.c | 1 -
+ text-utils/pg.c | 2 --
+ 7 files changed, 5 insertions(+), 8 deletions(-)
+
+diff --git a/include/nls.h b/include/nls.h
+index f571ca5..e9f7927 100644
+--- a/include/nls.h
++++ b/include/nls.h
+@@ -9,6 +9,8 @@ int main(int argc, char *argv[]);
+
+ #ifdef ENABLE_NLS
+ # include <libintl.h>
++# include <locale.h>
++# include <nl_types.h>
+ # define _(Text) gettext (Text)
+ # ifdef gettext_noop
+ # define N_(String) gettext_noop (String)
+@@ -16,9 +18,10 @@ int main(int argc, char *argv[]);
+ # define N_(String) (String)
+ # endif
+ #else
+-# include <locale.h>
+ # undef bindtextdomain
+ # define bindtextdomain(Domain, Directory) /* empty */
++# undef setlocale
++# define setlocale(Category, Locale) /* empty */
+ # undef textdomain
+ # define textdomain(Domain) /* empty */
+ # define _(Text) (Text)
+diff --git a/misc-utils/cal.c b/misc-utils/cal.c
+index f5ede93..77333d8 100644
+--- a/misc-utils/cal.c
++++ b/misc-utils/cal.c
+@@ -63,7 +63,6 @@
+ #include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+-#include <locale.h>
+ #include "errs.h"
+ #include "nls.h"
+
+diff --git a/misc-utils/look.c b/misc-utils/look.c
+index 5c7e30c..9e25596 100644
+--- a/misc-utils/look.c
++++ b/misc-utils/look.c
+@@ -59,7 +59,6 @@
+ #include <strings.h>
+ #include <ctype.h>
+ #include <getopt.h>
+-#include <locale.h>
+ #include "pathnames.h"
+ #include "nls.h"
+
+diff --git a/misc-utils/write.c b/misc-utils/write.c
+index b3c96d1..46b8f0a 100644
+--- a/misc-utils/write.c
++++ b/misc-utils/write.c
+@@ -54,7 +54,6 @@
+ #include <pwd.h>
+ #include <string.h>
+ #include <stdlib.h>
+-#include <locale.h>
+ #include <signal.h>
+ #include <sys/param.h>
+ #include <sys/signal.h>
+diff --git a/text-utils/colrm.c b/text-utils/colrm.c
+index 5e18a6f..e8b1ea4 100644
+--- a/text-utils/colrm.c
++++ b/text-utils/colrm.c
+@@ -40,8 +40,8 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <locale.h>
+
++#include "nls.h"
+ #include "widechar.h"
+
+ /*
+diff --git a/text-utils/more.c b/text-utils/more.c
+index 19c4417..5dcae7b 100644
+--- a/text-utils/more.c
++++ b/text-utils/more.c
+@@ -55,7 +55,6 @@
+ #include <sys/file.h>
+ #include <sys/wait.h>
+ #include <a.out.h>
+-#include <locale.h>
+ #include "xstrncpy.h"
+ #include "nls.h"
+ #include "widechar.h"
+diff --git a/text-utils/pg.c b/text-utils/pg.c
+index 10bdd15..3e1b25e 100644
+--- a/text-utils/pg.c
++++ b/text-utils/pg.c
+@@ -49,8 +49,6 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <setjmp.h>
+-#include <locale.h>
+-#include <nl_types.h>
+ #include <libgen.h>
+
+ #ifdef HAVE_NCURSES_H
+--
+1.5.3.rc7
+
diff --git a/sys-apps/util-linux/files/util-linux-2.13-no-nls.patch b/sys-apps/util-linux/files/util-linux-2.13-no-nls.patch
new file mode 100644
index 0000000..f17debe
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.13-no-nls.patch
@@ -0,0 +1,11 @@
+--- include/nls.h
++++ include/nls.h
+@@ -17,6 +17,8 @@
+ # define bindtextdomain(Domain, Directory) /* empty */
+ # undef textdomain
+ # define textdomain(Domain) /* empty */
++# undef setlocale
++# define setlocale(category, locale) /* empty */
+ # define _(Text) (Text)
+ # define N_(Text) (Text)
+ #endif
diff --git a/sys-apps/util-linux/files/util-linux-2.13-script-SIGWINCH.patch b/sys-apps/util-linux/files/util-linux-2.13-script-SIGWINCH.patch
new file mode 100644
index 0000000..e8ed571
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.13-script-SIGWINCH.patch
@@ -0,0 +1,56 @@
+commit 2b8bbb5fb0f024ea3917fedbbbaf0fab1c1f6555
+Author: Karel Zak <kzak@redhat.com>
+Date: Fri Oct 5 12:22:13 2007 +0200
+
+ script: dies on SIGWINCH
+
+ The "doinput" process doesn't make a difference between SIGWINCH and
+ SIGCHILD. This process also sends unnecessary SIGWINCH to child (the
+ signal is ignored by child). Fixed.
+
+ Signed-off-by: Karel Zak <kzak@redhat.com>
+
+diff --git a/misc-utils/script.c b/misc-utils/script.c
+index d3272df..3b957d8 100644
+--- a/misc-utils/script.c
++++ b/misc-utils/script.c
+@@ -99,6 +99,7 @@ int tflg = 0;
+ static char *progname;
+
+ int die;
++int resized;
+
+ static void
+ die_if_link(char *fn) {
+@@ -235,8 +236,14 @@ doinput() {
+ if (die == 0 && child && kill(child, 0) == -1 && errno == ESRCH)
+ die = 1;
+
+- while (die == 0 && (cc = read(0, ibuf, BUFSIZ)) > 0)
+- (void) write(master, ibuf, cc);
++ while (die == 0) {
++ if ((cc = read(0, ibuf, BUFSIZ)) > 0)
++ (void) write(master, ibuf, cc);
++ else if (cc == -1 && errno == EINTR && resized)
++ resized = 0;
++ else
++ break;
++ }
+
+ done();
+ }
+@@ -255,11 +262,10 @@ finish(int dummy) {
+
+ void
+ resize(int dummy) {
++ resized = 1;
+ /* transmit window change information to the child */
+ (void) ioctl(0, TIOCGWINSZ, (char *)&win);
+ (void) ioctl(slave, TIOCSWINSZ, (char *)&win);
+-
+- kill(child, SIGWINCH);
+ }
+
+ /*
+
+
diff --git a/sys-apps/util-linux/files/util-linux-2.13-setuid-checks.patch b/sys-apps/util-linux/files/util-linux-2.13-setuid-checks.patch
new file mode 100644
index 0000000..a3758dd
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.13-setuid-checks.patch
@@ -0,0 +1,52 @@
+From: Ludwig Nussel <ludwig.nussel@suse.de>
+Date: Thu, 20 Sep 2007 12:57:20 +0000 (+0200)
+Subject: mount: doesn't drop privileges properly when calling helpers
+X-Git-Url: http://git.kernel.org/?p=utils%2Futil-linux-ng%2Futil-linux-ng.git;a=commitdiff_plain;h=ebbeb2c7ac1b00b6083905957837a271e80b187e
+
+mount: doesn't drop privileges properly when calling helpers
+
+{,u}mount calls setuid() and setgid() in the wrong order and doesn't checking
+the return value of set{u,g}id(() when running helpers like mount.nfs.
+
+Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+
+diff --git a/mount/mount.c b/mount/mount.c
+index 40699f3..5bc2b30 100644
+--- a/mount/mount.c
++++ b/mount/mount.c
+@@ -634,8 +634,12 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
+ char *oo, *mountargs[10];
+ int i = 0;
+
+- setuid(getuid());
+- setgid(getgid());
++ if(setgid(getgid()) < 0)
++ die(EX_FAIL, _("mount: cannot set group id: %s"), strerror(errno));
++
++ if(setuid(getuid()) < 0)
++ die(EX_FAIL, _("mount: cannot set user id: %s"), strerror(errno));
++
+ oo = fix_opts_string (flags, extra_opts, NULL);
+ mountargs[i++] = mountprog; /* 1 */
+ mountargs[i++] = (char *) spec; /* 2 */
+diff --git a/mount/umount.c b/mount/umount.c
+index b3100c9..3221619 100644
+--- a/mount/umount.c
++++ b/mount/umount.c
+@@ -102,8 +102,12 @@ check_special_umountprog(const char *spec, const char *node,
+ char *umountargs[8];
+ int i = 0;
+
+- setuid(getuid());
+- setgid(getgid());
++ if(setgid(getgid()) < 0)
++ die(EX_FAIL, _("umount: cannot set group id: %s"), strerror(errno));
++
++ if(setuid(getuid()) < 0)
++ die(EX_FAIL, _("umount: cannot set user id: %s"), strerror(errno));
++
+ umountargs[i++] = umountprog;
+ umountargs[i++] = xstrdup(node);
+ if (nomtab)
diff --git a/sys-apps/util-linux/files/util-linux-2.13-uclibc.patch b/sys-apps/util-linux/files/util-linux-2.13-uclibc.patch
new file mode 100644
index 0000000..237e126
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.13-uclibc.patch
@@ -0,0 +1,71 @@
+--- login-utils/agetty.c
++++ login-utils/agetty.c
+@@ -884,7 +884,7 @@
+
+ case 'o':
+ {
+- char domainname[HOST_NAME_MAX+1];
++ char domainname[HOSTNAME_LENGTH+1];
+ #ifdef HAVE_GETDOMAINNAME
+ if (getdomainname(domainname, sizeof(domainname)))
+ #endif
+@@ -897,7 +897,7 @@
+ case 'O':
+ {
+ char *dom = "unknown_domain";
+- char host[HOST_NAME_MAX + 1];
++ char host[HOSTNAME_LENGTH + 1];
+ struct addrinfo hints, *info = NULL;
+
+ memset(&hints, 0, sizeof(hints));
+@@ -992,7 +992,7 @@
+ }
+ #endif
+ {
+- char hn[HOST_NAME_MAX+1];
++ char hn[HOSTNAME_LENGTH+1];
+ if (gethostname(hn, sizeof(hn)) == 0)
+ write(1, hn, strlen(hn));
+ }
+--- configure
++++ configure
+@@ -7663,7 +7663,10 @@
+ main ()
+ {
+
+-int test = SYS_sched_getaffinity;
++#if defined(__UCLIBC__) && __UCLIBC_SUBLEVEL__ <= 28
++#error taskset unusable
++#endif
++int test = SYS_sched_getaffinity;
+
+ ;
+ return 0;
+--- sys-utils/setarch.c
++++ sys-utils/setarch.c
+@@ -39,6 +39,10 @@
+ #include <sys/utsname.h>
+ #include "nls.h"
+
++#if defined(__UCLIBC__) && __UCLIBC_SUBLEVEL__ <= 28
++static const char *program_invocation_short_name;
++#endif
++
+ #define set_pers(pers) ((long)syscall(SYS_personality, pers))
+
+ struct {
+@@ -184,6 +188,14 @@
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
++#if defined(__UCLIBC__) && __UCLIBC_SUBLEVEL__ <= 28
++ program_invocation_short_name = strrchr(argv[0],'/');
++ if (program_invocation_short_name)
++ program_invocation_short_name++;
++ else
++ program_invocation_short_name = argv[0];
++#endif
++
+ if (argc < 1)
+ show_usage(_("Not enough arguments"));
+
diff --git a/sys-apps/util-linux/files/util-linux-no-kill.patch b/sys-apps/util-linux/files/util-linux-no-kill.patch
new file mode 100644
index 0000000..bd4638b
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-no-kill.patch
@@ -0,0 +1,23 @@
+diff -urN util-linux-2.11z.old/misc-utils/Makefile util-linux-2.11z/misc-utils/Makefile
+--- util-linux-2.11z.old/misc-utils/Makefile 2002-11-02 05:51:02.000000000 -0800
++++ util-linux-2.11z/misc-utils/Makefile 2003-12-06 20:02:28.000000000 -0800
+@@ -34,11 +34,6 @@
+ MAN1:=$(MAN1) write.1
+ endif
+
+-ifeq "$(HAVE_KILL)" "no"
+-BIN:=$(BIN) kill
+-MAN1:=$(MAN1) kill.1
+-endif
+-
+ ifeq "$(HAVE_NCURSES)" "yes"
+ USRBIN:=$(USRBIN) setterm
+ MAN1:=$(MAN1) setterm.1
+@@ -81,7 +76,6 @@
+ cal: cal.o $(ERR_O)
+ chkdupexe: chkdupexe.pl
+ ddate: ddate.o
+-kill: kill.o procs.o
+ logger: logger.o
+ mcookie: mcookie.o $(LIB)/md5.o
+ mcookie.o: mcookie.c $(LIB)/md5.h