galeb

Једноставна статичка дистрибуција заснована на musl-у
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 551b07f5eb484fa12b8dfebd123d1f9b697427b5
родитељ e448a0293e3cf502b2a2454e0af016e11f7ddfc1
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Wed, 20 Jul 2022 21:41:06 +0200

Patch watch, respawn, sdhcp; add gettyc instead of logout; add doas.conf

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M02-chroot.sh | 2+-
M03-packages.sh | 15++++++++++++++-
M04-finale.sh | 7++++---
MBUGS | 2--
MTODO | 19+++++++++++--------
Mfil/rc.d/profile | 4----
Mfil/rc.d/rc.init | 2+-
Mlib/perms.tsv | 3+++
Apat/ubase-galeb/respawn-clear-screen.patch | 13+++++++++++++
Apat/ubase-galeb/watch-react-to-ctrlc.patch | 37+++++++++++++++++++++++++++++++++++++
Asrc/gettyc | 6++++++
измењених датотека: 11, додавања: 90(+), брисања: 20(-)

diff --git a/02-chroot.sh b/02-chroot.sh @@ -120,9 +120,9 @@ cp_or_fail ${WD}/lib/rmlist.tsv ${GR}/lib/rmlist.tsv check_dir ${G_SRC}/galeb-utils-20220717 cp_or_fail ${WD}/src/remountroot.c ${G_SRC}/galeb-utils-20220717/remountroot.c cp_or_fail ${WD}/src/umountall.c ${G_SRC}/galeb-utils-20220717/umountall.c +cp_or_fail ${WD}/src/gettyc ${GR}/bin/gettyc cp_or_fail ${WD}/${FLD}/rc.d/profile ${GR}/etc/profile.final -cp_or_fail ${WD}/${FLD}/rc.d/logout ${GR}/etc/logout cp_or_fail ${WD}/${FLD}/rc.d/mkshrc ${GR}/etc/mkshrc cp_or_fail ${WD}/${FLD}/rc.d/rc.conf ${GR}/etc/rc.conf cp_or_fail ${WD}/${FLD}/rc.d/rc.init ${GR}/bin/rc.init diff --git a/03-packages.sh b/03-packages.sh @@ -4198,6 +4198,9 @@ else ( cd_or_fail ${G_SRC}/${pkg} + apply_patch packages -Np0 -i \ + ${G_PAT}/sdhcp-galeb/sdhcp-pid-file.patch + cat <<! >MKPK mkpk_name() { @@ -4477,6 +4480,16 @@ mkpk_install() make ${JN} || exit 1 make install + + mkdir -p ../build/etc + + # Adjust as necessary + cat <<@ >../build/etc/doas.conf +deny root +permit nopass :wheel +@ + + chmod 4755 ../build/bin/doas } ! mkpk ${pkg} @@ -4543,7 +4556,7 @@ fi end_substep begin_substep tmux-3.3a -if [ -x /bin/tmux/ ]; then +if [ -x /bin/tmux ]; then msg info "%s exists, skipping %s" /bin/tmux ${pkg} elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then unpack_pkg ${pkg} / diff --git a/04-finale.sh b/04-finale.sh @@ -173,7 +173,8 @@ else apply_patch finale -Np1 -i \ ${G_PAT}/ubase-galeb/getty_show_issue.patch - + apply_patch finale -Np1 -i \ + ${G_PAT}/ubase-galeb/watch-react-to-ctrlc.patch cat <<! >MKPK mkpk_name() { @@ -241,8 +242,8 @@ mkpk_name() mkpk_install() { - cp -r bin ../build/ - cp -r svc.d ../build/bin/ + cp -R bin ../build/ + cp -R svc.d ../build/bin/ mkdir -p ../build/share/doc/${pkg} cp README.md ../build/share/doc/${pkg}/ } diff --git a/BUGS b/BUGS @@ -14,5 +14,3 @@ Known bugs/Errata be fully functional from that point on, due to sbase/ubase/9base utilities having only a subset of options of coreutils etc. You can revert this by uninstalling sbase, ubase and 9base. - -* mksh exits the current shell when Ctrl-C is pressed. (TODO: Fix.) diff --git a/TODO b/TODO @@ -22,9 +22,11 @@ TODO [x] hwclock on shutdown [x] shutdown as regular user (remount / ro) -[ ] Fix mksh Ctrl-C bug - -[ ] Patch sdhcp +[~] Linux + [ ] Random number generator + [x] /proc/sys/kernel/hotplug/create - Add hotplugging to Linux + - Still doesn't make available the required pseudofile + [x] Remove ram disks from Linux [~] Add packages [ ] git://r-36.net/nldev @@ -59,17 +61,18 @@ Low priority Done ---- +[x] Patch sdhcp + [x] Fix dcron [x] crontab -e doesn't respect EDITOR? - export. -[x] Linux - [x] /proc/sys/kernel/hotplug/create - Add hotplugging to Linux - - Still doesn't make available the required pseudofile - [x] Remove ram disks from Linux - [x] Fix filesystem [x] stty broken link to /tools/bin/stty? [x] Remove /bin/bash in final system [x] suid/sgid doesn't get preserved? +[x] Fix mksh Ctrl-C bug + - Could be to /etc/logout's trap '...; exit' - check! + - Yes. Also ubase's watch needed a patch to respond to Ctrl-C. + diff --git a/fil/rc.d/profile b/fil/rc.d/profile @@ -19,7 +19,3 @@ lc() if [ -e /etc/mkshrc ]; then . /etc/mkshrc fi - -trap '[ -e ${HOME}/.mksh_logout ] && . ${HOME}/.mksh_logout;'\ -' [ -e /etc/logout ] && . /etc/logout; exit' \ - HUP INT QUIT TERM EXIT KILL diff --git a/fil/rc.d/rc.init b/fil/rc.d/rc.init @@ -119,5 +119,5 @@ unset PATH echo for n in 1 2 3 4; do - /bin/sh -c '/bin/respawn /bin/getty /dev/tty'$n' linux' &>/dev/null & + /bin/respawn /bin/gettyc /dev/tty$n linux >/dev/null 2>&1 & done diff --git a/lib/perms.tsv b/lib/perms.tsv @@ -1,11 +1,14 @@ Path Mode Owner Group /bin/mksh 555 root bin /bin/lksh 555 root bin +/bin/doas 4755 root root /bin/su 4555 root root /bin/crond 4700 root root /bin/crontab 4750 root cron +/bin/gettyc 555 root root /bin/halt 500 root root /bin/killall5 500 root root +/etc/doas.conf 640 root root /var/log 775 root metalog /var/log/lastlog 664 root utmp /var/log/btmp 600 root utmp diff --git a/pat/ubase-galeb/respawn-clear-screen.patch b/pat/ubase-galeb/respawn-clear-screen.patch @@ -0,0 +1,13 @@ +diff --git a/respawn.c b/respawn.c +index 7fdd1ec..ee37333 100644 +--- a/respawn.c ++++ b/respawn.c +@@ -107,6 +107,8 @@ main(int argc, char *argv[]) + } + if (!fifo) + sleep(delay); ++ /* Clear screen */ ++ printf("\x1b[2J\x1b[H"); + } + /* not reachable */ + return 0; diff --git a/pat/ubase-galeb/watch-react-to-ctrlc.patch b/pat/ubase-galeb/watch-react-to-ctrlc.patch @@ -0,0 +1,37 @@ +diff --git a/watch.c b/watch.c +index 51ac67f..1e5a311 100644 +--- a/watch.c ++++ b/watch.c +@@ -3,6 +3,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <unistd.h> ++#include <signal.h> + + #include "util.h" + +@@ -12,6 +13,14 @@ usage(void) + eprintf("usage: %s [-t] [-n interval] command\n", argv0); + } + ++static int running = 1; ++ ++void ++ctrlc(int args) ++{ ++ running = 0; ++} ++ + int + main(int argc, char *argv[]) + { +@@ -48,7 +57,8 @@ main(int argc, char *argv[]) + eprintf("command too long\n"); + } + +- for (;;) { ++ signal(SIGINT, ctrlc); ++ while (running) { + printf("\x1b[2J\x1b[H"); /* clear */ + fflush(NULL); + system(cmd); diff --git a/src/gettyc b/src/gettyc @@ -0,0 +1,6 @@ +#!/bin/sh +tty=$1 +trap 'exit 0' TERM KILL +/bin/getty "$@" +/bin/sleep 1 # to see login errors; comment out if not desirable +/bin/printf "\x1b[2J\x1b[H" >${tty}