suckless-extra

A collection of gentoo ebuilds for suckless programs as well as their dependencies and setup scripts
git clone git://git.stellar-nexus.ru/suckless-extra
Log | Files | Refs

sinit-scripts-1.0-r1.ebuild (2262B)


      1 # Copyright 2024 Gentoo Authors
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI=8
      5 
      6 inherit savedconfig
      7 
      8 DESCRIPTION="Collection of services for suckless init"
      9 HOMEPAGE="https://github.com/Andrey0189/sinit-scripts"
     10 SRC_URI="https://github.com/Andrey0189/sinit-scripts/archive/refs/heads/main.tar.gz -> ${P}.tar.gz"
     11 
     12 S="${WORKDIR}"/"$PN"-main
     13 
     14 LICENSE="MIT"
     15 SLOT="0"
     16 KEYWORDS="~amd64"
     17 
     18 DEPEND="sys-apps/sinit"
     19 RDEPEND="${DEPEND}
     20 sys-process/daemontools-encore
     21 sys-apps/littkit"
     22 
     23 PATCHES=(
     24 	"${FILESDIR}/${P}-fs-fix.diff"
     25 	"${FILESDIR}/${P}-alsa-wo-udev.diff"
     26 )
     27 
     28 src_prepare() {
     29 	default
     30 
     31 	cp -r "${FILESDIR}"/alsa-wo-udev ./var/rc/
     32 	chmod +x ./var/rc/alsa-wo-udev/run
     33 	restore_config var/rc/dtinit/dtinit.sh
     34 }
     35 
     36 src_install() {
     37 	dodir var/rc
     38 	cp -r ./var/rc "${D}"/var/
     39 	keepdir etc/rc
     40 	into /
     41 	dobin ./bin/*
     42 	dosbin ./sbin/*
     43 	save_config var/rc/dtinit/dtinit.sh
     44 }
     45 
     46 pkg_postinst() {
     47 	ln -s "${ROOT}"/sbin/sinit "${ROOT}"/sbin/init
     48 	ln -s "${ROOT}"/sbin/shutdown "${ROOT}"/sbin/reboot
     49 	ln -s "${ROOT}"/sbin/shutdown "${ROOT}"/sbin/poweroff
     50 	ln -s "${ROOT}"/var/rc/* "${ROOT}"/etc/rc/
     51 	echo
     52 	ewarn "You may need to add new services."
     53 	ewarn "To add new services run:"
     54 	ewarn "mkdir ${ROOT}/var/rc/service_name"
     55 	ewarn "touch ${ROOT}/var/rc/service_name/run # main execution script for the service."
     56 	ewarn "#Note: daemontools-encore is going to restart the service every time it finishes execution of the run file."
     57 	ewarn "#If you want to avoid this add \"lk_forever 3600\" at the end of the script."
     58 	ewarn "chmod u+x ${ROOT}/var/rc/service_name/run"
     59 	ewarn "ln -s ${ROOT}/var/rc/service_name ${ROOT}/etc/rc/"
     60 	ewarn "# Add \"log 'service_name'\" (optionally) and \"lk_runsvc ${ROOT}/etc/rc/service_name 0\" to ${ROOT}/etc/rc/dtinit/dtinit.sh"
     61 	echo
     62 	ewarn "If you have not done that already, please delete ${ROOT}/sbin/init, ${ROOT}/sbin/poweroff, ${ROOT}/sbin/reboot and ${ROOT}/sbin/shutdown before emerging this package"
     63 	ewarn "Alternatively, unmerge your current init system and emerge this package again. It is safer to do this in a chroot environment"
     64 	echo
     65 	elog " -< Succeeded. Now you can reboot >- "
     66 	echo
     67 	[ -f ${ROOT}/etc/hostname ] ||
     68 	ewarn "File ${ROOT}/etc/hostname is missing. Copy ${ROOT}/etc/localhost or create one"
     69 }