77.5. snooze-0.6
Runs a command at a given time — one process per job in place of a cron daemon
| Version | 0.6, release 1 |
| Shelf | base — The minimal userland and system daemons that every KDOS image boots with |
| Phase | 41_system (System), 198 of 1047 in build order |
| Licence | CC0-1.0 |
| Homepage | https://github.com/leahneukirchen/snooze |
| Build time | 0.1 SBU |
| Installed size | 24.8 KiB in 2 files |
| Recipe | ports/core/base/snooze/kpkgbuild |
About
snooze is a single small program that sleeps until the clock matches the time given in its options, runs one command, and exits. The periodic jobs KDOS ships run under no cron daemon: each is one snooze, started by the ksvc supervisor, which restarts it after every run so it sleeps again until the next slot (see No systemd). A cron daemon, crond, does run, but only for users’ own crontabs (crontab -e); it reads no /etc/crontab, so no job is in both.
- System timers. At boot
/etc/init.d/18_timers.shstarts one supervisedsnoozeper line of/etc/kdos/timers.d/*.timer; the shipped ones run the update check andfstrim -a. - Per-user timers. Each user session’s
timersservice runs the lines of/etc/kdos/user-services/timers.dand~/.config/kdos/timers.d, each in a loop of its own aroundsnooze. - Reminders.
kdos remindwrites each reminder as a file in~/.config/kdos/timers.d, so it survives a logout, and tells the running timer service to read that directory again.
The format of a timer line, and how a missed slot is caught up with -s and -t, is in Periodic jobs.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/base.txt:
Periodic jobs. snooze is one process per job under ksvc rather than a cron daemon with its own scheduler — it fits the supervisor KDOS already has.
Sources
snooze-0.6.tar.gz(8.4 KiB)
sha2563a4a2f3f00d42e30647d9af79c8e417990ced6c3f0565474b1ca717938b1e2ab
upstream: https://github.com/leahneukirchen/snooze/archive/v0.6/snooze-0.6.tar.gz
archive copy: sources-1/base--snooze-0.6.tar.gz
Dependencies
Depends on: nothing a recipe names.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install snooze'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base/snooze.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/base/snooze
echo '3a4a2f3f00d42e30647d9af79c8e417990ced6c3f0565474b1ca717938b1e2ab snooze-0.6.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/snooze
SRC=$SRC_ROOT/snooze-0.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf snooze-0.6.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
make PREFIX=/usr CFLAGS="$CFLAGS"
make PREFIX=/usr DESTDIR=$PKG install
The switches, and why each is set:
PREFIX=/usr— The Makefile has no configure step and installs under/usr/localby default; this putssnoozein/usr/binand its manual page in/usr/share/man/man1.CFLAGS="$CFLAGS"— Replaces the Makefile’s ownCFLAGS = -g -O2 -Wall -Wextra -Wwrite-stringswith the tree’s release flags. A variable on themakecommand line overrides the Makefile’s assignment; the environment alone would not.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/snooze, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf snooze-0.6-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/snooze, and runs the triggers its paths call for.
Contents
Installed programs: snooze.
Short descriptions
snooze |
run a command at a particular time |