pkgname=fds-base-files
version=$(cat "${XBPS_DISTDIR}/fds-version")
revision=1
archs="aarch64"
depends="xbps-triggers"
conflicts="base-files>=0 base-system>=0 runit>=0 runit-void>=0 systemd>=0 busybox>=0 musl>=0"
short_desc="FDS/OS filesystem layout, identity and base configuration"
maintainer="FDS/OS maintainers"
license="Public Domain"
homepage="https://github.com/void-linux/void-packages"
conf_files="/etc/hostname /etc/hosts /etc/passwd /etc/group /etc/shadow
 /etc/gshadow /etc/profile /etc/nsswitch.conf /etc/fstab /etc/issue
 /etc/locale.conf /etc/xbps.d/10-fds.conf"
# Upstream reserves root-level usr-merge links for its own base-files package.
# Ship an explicit layout manifest and apply it in the FDS image assembler.
do_install() {
	vinstall "${FILESDIR}/layout.json" 644 usr/share/fds
	for f in hostname hosts passwd group profile nsswitch.conf fstab issue locale.conf; do
		vinstall "${FILESDIR}/${f}" 644 etc
	done
	for f in shadow gshadow; do
		vinstall "${FILESDIR}/${f}" 600 etc
	done
	vinstall "${FILESDIR}/os-release" 644 usr/lib
	sed -i "s/@FDS_VERSION@/${version}/g" "${DESTDIR}/usr/lib/os-release" "${DESTDIR}/etc/issue"
	ln -s ../usr/lib/os-release "${DESTDIR}/etc/os-release"
	ln -s /run/fds/resolv.conf "${DESTDIR}/etc/resolv.conf"
	ln -s /proc/self/mounts "${DESTDIR}/etc/mtab"
	ln -s ../usr/share/zoneinfo/Etc/UTC "${DESTDIR}/etc/localtime"
	vinstall "${FILESDIR}/10-fds.conf" 644 etc/xbps.d
}
