mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-24 07:51:03 +02:00
Merge pull request #1992 from ajeddeloh/andrew
sys-fs/e2fsprogs: Moving to overlay with patch
This commit is contained in:
commit
ea43677d10
2
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/Manifest
vendored
Normal file
2
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/Manifest
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DIST e2fsprogs-1.42.13.tar.gz 6511931 SHA256 59993ff3a44f82e504561e0ebf95e8c8fa9f9f5746eb6a7182239605d2a4e2d4 SHA512 d341790f55c3bff34425369063757280b9ba6ac08f405e14f94f299345ae76c0dc6e90871b746cc98c73467448d888fe5bc029688b5eed5fd22c3c37bf285cd0 WHIRLPOOL 2b26e355ad8e378cc7402be5fd5f5abe0af2aa6a1214b357dca682b922aa07c97af427b369ef21ddb3ee731768234a5f5faf488b92a68b0175d07845dbe7783f
|
||||||
|
DIST e2fsprogs-1.42.9-mint-r1.patch.xz 9012 SHA256 3904654080b7f7776e97b703d17e1b59ae1d6f5e0cf32193b86e986bc0a9b396 SHA512 591a7c80d65082eebcdc455028be6ade05c9aae96c94f654106be0facef330a8875dae82891e6e3ad2b48dece2b4e1c1940dbc47cd3eba3e6eea3b5ddba9a8fc WHIRLPOOL ae6fc015fa77bfbde7a4ba2205c014b655e736c4ed5cb63a913245c6c40fa0637b65fa3eec6399dd1793c494892b76e0bbc12ffa6ac9c39d4da27333d8bbf6c7
|
129
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/e2fsprogs-1.42.13-r1.ebuild
vendored
Normal file
129
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/e2fsprogs-1.42.13-r1.ebuild
vendored
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
# Copyright 1999-2015 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
EAPI=4
|
||||||
|
|
||||||
|
case ${PV} in
|
||||||
|
*_pre*) UP_PV="${PV%_pre*}-WIP-${PV#*_pre}" ;;
|
||||||
|
*) UP_PV=${PV} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
inherit eutils flag-o-matic multilib toolchain-funcs
|
||||||
|
|
||||||
|
DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
|
||||||
|
HOMEPAGE="http://e2fsprogs.sourceforge.net/"
|
||||||
|
SRC_URI="mirror://sourceforge/e2fsprogs/${PN}-${UP_PV}.tar.gz
|
||||||
|
elibc_mintlib? ( mirror://gentoo/${PN}-1.42.9-mint-r1.patch.xz )"
|
||||||
|
|
||||||
|
LICENSE="GPL-2 BSD"
|
||||||
|
SLOT="0"
|
||||||
|
KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 -x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~m68k-mint"
|
||||||
|
IUSE="nls static-libs elibc_FreeBSD"
|
||||||
|
|
||||||
|
RDEPEND="~sys-libs/${PN}-libs-${PV}
|
||||||
|
>=sys-apps/util-linux-2.16
|
||||||
|
nls? ( virtual/libintl )"
|
||||||
|
DEPEND="${RDEPEND}
|
||||||
|
nls? ( sys-devel/gettext )
|
||||||
|
virtual/pkgconfig
|
||||||
|
sys-apps/texinfo"
|
||||||
|
|
||||||
|
S=${WORKDIR}/${P%_pre*}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
epatch "${FILESDIR}"/${PN}-1.41.8-makefile.patch
|
||||||
|
epatch "${FILESDIR}"/${PN}-1.40-fbsd.patch
|
||||||
|
if [[ ${CHOST} == *-mint* ]] ; then
|
||||||
|
epatch "${WORKDIR}"/${PN}-1.42.9-mint-r1.patch
|
||||||
|
fi
|
||||||
|
epatch "${FILESDIR}"/${PN}-1.42.13-fix-build-cflags.patch #516854
|
||||||
|
epatch "${FILESDIR}"/${PN}-1.42.13-subst-perms.patch #550986
|
||||||
|
epatch "${FILESDIR}"/${PN}-1.42.13-sysmacros.patch
|
||||||
|
epatch "${FILESDIR}"/${PN}-1.42.13-protect-existing-fs.patch
|
||||||
|
|
||||||
|
# blargh ... trick e2fsprogs into using e2fsprogs-libs
|
||||||
|
rm -rf doc
|
||||||
|
sed -i -r \
|
||||||
|
-e 's:@LIBINTL@:@LTLIBINTL@:' \
|
||||||
|
-e '/^(STATIC_)?LIB(COM_ERR|SS)/s:[$][(]LIB[)]/lib([^@]*)@(STATIC_)?LIB_EXT@:-l\1:' \
|
||||||
|
-e '/^DEP(STATIC_)?LIB(COM_ERR|SS)/s:=.*:=:' \
|
||||||
|
MCONFIG.in || die "muck libs" #122368
|
||||||
|
sed -i -r \
|
||||||
|
-e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
|
||||||
|
Makefile.in || die "remove subdirs"
|
||||||
|
ln -s $(which mk_cmds) lib/ss/ || die
|
||||||
|
|
||||||
|
# Avoid rebuild
|
||||||
|
echo '#include_next <ss/ss_err.h>' > lib/ss/ss_err.h
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
# Keep the package from doing silly things #261411
|
||||||
|
export VARTEXFONTS=${T}/fonts
|
||||||
|
|
||||||
|
# needs open64() prototypes and friends
|
||||||
|
append-cppflags -D_GNU_SOURCE
|
||||||
|
|
||||||
|
ac_cv_path_LDCONFIG=: \
|
||||||
|
econf \
|
||||||
|
--with-root-prefix="${EPREFIX}/" \
|
||||||
|
--enable-symlink-install \
|
||||||
|
$(tc-is-static-only || echo --enable-elf-shlibs) \
|
||||||
|
$(tc-has-tls || echo --disable-tls) \
|
||||||
|
--without-included-gettext \
|
||||||
|
$(use_enable nls) \
|
||||||
|
--disable-libblkid \
|
||||||
|
--disable-libuuid \
|
||||||
|
--disable-quota \
|
||||||
|
--disable-fsck \
|
||||||
|
--disable-uuidd
|
||||||
|
if [[ ${CHOST} != *-uclibc ]] && grep -qs 'USE_INCLUDED_LIBINTL.*yes' config.{log,status} ; then
|
||||||
|
eerror "INTL sanity check failed, aborting build."
|
||||||
|
eerror "Please post your ${S}/config.log file as an"
|
||||||
|
eerror "attachment to https://bugs.gentoo.org/show_bug.cgi?id=81096"
|
||||||
|
die "Preventing included intl cruft from building"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
emake V=1 COMPILE_ET=compile_et MK_CMDS=mk_cmds
|
||||||
|
|
||||||
|
# Build the FreeBSD helper
|
||||||
|
if use elibc_FreeBSD ; then
|
||||||
|
cp "${FILESDIR}"/fsck_ext2fs.c .
|
||||||
|
emake V=1 fsck_ext2fs
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
# need to set root_libdir= manually as any --libdir options in the
|
||||||
|
# econf above (i.e. multilib) will screw up the default #276465
|
||||||
|
emake \
|
||||||
|
STRIP=: \
|
||||||
|
root_libdir="${EPREFIX}/usr/$(get_libdir)" \
|
||||||
|
DESTDIR="${D}" \
|
||||||
|
install install-libs
|
||||||
|
dodoc README RELEASE-NOTES
|
||||||
|
|
||||||
|
insinto /etc
|
||||||
|
doins "${FILESDIR}"/e2fsck.conf
|
||||||
|
|
||||||
|
# Move shared libraries to /lib/, install static libraries to
|
||||||
|
# /usr/lib/, and install linker scripts to /usr/lib/.
|
||||||
|
gen_usr_ldscript -a e2p ext2fs
|
||||||
|
# configure doesn't have an option to disable static libs :/
|
||||||
|
use static-libs || find "${D}" -name '*.a' -delete
|
||||||
|
|
||||||
|
if use elibc_FreeBSD ; then
|
||||||
|
# Install helpers for us
|
||||||
|
into /
|
||||||
|
dosbin "${S}"/fsck_ext2fs
|
||||||
|
doman "${FILESDIR}"/fsck_ext2fs.8
|
||||||
|
|
||||||
|
# filefrag is linux only
|
||||||
|
rm \
|
||||||
|
"${ED}"/usr/sbin/filefrag \
|
||||||
|
"${ED}"/usr/share/man/man8/filefrag.8 || die
|
||||||
|
fi
|
||||||
|
}
|
6
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/e2fsck.conf
vendored
Normal file
6
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/e2fsck.conf
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# See the e2fsck.conf man page for more info
|
||||||
|
|
||||||
|
[options]
|
||||||
|
|
||||||
|
# allow fsck to run sanely at any point in time #142850
|
||||||
|
buggy_init_scripts = yes
|
11
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch
vendored
Normal file
11
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- a/lib/ext2fs/ext2_fs.h
|
||||||
|
+++ b/lib/ext2fs/ext2_fs.h
|
||||||
|
@@ -414,7 +414,7 @@
|
||||||
|
|
||||||
|
#define i_size_high i_dir_acl
|
||||||
|
|
||||||
|
-#if defined(__KERNEL__) || defined(__linux__)
|
||||||
|
+#if defined(__KERNEL__) || defined(__linux__) || defined(__FreeBSD__)
|
||||||
|
#define i_reserved1 osd1.linux1.l_i_reserved1
|
||||||
|
#define i_frag osd2.linux2.l_i_frag
|
||||||
|
#define i_fsize osd2.linux2.l_i_fsize
|
@ -0,0 +1,10 @@
|
|||||||
|
--- e2fsprogs-1.41.5/Makefile.in
|
||||||
|
+++ e2fsprogs-1.41.5/Makefile.in
|
||||||
|
@@ -281,6 +66,7 @@
|
||||||
|
uninstall: uninstall-progs-recursive uninstall-shlibs-libs-recursive uninstall-doc-libs
|
||||||
|
|
||||||
|
install-libs: install-libs-recursive
|
||||||
|
+install-libs-recursive: | install-shlibs-libs-recursive
|
||||||
|
|
||||||
|
uninstall-libs: uninstall-libs-recursive
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
https://bugs.gentoo.org/516854
|
||||||
|
|
||||||
|
--- e2fsprogs-1.42.13/configure
|
||||||
|
+++ e2fsprogs-1.42.13/configure
|
||||||
|
@@ -1315,6 +1315,8 @@
|
||||||
|
if test $cross_compiling = no; then
|
||||||
|
BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
|
||||||
|
BUILD_LDFLAGS="$LDFLAGS"
|
||||||
|
+else
|
||||||
|
+ BUILD_CFLAGS="$INCLUDES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
|||||||
|
diff --git misc/mke2fs.8.in misc/mke2fs.8.in
|
||||||
|
index 1002eae..9df1f09 100644
|
||||||
|
--- misc/mke2fs.8.in
|
||||||
|
+++ misc/mke2fs.8.in
|
||||||
|
@@ -67,6 +67,9 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
|
||||||
|
[^]\fIfeature\fR[,...]
|
||||||
|
]
|
||||||
|
[
|
||||||
|
+.B \-p
|
||||||
|
+]
|
||||||
|
+[
|
||||||
|
.B \-q
|
||||||
|
]
|
||||||
|
[
|
||||||
|
@@ -608,6 +611,13 @@ For more information about the features which can be set, please see
|
||||||
|
the manual page
|
||||||
|
.BR ext4 (5).
|
||||||
|
.TP
|
||||||
|
+.B \-p
|
||||||
|
+Protect existing partitions, even if not run from a tty. Prevents
|
||||||
|
+.B mke2fs
|
||||||
|
+from overwriting existing partitions. If a partition would be overridden,
|
||||||
|
+.B mke2fs
|
||||||
|
+will exit instead.
|
||||||
|
+.TP
|
||||||
|
.B \-q
|
||||||
|
Quiet execution. Useful if
|
||||||
|
.B mke2fs
|
||||||
|
diff --git misc/mke2fs.c misc/mke2fs.c
|
||||||
|
index a14e62e..95fa99a 100644
|
||||||
|
--- misc/mke2fs.c
|
||||||
|
+++ misc/mke2fs.c
|
||||||
|
@@ -89,6 +89,7 @@ static int super_only;
|
||||||
|
static int discard = 1; /* attempt to discard device before fs creation */
|
||||||
|
static int direct_io;
|
||||||
|
static int force;
|
||||||
|
+static int protect;
|
||||||
|
static int noaction;
|
||||||
|
static int num_backups = 2; /* number of backup bg's for sparse_super2 */
|
||||||
|
static uid_t root_uid;
|
||||||
|
@@ -129,7 +130,7 @@ static void usage(void)
|
||||||
|
"[-M last-mounted-directory]\n\t[-O feature[,...]] "
|
||||||
|
"[-r fs-revision] [-E extended-option[,...]]\n"
|
||||||
|
"\t[-t fs-type] [-T usage-type ] [-U UUID] "
|
||||||
|
- "[-jnqvDFKSV] device [blocks-count]\n"),
|
||||||
|
+ "[-jnpqvDFKSV] device [blocks-count]\n"),
|
||||||
|
program_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
@@ -1512,7 +1513,7 @@ profile_error:
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((c = getopt (argc, argv,
|
||||||
|
- "b:cg:i:jl:m:no:qr:s:t:vC:DE:FG:I:J:KL:M:N:O:R:ST:U:V")) != EOF) {
|
||||||
|
+ "b:cg:i:jl:m:no:pqr:s:t:vC:DE:FG:I:J:KL:M:N:O:R:ST:U:V")) != EOF) {
|
||||||
|
switch (c) {
|
||||||
|
case 'b':
|
||||||
|
blocksize = parse_num_blocks2(optarg, -1);
|
||||||
|
@@ -1669,6 +1670,9 @@ profile_error:
|
||||||
|
case 'O':
|
||||||
|
fs_features = optarg;
|
||||||
|
break;
|
||||||
|
+ case 'p':
|
||||||
|
+ protect = 1;
|
||||||
|
+ break;
|
||||||
|
case 'q':
|
||||||
|
quiet = 1;
|
||||||
|
break;
|
||||||
|
@@ -1792,14 +1796,18 @@ profile_error:
|
||||||
|
|
||||||
|
/* The isatty() test is so we don't break existing scripts */
|
||||||
|
flags = CREATE_FILE;
|
||||||
|
- if (isatty(0) && isatty(1))
|
||||||
|
+ if ((isatty(0) && isatty(1)) || protect)
|
||||||
|
flags |= CHECK_FS_EXIST;
|
||||||
|
if (!quiet)
|
||||||
|
flags |= VERBOSE_CREATE;
|
||||||
|
if (fs_blocks_count == 0)
|
||||||
|
flags |= NO_SIZE;
|
||||||
|
if (!check_plausibility(device_name, flags, &is_device) && !force)
|
||||||
|
- proceed_question(proceed_delay);
|
||||||
|
+ if (protect)
|
||||||
|
+ exit(1); // just exit, since protect is on
|
||||||
|
+ else
|
||||||
|
+ proceed_question(proceed_delay);
|
||||||
|
+
|
||||||
|
|
||||||
|
check_mount(device_name, force, _("filesystem"));
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
From 0930fcd65ec8f135c90f673eab2a7a196103537d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
Date: Thu, 17 Sep 2015 14:18:16 -0400
|
||||||
|
Subject: [PATCH e2fsprogs] subst: use 0644 perms
|
||||||
|
|
||||||
|
When running on NFS, opening files with 0444 perms for writing can
|
||||||
|
sometimes fail. Since there's no real reason for these files to be
|
||||||
|
read-only, give the owner write permission.
|
||||||
|
|
||||||
|
URL: https://bugs.gentoo.org/550986
|
||||||
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
---
|
||||||
|
util/subst.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/util/subst.c b/util/subst.c
|
||||||
|
index f36adb4..e4004c9 100644
|
||||||
|
--- a/util/subst.c
|
||||||
|
+++ b/util/subst.c
|
||||||
|
@@ -370,7 +370,7 @@ int main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
strcpy(newfn, outfn);
|
||||||
|
strcat(newfn, ".new");
|
||||||
|
- fd = open(newfn, O_CREAT|O_TRUNC|O_RDWR, 0444);
|
||||||
|
+ fd = open(newfn, O_CREAT|O_TRUNC|O_RDWR, 0644);
|
||||||
|
if (fd < 0) {
|
||||||
|
perror(newfn);
|
||||||
|
exit(1);
|
||||||
|
--
|
||||||
|
2.5.1
|
||||||
|
|
@ -0,0 +1,74 @@
|
|||||||
|
From 13a12900148e6b778d8532ca76ff38edcec5a45f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
Date: Mon, 28 Mar 2016 20:31:33 -0400
|
||||||
|
Subject: [PATCH e2fsprogs] include sys/sysmacros.h as needed
|
||||||
|
|
||||||
|
The minor/major/makedev macros are not entirely standard. glibc has had
|
||||||
|
the definitions in sys/sysmacros.h since the start, and wants to move away
|
||||||
|
from always defining them implicitly via sys/types.h (as this pollutes the
|
||||||
|
namespace in violation of POSIX). Other C libraries have already dropped
|
||||||
|
them. Since the configure script already checks for this header, use that
|
||||||
|
to pull in the header in files that use these macros.
|
||||||
|
|
||||||
|
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
--- a/lib/blkid/devname.c
|
||||||
|
+++ b/lib/blkid/devname.c
|
||||||
|
@@ -36,6 +36,9 @@
|
||||||
|
#if HAVE_SYS_MKDEV_H
|
||||||
|
#include <sys/mkdev.h>
|
||||||
|
#endif
|
||||||
|
+#ifdef HAVE_SYS_SYSMACROS_H
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+#endif
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "blkidP.h"
|
||||||
|
--- a/lib/blkid/devno.c
|
||||||
|
+++ b/lib/blkid/devno.c
|
||||||
|
@@ -31,6 +31,9 @@
|
||||||
|
#if HAVE_SYS_MKDEV_H
|
||||||
|
#include <sys/mkdev.h>
|
||||||
|
#endif
|
||||||
|
+#ifdef HAVE_SYS_SYSMACROS_H
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "blkidP.h"
|
||||||
|
|
||||||
|
--- a/lib/ext2fs/finddev.c
|
||||||
|
+++ b/lib/ext2fs/finddev.c
|
||||||
|
@@ -31,6 +31,9 @@
|
||||||
|
#if HAVE_SYS_MKDEV_H
|
||||||
|
#include <sys/mkdev.h>
|
||||||
|
#endif
|
||||||
|
+#ifdef HAVE_SYS_SYSMACROS_H
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "ext2_fs.h"
|
||||||
|
#include "ext2fs.h"
|
||||||
|
--- a/lib/ext2fs/ismounted.c
|
||||||
|
+++ b/lib/ext2fs/ismounted.c
|
||||||
|
@@ -49,6 +49,9 @@
|
||||||
|
#endif /* HAVE_GETMNTINFO */
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#ifdef HAVE_SYS_SYSMACROS_H
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "ext2_fs.h"
|
||||||
|
#include "ext2fs.h"
|
||||||
|
--- a/misc/mk_hugefiles.c
|
||||||
|
+++ b/misc/mk_hugefiles.c
|
||||||
|
@@ -35,6 +35,9 @@ extern int optind;
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#ifdef HAVE_SYS_SYSMACROS_H
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+#endif
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <blkid/blkid.h>
|
96
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/fsck_ext2fs.8
vendored
Normal file
96
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/fsck_ext2fs.8
vendored
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
.TH fsck_ext2fs 8 2006-07-02 "Matthias Andree" "FreeBSD Ports"
|
||||||
|
.\"
|
||||||
|
.\" fsck_ext2fs.8 - manual page for fsck_ext2fs wrapper
|
||||||
|
.\"
|
||||||
|
.\" (C) Copyright 2006 by Matthias Andree <matthias.andree@gmx.de>
|
||||||
|
.\"
|
||||||
|
.\" License: This file may be redistributed in accordance with the terms
|
||||||
|
.\" of the GNU General Public License v2.
|
||||||
|
.\"
|
||||||
|
.\" Upstream $Id$
|
||||||
|
.\" $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.8,v 1.1 2006/07/04 15:47:51 leeym Exp $
|
||||||
|
.\"
|
||||||
|
.SH NAME
|
||||||
|
.B fsck_ext2fs
|
||||||
|
\- compatibility wrapper for e2fsck
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.P
|
||||||
|
.B fsck_ext2fs
|
||||||
|
[\fB\-Fpfnyv\fR] [\fB\-b\fR \fIblock\fR]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.P
|
||||||
|
\fBfsck_ext2fs\fR maps the traditional FreeBSD \fBfsck_ffs\fR options to
|
||||||
|
options with the same functionality for \fBe2fsck,\fR runs \fBe2fsck\fR
|
||||||
|
and then maps its exit status to values that FreeBSD understands.
|
||||||
|
\fBe2fsck\fR is a utility to check and repair ext2 and ext3 file
|
||||||
|
systems.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.IP \fB\-F\fR
|
||||||
|
(check foreground mode required) Immediately exits with status 1 to tell
|
||||||
|
\fBfsck\fR that ext2fs cannot be checked in the background. \fBfsck\fR
|
||||||
|
usually runs \fBfsck_*\fR programs twice, first with \fB\-F\fR to find
|
||||||
|
out if they can do background checking, then either immediately without
|
||||||
|
\fB\-F\fR for foreground checking or deferred in the background with
|
||||||
|
\fB\-B\fR.
|
||||||
|
.IP \fB\-p\fR
|
||||||
|
(preen mode) This option suppresses adding the \fB\-f\fR option (unless
|
||||||
|
\fB\-f\fR is also given) and adds the \fB\-p\fR option to the
|
||||||
|
\fBe2fsck\fR command line. This causes \fBe2fsck\fR to automatically fix
|
||||||
|
any filesystem problems that can safely be fixed without operator
|
||||||
|
intervention. Without this option given, \fBe2fsck\fR will be run with
|
||||||
|
the \fB\-f\fR option to force a check, since interactive scan and repair
|
||||||
|
mode is the default on FreeBSD, but not on Linux where \fBe2fsck\fR
|
||||||
|
comes from.
|
||||||
|
.IP \fB\-f\fR
|
||||||
|
(force check) This option forces the check of a clean file system while
|
||||||
|
preening and is passed to \fBe2fsck\fR verbatim.
|
||||||
|
.IP \fB\-n\fR
|
||||||
|
("no" mode) This option causes the file system to be opened in read-only
|
||||||
|
mode and assume "no" as answer to all questions. This is the only way to
|
||||||
|
safely run \fBfsck\fR on a mounted ext2 or ext3 file system. This option
|
||||||
|
is passed to \fBe2fsck\fR verbatim.
|
||||||
|
.IP \fB\-y\fR
|
||||||
|
("yes" mode) This option is passed verbatim to \fBe2fsck\fR and causes
|
||||||
|
it to assume "yes" as answer to all questions. This allows the
|
||||||
|
non-interactive use of e2fsck but is rather aggressive. Use with care.
|
||||||
|
.IP \fB\-v\fR
|
||||||
|
(verbose output) This option is passed verbatim to \fBe2fsck\fR and
|
||||||
|
causes it to verbosely report its progress.
|
||||||
|
.IP "\fB\-b\fR \fIblock\fR"
|
||||||
|
(use alternate super block) This option is passed verbatim to
|
||||||
|
\fBe2fsck\fR and selects an alternate super block, for use when the
|
||||||
|
primary super block has been damaged. Please see the \fBe2fsck\fR(8)
|
||||||
|
manual page for details.
|
||||||
|
|
||||||
|
.SH EXIT STATUS
|
||||||
|
If errors remain after \fBe2fsck\fR, an invalid option or too many
|
||||||
|
options have been specified, \fBe2fsck\fR was killed with a signal or
|
||||||
|
the \fIfork\fB system call failed, \fBfsck_ext2fs\fR exits with status
|
||||||
|
EXIT_FAILURE (usually 1). If \fBe2fsck\fR cannot be started, exits with
|
||||||
|
status 127. If the file system is clean after \fBe2fsck\fR operation,
|
||||||
|
exits with status EXIT_SUCCESS (0).
|
||||||
|
|
||||||
|
.SH NOTES
|
||||||
|
.P
|
||||||
|
This utility is merely meant as an adaptor so that \fBe2fsck\fR can be
|
||||||
|
run during the boot process, it does not support all options that
|
||||||
|
\fBe2fsck\fR offers. If you need one of its advanced options, please run
|
||||||
|
\fBe2fsck\fR directly.
|
||||||
|
|
||||||
|
.SH FILES
|
||||||
|
.TP
|
||||||
|
.I /sbin/e2fsck
|
||||||
|
is the location of the \fBe2fsck\fR program to run.
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
.P
|
||||||
|
Matthias Andree <matthias.andree@gmx.de> wrote the program and this
|
||||||
|
manual page.
|
||||||
|
.SH CONFORMING TO
|
||||||
|
The FreeBSD 6.1 command line interface for \fBfsck_ufs\fR(8).
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR fsck (8),
|
||||||
|
.BR e2fsck (8)
|
||||||
|
and
|
||||||
|
.BR fsck_ufs (8).
|
147
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/fsck_ext2fs.c
vendored
Normal file
147
sdk_container/src/third_party/coreos-overlay/sys-fs/e2fsprogs/files/fsck_ext2fs.c
vendored
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
/*
|
||||||
|
* fsck_ext2fs - wrapper for e2fsck on FreeBSD
|
||||||
|
* Copyright (C) 2004,2006 Matthias Andree <matthias.andree@gmx.de>
|
||||||
|
* redistributable in accordance with the
|
||||||
|
* GNU General Public License v2
|
||||||
|
*
|
||||||
|
* $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.c,v 1.5 2006/07/04 15:47:51 leeym Exp $
|
||||||
|
*
|
||||||
|
* Upstream: $Id$
|
||||||
|
*
|
||||||
|
* format: gindent -kr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
__attribute__ ((noreturn))
|
||||||
|
static int die(const char *tag)
|
||||||
|
{
|
||||||
|
perror(tag);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int ch, i = 1, force = 0, status, verbose = 0, t;
|
||||||
|
long block = 0;
|
||||||
|
enum { normal, preen, yes, no } mode = normal;
|
||||||
|
char *cmd[256];
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
cmd[0] = "/sbin/e2fsck";
|
||||||
|
while ((ch = getopt(argc, argv, "BFpfnyb:v")) != -1) {
|
||||||
|
switch (ch) {
|
||||||
|
case 'p':
|
||||||
|
mode = preen;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
force = 1;
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
mode = no;
|
||||||
|
break;
|
||||||
|
case 'y':
|
||||||
|
mode = yes;
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
block = atol(optarg);
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
verbose++;
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
/* e2fsck does not support background checking,
|
||||||
|
* hence exit with nonzero status to force
|
||||||
|
* the foreground check. */
|
||||||
|
exit(1);
|
||||||
|
case 'B':
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "%s: unknown option -%c\n",
|
||||||
|
argv[0], optopt);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (force)
|
||||||
|
cmd[i++] = "-f";
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case normal:
|
||||||
|
/* FreeBSD needs -f to force a check only in context
|
||||||
|
* with -p -- so map normal to force to match
|
||||||
|
* expectations */
|
||||||
|
if (!force)
|
||||||
|
cmd[i++] = "-f";
|
||||||
|
break;
|
||||||
|
case yes:
|
||||||
|
cmd[i++] = "-y";
|
||||||
|
break;
|
||||||
|
case no:
|
||||||
|
cmd[i++] = "-n";
|
||||||
|
break;
|
||||||
|
case preen:
|
||||||
|
cmd[i++] = "-p";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block) {
|
||||||
|
static char b[30];
|
||||||
|
|
||||||
|
sprintf(b, "-b %ld", block);
|
||||||
|
cmd[i++] = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* silently limit verbose to 15 so we don't overflow the cmd array */
|
||||||
|
if (verbose > 15)
|
||||||
|
verbose = 15;
|
||||||
|
|
||||||
|
for (t = verbose; t > 1; t--)
|
||||||
|
cmd[i++] = "-v";
|
||||||
|
|
||||||
|
while (optind < argc) {
|
||||||
|
cmd[i++] = argv[optind++];
|
||||||
|
/* sanity check so we don't overflow the cmd buffer */
|
||||||
|
if (i+1 == sizeof(cmd)/sizeof(cmd[0])) {
|
||||||
|
errno = E2BIG;
|
||||||
|
die(argv[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd[i++] = 0;
|
||||||
|
|
||||||
|
if (verbose) {
|
||||||
|
for (i=0; cmd[i]; i++)
|
||||||
|
fputs(cmd[i], stderr),
|
||||||
|
fputc(' ', stderr);
|
||||||
|
fputc('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
pid = fork();
|
||||||
|
switch (pid) {
|
||||||
|
case -1:
|
||||||
|
/* error */
|
||||||
|
die("fork");
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
/* child */
|
||||||
|
(void) execv(cmd[0], cmd);
|
||||||
|
perror("execve");
|
||||||
|
_exit(127);
|
||||||
|
default:
|
||||||
|
/* parent */
|
||||||
|
if (pid != waitpid(pid, &status, 0))
|
||||||
|
die("waitpid");
|
||||||
|
if (WIFSIGNALED(status)
|
||||||
|
|| (WIFEXITED(status) && WEXITSTATUS(status) >= 4))
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user