unos-repository

APK repository for unos
git clone git://git.finwo.net/misc/unos-repository
Log | Files | Refs | README

template (4908B)


      1 # Template file for 'e2fsprogs'
      2 pkgname=e2fsprogs
      3 version=1.47.4
      4 revision=0
      5 short_desc="ext2/3/4 filesystem utilities and libraries"
      6 maintainer="finwo <finwo@pm.me>"
      7 license="GPL-2.0-only, LGPL-2.0-only, BSD-3-Clause, MIT"
      8 homepage="https://e2fsprogs.sourceforge.net/"
      9 distfiles="https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v${version}/e2fsprogs-${version}.tar.xz"
     10 checksum=fd5bf388cbdbe006a3d3b318d983b2948382440acc85a87f1e7d108653e8db0b
     11 depends="glibc busybox"
     12 
     13 # Notes:
     14 # - Why this exists: without e2fsck a switch cannot repair its own root after
     15 #   an unclean shutdown, which is not a recoverable position. mke2fs is also
     16 #   what installer/install.sh formats the root partition with, so shipping this
     17 #   is what lets a UNOS image install UNOS instead of borrowing host binaries.
     18 # - libuuid/libblkid: upstream defaults these OFF, expecting util-linux to
     19 #   provide them. We do not package util-linux, and gptfdisk needs libuuid, so
     20 #   we build e2fsprogs' own copies and they become the canonical providers.
     21 # - --with-root-prefix=/usr keeps everything under /usr/{sbin,lib} rather than
     22 #   the historical /sbin + /lib split, matching glibc's --libdir=/usr/lib.
     23 # - Busybox already provides a cut-down blkid/findfs; those applets stay as
     24 #   they are. The real blkid here ships as a library, not as a second binary,
     25 #   to avoid an apk file conflict (apk refuses cross-package overwrites).
     26 
     27 do_configure() {
     28 	cd "${WRKSRC}"
     29 	# --sysconfdir=/etc is load-bearing: with a bare --prefix=/usr, autotools
     30 	# puts mke2fs.conf in /usr/etc, but mke2fs only ever reads /etc/mke2fs.conf.
     31 	# It would silently fall back to built-in defaults and ignore our config.
     32 	./configure \
     33 		--prefix=/usr \
     34 		--with-root-prefix=/usr \
     35 		--sysconfdir=/etc \
     36 		--enable-elf-shlibs \
     37 		--disable-static \
     38 		--enable-libuuid \
     39 		--enable-libblkid \
     40 		--disable-uuidd \
     41 		--disable-fsck \
     42 		--disable-debugfs \
     43 		--disable-nls \
     44 		--disable-rpath \
     45 		--disable-testio-debug
     46 }
     47 
     48 do_build() {
     49 	cd "${WRKSRC}"
     50 	make -j"$(nproc)"
     51 }
     52 
     53 do_install() {
     54 	cd "${WRKSRC}"
     55 	make install DESTDIR="${DESTDIR}"
     56 	make install-libs DESTDIR="${DESTDIR}"
     57 
     58 	# Sysroot seed: gptfdisk and smartmontools build against libuuid.
     59 	make install DESTDIR="${SYSROOT}"
     60 	make install-libs DESTDIR="${SYSROOT}"
     61 
     62 	# Shared-only (packages/README.md): no .a, no libtool turds.
     63 	rm -f "${DESTDIR}"/usr/lib/*.a "${DESTDIR}"/usr/lib/*.la
     64 	rm -f "${SYSROOT}"/usr/lib/*.a "${SYSROOT}"/usr/lib/*.la
     65 
     66 	# `blkid` and `findfs` would collide with the busybox applets of the same
     67 	# name; apk refuses cross-package file overwrites, so drop ours.
     68 	rm -f "${DESTDIR}"/usr/sbin/blkid "${DESTDIR}"/usr/sbin/findfs
     69 	rm -f "${DESTDIR}"/usr/share/man/man8/blkid.8 \
     70 	      "${DESTDIR}"/usr/share/man/man8/findfs.8
     71 
     72 	# No docs/locale in the image.
     73 	rm -rf "${DESTDIR}/usr/share/info" "${DESTDIR}/usr/share/locale"
     74 
     75 	# e2scrub drives online fsck of LVM snapshots via cron and udev. UNOS has
     76 	# none of those three, so the scripts could only ever fail confusingly.
     77 	rm -f  "${DESTDIR}"/usr/sbin/e2scrub "${DESTDIR}"/usr/sbin/e2scrub_all
     78 	rm -f  "${DESTDIR}"/etc/e2scrub.conf
     79 	rm -rf "${DESTDIR}"/etc/cron.d "${DESTDIR}"/usr/libexec
     80 	rm -f  "${DESTDIR}"/usr/share/man/man8/e2scrub.8 \
     81 	       "${DESTDIR}"/usr/share/man/man8/e2scrub_all.8 \
     82 	       "${DESTDIR}"/usr/share/man/man5/e2scrub.conf.5
     83 	# udev rules: no udev (devtmpfs + mdev territory), and upstream hardcodes
     84 	# a lib64 path that does not match our /usr/lib layout either way.
     85 	rm -rf "${DESTDIR}"/usr/lib64 "${DESTDIR}"/usr/lib/udev
     86 	# initrd helper: UNOS boots without an initrd by design (see grub.cfg.in).
     87 	rm -f  "${DESTDIR}"/usr/lib/e2initrd_helper
     88 
     89 	# compile_et/mk_cmds are build-time code generators for downstream
     90 	# consumers; they belong in the sysroot, not on a switch.
     91 	rm -f  "${DESTDIR}"/usr/bin/compile_et "${DESTDIR}"/usr/bin/mk_cmds
     92 	rm -rf "${DESTDIR}"/usr/share/et "${DESTDIR}"/usr/share/ss
     93 	rm -f  "${DESTDIR}"/usr/share/man/man1/compile_et.1 \
     94 	       "${DESTDIR}"/usr/share/man/man1/mk_cmds.1
     95 
     96 	# The whole point of the package: assert the tools the installer needs.
     97 	for t in mke2fs e2fsck resize2fs tune2fs dumpe2fs; do
     98 		[ -x "${DESTDIR}/usr/sbin/${t}" ] || die "e2fsprogs: missing ${t}"
     99 	done
    100 	# mkfs.ext4 is a symlink to mke2fs; installer/install.sh calls it by name.
    101 	[ -e "${DESTDIR}/usr/sbin/mkfs.ext4" ] || die "e2fsprogs: no mkfs.ext4"
    102 	[ -e "${DESTDIR}/usr/sbin/fsck.ext4" ] || die "e2fsprogs: no fsck.ext4"
    103 	[ -f "${SYSROOT}/usr/include/uuid/uuid.h" ] || die "e2fsprogs: no sysroot uuid.h"
    104 	[ -f "${SYSROOT}/usr/lib/pkgconfig/uuid.pc" ] || die "e2fsprogs: no sysroot uuid.pc"
    105 	# mke2fs silently uses built-in defaults if this is not where it looks.
    106 	[ -f "${DESTDIR}/etc/mke2fs.conf" ] || die "e2fsprogs: mke2fs.conf not in /etc"
    107 	[ ! -d "${DESTDIR}/usr/etc" ] || die "e2fsprogs: stray /usr/etc"
    108 	[ ! -d "${DESTDIR}/usr/lib64" ] || die "e2fsprogs: stray /usr/lib64"
    109 }