galeb

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

чување 6b2970ff07ea454932f19bbd4539f669ed0cf4a7
родитељ 2968a5baf4f304e752031078490a27634de22141
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Fri, 15 Jul 2022 23:59:30 +0200

Scripts; add git

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

Diffstat:
M02-chroot.sh | 2++
M03-packages.sh | 185+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M04-finale.sh | 7+++++++
MTODO | 16++++++++--------
Mfil/rc.d/rc.init | 6+++---
Mfil/rc.d/rc.shutdown | 44+++++++++++++++++++++++++++++++++++---------
Alib/createlinks | 34++++++++++++++++++++++++++++++++++
Mlib/pkgs.tsv | 3++-
Alib/symlinks.tsv | 3+++
Dpat-11.2.1/perp-oasis/0001-tain_now-Use-clock_gettime.patch | 38--------------------------------------
Dpat-11.2.1/perp-oasis/0002-perpd-Restore-umask-after-perpd_control_init.patch | 47-----------------------------------------------
Dpat-11.2.1/perp-oasis/0003-Remove-pointer-arithmetic-on-void.patch | 194-------------------------------------------------------------------------------
Dpat-11.2.1/perp-oasis/0004-Remove-obsolete-files.patch | 181-------------------------------------------------------------------------------
Dpat-11.2.1/perp-oasis/0005-Remove-unused-variable.patch | 34----------------------------------
измењених датотека: 14, додавања: 279(+), брисања: 515(-)

diff --git a/02-chroot.sh b/02-chroot.sh @@ -135,6 +135,8 @@ cp_or_fail ${WD}/lib/env.sh ${GR}/lib/env.sh /bin/sed -i 's,^\(GR=\).*,\1,' ${GR}/lib/env.sh cp_or_fail ${WD}/lib/fun.sh ${GR}/lib/fun.sh cp_or_fail ${WD}/${FLD}/rc.d/g_fun.sh ${GR}/lib/g_fun.sh +cp_or_fail ${WD}/lib/createlinks ${GR}/lib/createlinks +cp_or_fail ${WD}/lib/symlinks.tsv ${GR}/lib/symlinks.tsv cp_or_fail ${WD}/lib/setperms ${GR}/lib/setperms cp_or_fail ${WD}/lib/perms.tsv ${GR}/lib/perms.tsv diff --git a/03-packages.sh b/03-packages.sh @@ -3032,6 +3032,44 @@ mkpk_install() fi end_substep +begin_substep git-2.37.1 +if [ -x /bin/git ]; then + msg info "%s exists, skipping %s" /bin/git ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe -static --static -fcommon' + LDFLAGS='-static --static -fcommon -s' + DESTDIR=/build + TAR=/tools/bin/tar + export CFLAGS LDFLAGS DESTDIR TAR + + ./configure --prefix=/ \\ + --with-gitconfig=/etc/gitconfig || exit 1 + make ${JN} || exit 1 + make DESTDIR=\${DESTDIR} perllibdir=/lib/perl5/5.32/site_perl \\ + TAR=\${TAR} install +} +! + mkpk ${pkg} + #remove_dir ${G_SRC}/${pkg} + #unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + begin_substep iproute2-5.17.0 if [ -x /bin/ss ]; then msg info "%s exists, skipping %s" /bin/ss ${pkg} @@ -3556,6 +3594,153 @@ mkpk_install() fi end_substep +# sbase lacks stty as of the making of this script, so using what is available +begin_substep stty-9.1 +if [ -x /sucks/bin/stty ]; then + msg info "%s exists, skipping %s" /sucks/bin/stty ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} coreutils-9.1 coreutils-9.1.tar.xz ${pkg} + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe -fPIC' + LDFLAGS='-s' + DESTDIR=/build + YACC=/${TLD}/bin/yacc + export CFLAGS LDFLAGS DESTDIR YACC + + if false; then + autoreconf -v + + FORCE_UNSAFE_CONFIGURE=1 \\ + ./configure --prefix=/sucks || exit 1 + fi + + CFLAGS+=' -I../lib ' + export CFLAGS + + make ${JN} || exit 1 + + # All that for one binary + mkdir -p ../build/sucks/bin + cp src/stty ../build/sucks/bin +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + +if [ -x /sucks/bin/lsblk ]; then + msg info "%s exists, skipping %s" /sucks/bin/lsblk ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz + ( + cd_or_fail ${G_SRC}/${pkg} + + apply_patch packages -Np0 -i \ + ${G_PAT}/util-linux-void/fix-musl.patch + + apply_patch packages -Np1 -i \ + ${G_PAT}/util-linux-mlfs/use-tiparm-when-compiling-\ +with-netbsd_curses.patch + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe -static --static -fcommon -fPIC' + LDFLAGS='-static --static -fcommon' + DESTDIR=/build + YACC=/${TLD}/bin/yacc + export CFLAGS LDFLAGS DESTDIR YACC + + mkdir -pv /build/var/lib/hwclock + + cp -v ${G_FIL}/util-linux-adelie/ttydefaults.h include/ + + :>config/config.rpath + :>config.h.in + + libtoolize --force || exit 1 + aclocal -I m4 || exit 1 + autoconf -v || exit 1 + automake --add-missing || exit 1 + + CFLAGS+=' -D_DIRENT_HAVE_D_TYPE ' + export CFLAGS + + NOCONFIGURE=1 ./autogen.sh || exit 1 + + ./configure \\ + --prefix=/sucks \\ + ADJTIME_PATH=/var/lib/hwclock/adjtime \\ + --docdir=/sucks/share/doc/util-linux-2.37.4 \\ + --disable-cal \\ + --disable-chfn-chsh \\ + --disable-eject \\ + --disable-fallocate \\ + --disable-hwclock \\ + --disable-kill \\ + --disable-last \\ + --disable-logger \\ + --disable-login \\ + --disable-mesg \\ + --disable-mount \\ + --disable-mountpoint \\ + --disable-nologin \\ + --disable-pivot_root \\ + --disable-setpriv \\ + --disable-su \\ + --disable-swapon \\ + --disable-switch_root \\ + --disable-runuser \\ + --disable-pylibmount \\ + --disable-unshare \\ + --disable-static \\ + --without-python \\ + --without-systemd \\ + --without-systemdsystemunitdir \\ + --sbindir=/sucks/sbin \\ + --bindir=/sucks/bin \\ + --libdir=/sucks/lib || exit 1 + + make ${JN} || exit 1 + make install-strip + + # Overlap with sbase/ubase + for prog in blkdiscard ctrlaltdel dmesg flock fsfreeze look mkswap \\ + renice rev setsid swaplabel swapoff umount + do + find /build -name \${prog} -exec rm {} \\; + done +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + begin_substep e2fsprogs-1.46.5 if [ -x /sucks/sbin/e2fsck ]; then msg info "%s exists, skipping %s" /sucks/sbin/e2fsck ${pkg} diff --git a/04-finale.sh b/04-finale.sh @@ -220,14 +220,21 @@ mkpk_install() fi end_substep +msg info "Creating symlinks" +/lib/createlinks + msg info "Setting permissions" /lib/setperms msg info "Cleaning up" +remove_file /bin/bash +remove_file /bin/stty remove_file /lib/env.sh remove_file /lib/fun.sh remove_file /bin/03-packages.sh remove_file /bin/04-finale.sh +remove_file /lib/createlinks +remove_file /lib/symlinks.tsv remove_file /lib/setperms remove_file /lib/perms.tsv diff --git a/TODO b/TODO @@ -1,13 +1,13 @@ TODO ==== -[ ] Fix init scripts - [ ] shutdown, poweroff, reboot +[~] Fix init scripts + [x] shutdown, poweroff, reboot [ ] git://r-36.net/stali-init - [ ] hwclock on shutdown + [x] hwclock on shutdown -[ ] Add packages - [ ] Add git +[~] Add packages + [x] Add git [ ] Add dhcp [ ] Add curl [ ] Add svc @@ -17,7 +17,7 @@ TODO [ ] /proc/sys/kernel/hotplug/create - Add hotplugging to Linux [ ] Remove ram disks from Linux -[ ] Fix filesystem - [ ] stty broken link to /tools/bin/stty? - [ ] Remove /bin/bash in final system +[x] Fix filesystem + [x] stty broken link to /tools/bin/stty? + [x] Remove /bin/bash in final system diff --git a/fil/rc.d/rc.init b/fil/rc.d/rc.init @@ -84,7 +84,7 @@ if [ -n "${HWCLOCK_PARAMS}" ]; then export TZ fi # ubase hwclock only has UTC support currently - hwclock ${HWCLOCK_PARAMS} /dev/rtc0 + hwclock ${HWCLOCK_PARAMS} /dev/rtc0 >/dev/null 2>&1 unset TZ fi @@ -101,9 +101,9 @@ dmesg >/var/log/dmesg.log if [ -e /proc/sys/kernel/dmesg_restrict ] && \ [ "$(cat /proc/sys/kernel/dmesg_restrict)" = "1" ] then - chmod 0666 /var/log/dmesg.log -else chmod 0644 /var/log/dmesg.log +else + chmod 0666 /var/log/dmesg.log fi if [ -x /bin/rc.modules ]; then diff --git a/fil/rc.d/rc.shutdown b/fil/rc.d/rc.shutdown @@ -8,9 +8,33 @@ umask 022 PATH=/local/bin:/bin:/sucks/bin export PATH -case "$1" in +prog=${0##*/} +param=$1 +case ${prog} in + rc.shutdown) ;; + shutdown) param=shutdown;; + poweroff) param=poweroff;; + reboot) param=reboot;; + *) msg err "Unsupported symlink" + exit 1;; +esac + +if [ "${param}" = "shutdown" ]; then + while getopts hpr opt; do + case ${opt} in + h) msg err "-h is not supported" + exit 1;; + p) param=poweroff;; + r) param=reboot;; + ?) msg err "Unsupported option" + exit 1;; + esac + done +fi + +case "${param}" in reboot|poweroff) ;; - *) msg err "Invalid action '%s'" "$1" + *) msg err "Invalid action" exit 1;; esac @@ -18,21 +42,21 @@ echo; stty onlcr msg info "Shutting down" -HWCLOCK_PARAMS='-w' +HWCLOCK_PARAMS=-w case "${HARDWARECLOCK}" in - "") ;; UTC) HWCLOCK_PARAMS="-u ${HWCLOCK_PARAMS}";; - localtime) HWCLOCK_PARAMS="-l ${HWCLOCK_PARAMS}";; - *) HWCLOCK_PARAMS='';; + localtime) ;;#HWCLOCK_PARAMS="-l ${HWCLOCK_PARAMS}";; + *) ;; esac if [ -n "${HWCLOCK_PARAMS}" ]; then msg info "Saving system clock" if [ -n "${TIMEZONE}" ]; then - TZ=${TIMEZONE} + TZ=":${TIMEZONE}" export TZ fi - hwclock ${HWCLOCK_PARAMS}/dev/rtc0 + # ubase hwclock only has UTC support currently + hwclock ${HWCLOCK_PARAMS} /dev/rtc0 >/dev/null 2>&1 unset TZ fi @@ -58,7 +82,9 @@ wait msg info "Done rc.shutdown" -case "$1" in +case "${param}" in reboot) halt -r;; poweroff) halt -p;; + *) msg err "Invalid parameter" + exit 1;; esac diff --git a/lib/createlinks b/lib/createlinks @@ -0,0 +1,34 @@ +#!/bin/sh + +. ./lib/env.sh +. ./lib/fun.sh + +symlinkdb=/lib/symlinks.tsv + +if [ ! -d /sucks ]; then + msg err "You must run this script from inside chroot" + exit 1 +elif [ "$(id -u)" -ne 0 ]; then + msg err "You must run this script as root" + exit 1 +fi + +recno=0 +( +IFS=$(printf '\n') +while read -r record +do + recno=$((recno+1)) + src=$(printf "${record}" | cut -d "$(printf '\t')" -f1) + dest=$(printf "${record}" | cut -sd "$(printf '\t')" -f2) + + if [ -z "${src}" ] || [ -z "{dest}" ]; then + msg warn "Invalid record #%d; skipping" "${recno}" + continue + fi + + msg info "ln -sf %s %s" "${src}" "${dest}" + ln -sf ${src} ${dest} +done <${symlinkdb} +) + diff --git a/lib/pkgs.tsv b/lib/pkgs.tsv @@ -4,8 +4,8 @@ git+https://github.com/mirbsd/mksh mksh-20220709 git+https://github.com/onetrueawk/awk awk-20220709 git://git.suckless.org/9base 9base-20220706 git://git.suckless.org/sbase sbase-20220709 -git://git.suckless.org/smdev smdev-20220715 git://git.suckless.org/sinit sinit-20220713 +git://git.suckless.org/smdev smdev-20220715 git://git.suckless.org/ubase ubase-20220709 git://repo.or.cz/tinycc.git tinycc-20220708 https://astron.com/pub/file/file-5.41.tar.gz 18233bb0a0089dfdc7dfbc93b96f231b @@ -76,6 +76,7 @@ https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz 12 https://libisl.sourceforge.io/isl-0.24.tar.xz libisl-0.24.tar.xz fae030f604a9537adc2502990a8ab4d1 https://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz f0adf24e8fdef5f3e332191f653e422a https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-5.13.tar.xz 3ac24e8c6fae26b801cb87ceb63c0a30 +https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.1.tar.xz 8201241ee1eca83a9f72f4505350f6bc https://musl.libc.org/releases/musl-1.2.3.tar.gz a507ae4f7f20bcfe566d8eb65c1af73e https://prdownloads.sourceforge.net/expat/expat-2.4.8.tar.xz 0584a7318a4c007f7ec94778799d72fe https://sourceforge.net/projects/procps-ng/files/Production/procps-ng-3.3.17.tar.xz d60613e88c2f442ebd462b5a75313d56 diff --git a/lib/symlinks.tsv b/lib/symlinks.tsv @@ -0,0 +1,3 @@ +/bin/rc.shutdown /bin/shutdown +/bin/rc.shutdown /bin/poweroff +/bin/rc.shutdown /bin/reboot diff --git a/pat-11.2.1/perp-oasis/0001-tain_now-Use-clock_gettime.patch b/pat-11.2.1/perp-oasis/0001-tain_now-Use-clock_gettime.patch @@ -1,38 +0,0 @@ -From dc52122121b078efbfc914ab256848cc0007c14e Mon Sep 17 00:00:00 2001 -From: Michael Forney <mforney@mforney.org> -Date: Sun, 26 Mar 2017 17:12:30 -0700 -Subject: [PATCH] tain_now: Use clock_gettime - ---- - lasagna/tain/tain_now.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/lasagna/tain/tain_now.c b/lasagna/tain/tain_now.c -index 3c790be..ba53864 100644 ---- a/lasagna/tain/tain_now.c -+++ b/lasagna/tain/tain_now.c -@@ -6,18 +6,17 @@ - - #include <stdlib.h> - #include <time.h> --#include <sys/time.h> - - #include "tain.h" - - struct tain * - tain_now(struct tain *t) - { -- struct timeval now; -+ struct timespec now; - -- gettimeofday(&now, NULL); -+ clock_gettime(CLOCK_REALTIME, &now); - tain_load_utc(t, now.tv_sec); -- t->nsec = (1000 * now.tv_usec) + 500; -+ t->nsec = now.tv_nsec; - - return t; - } --- -2.12.1 - diff --git a/pat-11.2.1/perp-oasis/0002-perpd-Restore-umask-after-perpd_control_init.patch b/pat-11.2.1/perp-oasis/0002-perpd-Restore-umask-after-perpd_control_init.patch @@ -1,47 +0,0 @@ -From dc80561853acb99cbd29e555546dfa77ac10d8e1 Mon Sep 17 00:00:00 2001 -From: Michael Forney <mforney@mforney.org> -Date: Sun, 26 Mar 2017 17:28:36 -0700 -Subject: [PATCH] perpd: Restore umask after perpd_control_init - ---- - perp/perpd.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/perp/perpd.c b/perp/perpd.c -index 2bf5553..1b29577 100644 ---- a/perp/perpd.c -+++ b/perp/perpd.c -@@ -217,8 +217,9 @@ static - void - perpd_control_init(void) - { -- int fdbase; -- int fd = -1; -+ int fdbase; -+ int fd = -1; -+ mode_t umask_orig; - - /* setup for return to base directory: */ - if((fdbase = open(".", O_RDONLY)) == -1){ -@@ -226,7 +227,7 @@ perpd_control_init(void) - } - - /* setup umask for intentional mode on file creation: */ -- umask(0); -+ umask_orig = umask(0); - - /* initialize .control directory: */ - if(mkdir(PERP_CONTROL, 0700) == -1){ -@@ -286,6 +287,9 @@ perpd_control_init(void) - } - close(fdbase); - -+ /* restore umask: */ -+ umask(umask_orig); -+ - return; - } - --- -2.12.1 - diff --git a/pat-11.2.1/perp-oasis/0003-Remove-pointer-arithmetic-on-void.patch b/pat-11.2.1/perp-oasis/0003-Remove-pointer-arithmetic-on-void.patch @@ -1,194 +0,0 @@ -From fa651ab426b8c6be7398799ebab26e87918cc5f1 Mon Sep 17 00:00:00 2001 -From: Michael Forney <mforney@mforney.org> -Date: Thu, 21 Feb 2019 23:28:17 -0800 -Subject: [PATCH] Remove pointer arithmetic on void * - ---- - lasagna/cdb/cdb_dynread.c | 2 +- - lasagna/dynbuf/dynbuf_pack.c | 2 +- - lasagna/dynbuf/dynbuf_put.c | 5 +++-- - lasagna/hdb/hdb_dynread.c | 2 +- - lasagna/ioq/ioq_put.c | 10 +++++----- - lasagna/packet/packet_write.c | 5 +++-- - perp/tinylog.c | 4 ++-- - runtools/runchoom.c | 4 ++-- - 8 files changed, 18 insertions(+), 16 deletions(-) - -diff --git a/lasagna/cdb/cdb_dynread.c b/lasagna/cdb/cdb_dynread.c -index b7135c5..f5e7ab8 100644 ---- a/lasagna/cdb/cdb_dynread.c -+++ b/lasagna/cdb/cdb_dynread.c -@@ -23,7 +23,7 @@ cdb_dynread(struct cdb *C, struct dynbuf *B, size_t len, uint32_t offset) - if(dynbuf_grow(B, len) == -1) - return -1; - -- if(cdb_read(C, dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1) -+ if(cdb_read(C, (uchar_t *)dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1) - return -1; - - dynbuf_LEN(B) += len; -diff --git a/lasagna/dynbuf/dynbuf_pack.c b/lasagna/dynbuf/dynbuf_pack.c -index 84727cb..4543a0a 100644 ---- a/lasagna/dynbuf/dynbuf_pack.c -+++ b/lasagna/dynbuf/dynbuf_pack.c -@@ -46,7 +46,7 @@ dynbuf_pack(struct dynbuf *D, const char *fmt, ...) - } - - /* with need satisfied, append directly into buf: */ -- b = (D->buf + D->p); -+ b = (uchar_t *)D->buf + D->p; - - va_start(args, fmt); - w = upak_vpack(b, fmt, args); -diff --git a/lasagna/dynbuf/dynbuf_put.c b/lasagna/dynbuf/dynbuf_put.c -index 6ff7bdb..46989c4 100644 ---- a/lasagna/dynbuf/dynbuf_put.c -+++ b/lasagna/dynbuf/dynbuf_put.c -@@ -19,10 +19,11 @@ dynbuf_putbuf(struct dynbuf *d, const void *buf, size_t len) - if(dynbuf_grow(d, (len + 1)) != 0) - return -1; /* error! */ - -- buf_copy((d->buf + d->p), buf, len); -+ b = d->buf; -+ buf_copy(b + d->p, buf, len); - - d->p += len; -- b = d->buf; b[d->p] = 'Q'; /* "offensive programming" */ -+ b[d->p] = 'Q'; /* "offensive programming" */ - - return 0; /* no error */ - } -diff --git a/lasagna/hdb/hdb_dynread.c b/lasagna/hdb/hdb_dynread.c -index cd818bc..82d20d2 100644 ---- a/lasagna/hdb/hdb_dynread.c -+++ b/lasagna/hdb/hdb_dynread.c -@@ -23,7 +23,7 @@ hdb_dynread(struct hdb *H, struct dynbuf *B, size_t len, uint32_t offset) - if(dynbuf_grow(B, len) == -1) - return -1; - -- if(hdb_read(H, dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1) -+ if(hdb_read(H, (uchar_t *)dynbuf_BUF(B) + dynbuf_LEN(B), len, offset) == -1) - return -1; - - dynbuf_LEN(B) += len; -diff --git a/lasagna/ioq/ioq_put.c b/lasagna/ioq/ioq_put.c -index 47f4897..20737a6 100644 ---- a/lasagna/ioq/ioq_put.c -+++ b/lasagna/ioq/ioq_put.c -@@ -44,7 +44,7 @@ - - - /* internal declarations: */ --static int write_all(int fd, void *buf, size_t to_write, ssize_t (*op)()); -+static int write_all(int fd, uchar_t *buf, size_t to_write, ssize_t (*op)()); - - - /* -@@ -63,13 +63,13 @@ static int write_all(int fd, void *buf, size_t to_write, ssize_t (*op)()); - */ - static - int --write_all(int fd, void *buf, size_t to_write, ssize_t (*op)()) -+write_all(int fd, uchar_t *buf, size_t to_write, ssize_t (*op)()) - { - ssize_t w = 0; - - while(to_write){ - do{ -- w = op(fd, buf, to_write); -+ w = op(fd, (void *)buf, to_write); - }while((w == -1) && (errno == EINTR)); - - if(w == -1) return -1; /* error! */ -@@ -137,7 +137,7 @@ ioq_put(ioq_t *ioq, const uchar_t *data, size_t len) - while(len > ioq->n){ - /* don't write more than len! */ - if(len < n) n = len; -- if(write_all(ioq->fd, (void *)data, n, ioq->op) == -1){ -+ if(write_all(ioq->fd, (uchar_t *)data, n, ioq->op) == -1){ - /* write() error: */ - return -1; - } -@@ -178,7 +178,7 @@ ioq_putflush(ioq_t *ioq, const uchar_t *data, size_t len) - if(ioq_flush(ioq) == -1) return -1; - - /* write() the rest */ -- return write_all(ioq->fd, (void *)data, len, ioq->op); -+ return write_all(ioq->fd, (uchar_t *)data, len, ioq->op); - } - - -diff --git a/lasagna/packet/packet_write.c b/lasagna/packet/packet_write.c -index 66c5f8c..6af6a94 100644 ---- a/lasagna/packet/packet_write.c -+++ b/lasagna/packet/packet_write.c -@@ -50,11 +50,12 @@ packet_write(int fd, const void *packet, size_t n) - { - ssize_t w = 0; - size_t to_write = n; -+ const char *b = packet; - - while(to_write > 0){ - - do{ -- w = write(fd, packet, to_write); -+ w = write(fd, b, to_write); - }while((w == -1) && (errno == EINTR)); - - if(w == -1) -@@ -63,7 +64,7 @@ packet_write(int fd, const void *packet, size_t n) - if(w == 0) - continue; - -- packet += w; -+ b += w; - to_write -= w; - } - -diff --git a/perp/tinylog.c b/perp/tinylog.c -index 8df6283..a593a66 100644 ---- a/perp/tinylog.c -+++ b/perp/tinylog.c -@@ -124,7 +124,7 @@ const char *gzip_path = NULL; - /* - ** declarations in scope: - */ --static void write_all(int fd, void *buf, size_t len); -+static void write_all(int fd, char *buf, size_t len); - static void stamp8601_make(char *stamp_buf); - static void init_logdir(struct tinylog *tinylog); - static void init_current(struct tinylog *tinylog, int resume); -@@ -182,7 +182,7 @@ ssize_t read_op(int fd, void *buf, size_t len) - */ - static - void --write_all(int fd, void *buf, size_t len) -+write_all(int fd, char *buf, size_t len) - { - ssize_t w = 0; - tain_t epause = tain_INIT(0, EPAUSE); -diff --git a/runtools/runchoom.c b/runtools/runchoom.c -index e318e2a..0682ad3 100644 ---- a/runtools/runchoom.c -+++ b/runtools/runchoom.c -@@ -59,7 +59,7 @@ static char setbuf[256]; - static char pidfmt[NFMT_SIZE]; - - /* functions in scope: */ --static int write_all(int fd, void *buf, size_t to_write); -+static int write_all(int fd, char *buf, size_t to_write); - static void do_choom(void); - - /* syserr_warn() macro: */ -@@ -77,7 +77,7 @@ static void do_choom(void); - - static - int --write_all(int fd, void *buf, size_t to_write) -+write_all(int fd, char *buf, size_t to_write) - { - ssize_t w = 0; - --- -2.20.1 - diff --git a/pat-11.2.1/perp-oasis/0004-Remove-obsolete-files.patch b/pat-11.2.1/perp-oasis/0004-Remove-obsolete-files.patch @@ -1,181 +0,0 @@ -From 365cc1632a912a7ab6ab2b4f43207b070315798a Mon Sep 17 00:00:00 2001 -From: Michael Forney <mforney@mforney.org> -Date: Thu, 21 Feb 2019 23:33:20 -0800 -Subject: [PATCH] Remove obsolete files - ---- - lasagna/ioq/iobuf_getnets.c | 104 ------------------------------------ - lasagna/ioq/iobuf_getrec.c | 50 ----------------- - 2 files changed, 154 deletions(-) - delete mode 100644 lasagna/ioq/iobuf_getnets.c - delete mode 100644 lasagna/ioq/iobuf_getrec.c - -diff --git a/lasagna/ioq/iobuf_getnets.c b/lasagna/ioq/iobuf_getnets.c -deleted file mode 100644 -index 55447ee..0000000 ---- a/lasagna/ioq/iobuf_getnets.c -+++ /dev/null -@@ -1,104 +0,0 @@ --/* --** iobuf_getnets.c --** wcm, 2004.04.28 - 2004.04.29 --** === --*/ --#include "iobuf.h" -- --#include "buf.h" --#include "dynbuf.h" -- -- --static --int --get_netslen(iobuf *ibuf, size_t *len, size_t max) --{ -- char c; -- size_t n = 0; -- int digits = 0; -- --/* --** returns length in len and: --** -3, netstring format error --** -1, io error --** 0, EOF --** 1, ok --*/ -- -- for(;;){ -- switch(iobuf_GETC(ibuf, &c)){ -- case -1: return -1; /* io error */ -- case 0: return 0; /* EOF */ -- default: break; /* ok */ -- } -- if(c == ':'){ -- if(digits){ -- *len = n; -- return 1; -- } -- else break; -- } -- if((c < '0') || (c > '9')) break; -- n = 10 * n + (c - '0'); -- if((digits && (n == 0)) || (n > max)) break; -- ++digits; -- } -- -- /* netstring format error: */ -- return -3; --} -- -- --int iobuf_getnets(iobuf *ibuf, dynbuf *b, size_t max) --{ -- int r; -- size_t len = 0; -- char *buf; -- char c; -- --/* --** returns netstring in dynbuf: --** -3, netstring format error --** -1, error (io or malloc) --** 0, EOF --** 1, ok --*/ -- -- switch(get_netslen(ibuf, &len, max)){ -- case -3: return -3; -- case -1: return -1; -- case 0: return 0; -- default: break; -- } -- -- if(dynbuf_grow(b, len) != 0) -- return -1; /* malloc error */ -- -- buf = dynbuf_BUF(b); -- while(len){ -- r = iobuf_get(ibuf, buf, len); -- switch(r){ -- case -1: return -1; /* io error */ -- case 0: return -3; /* eof before complete */ -- default: break; -- } -- dynbuf_LEN(b) += r; -- if(r == len) break; -- /* else: */ -- buf += r; -- len -= r; -- } -- -- /* so far, so good; now comma? */ -- switch(iobuf_GETC(ibuf, &c)){ -- case -1: return -1; /* io error */ -- case 0: return -3; /* eof before comma */ -- default: break; -- } -- if(c != ',') return -3; -- -- /* success: */ -- return 1; --} -- --/* that's all, folks! */ -diff --git a/lasagna/ioq/iobuf_getrec.c b/lasagna/ioq/iobuf_getrec.c -deleted file mode 100644 -index 6462452..0000000 ---- a/lasagna/ioq/iobuf_getrec.c -+++ /dev/null -@@ -1,50 +0,0 @@ --/* --** iobuf_getrec.c --** wcm, 2004.04.28 - 2004.04.29 --** === --*/ --#include "iobuf.h" -- --#include "buf.h" --#include "dynbuf.h" -- --int iobuf_getrec(iobuf *ibuf, dynbuf *b, int sep) --{ -- int r; -- int n; -- char *x; -- --/* --** returns: --** -1, error (io or malloc) --** 0, EOF --** 1, ok --*/ -- -- for(;;){ -- r = iobuf_feed(ibuf); -- if(r <= 0) return r; /* EOF (0) or io error (-1) */ -- -- x = (char *)iobuf_PEEK(ibuf); -- n = buf_ndx(x, r, sep); -- if(n < r){ /* sep found */ -- if(dynbuf_putbuf(b, x, n) == 0) { /* ok */ -- /* strip contents out of ibuf */ -- iobuf_SEEK(ibuf, (n+1)); -- /* success: */ -- return 1; -- } -- else /* dynbuf malloc failure: */ -- return -1; -- } -- /* else: */ -- if(dynbuf_grow(b, r) != 0) -- return -1; -- dynbuf_LEN(b) += iobuf_get(ibuf, dynbuf_BUF(b)+dynbuf_LEN(b), r); -- } -- -- /* not here: */ -- return -1; --} -- --/* that's all, folks! */ --- -2.20.1 - diff --git a/pat-11.2.1/perp-oasis/0005-Remove-unused-variable.patch b/pat-11.2.1/perp-oasis/0005-Remove-unused-variable.patch @@ -1,34 +0,0 @@ -From 2cc852e07038ee17d56ec6a54ae9b1c19b598289 Mon Sep 17 00:00:00 2001 -From: Michael Forney <mforney@mforney.org> -Date: Thu, 21 Feb 2019 23:57:15 -0800 -Subject: [PATCH] Remove unused variable - ---- - perp/perpd_svdef.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/perp/perpd_svdef.c b/perp/perpd_svdef.c -index 82fb0a0..7b5e87f 100644 ---- a/perp/perpd_svdef.c -+++ b/perp/perpd_svdef.c -@@ -186,7 +186,7 @@ void - perpd_svdef_checkfail(struct svdef *svdef) - { - struct subsv *subsv; -- int target, r = 0; -+ int target; - - /* insanity? */ - if(!(svdef->bitflags & SVDEF_FLAG_ACTIVE)) -@@ -201,7 +201,7 @@ perpd_svdef_checkfail(struct svdef *svdef) - subsv = (svdef->bitflags & SVDEF_FLAG_HASLOG) ? &svdef->svpair[SUBSV_LOG] : NULL; - if((subsv != NULL) && (subsv->bitflags & SUBSV_FLAG_FAILING)){ - target = (subsv->bitflags & SUBSV_FLAG_ISRESET) ? SVRUN_RESET : SVRUN_START; -- r = perpd_svdef_run(svdef, SUBSV_LOG, target); -+ perpd_svdef_run(svdef, SUBSV_LOG, target); - } - - /* XXX, bail here if log is failing? */ --- -2.20.1 -