50 lines
2 KiB
Text
Executable file
50 lines
2 KiB
Text
Executable file
#!/usr/bin/false
|
|
if [ ! -e /cosmo-mini.done ]; then
|
|
: \
|
|
&& export CC=cosmocc CFLAGS="-fdiagnostics-color=always -Os -g -Wall -Wextra -Wwrite-strings -Wno-unused" \
|
|
&& acquire from=github repo=skeeto/endlessh dest=/root/endlessh env=ENDLESSH \
|
|
&& acquire from=github repo=leahneukirchen/lr dest=/root/lr env=LR \
|
|
&& acquire from=github repo=leahneukirchen/xe dest=/root/xe env=XE \
|
|
&& acquire from=github repo=cksystemsteaching/selfie dest=/root/selfie env=SELFIE \
|
|
&& acquire from=github repo=atomicobject/heatshrink dest=/root/heatshrink env=HEATSHRINK \
|
|
\
|
|
&& cd /root/endlessh \
|
|
&& shed endlessh.c \
|
|
's/\bINET6_ADDRSTRLEN\b/65/g' \
|
|
'/\bswitch (errno) {/,/default:/s/\bcase \([A-Z]\+\):/} else if (errno == \1) {/g' \
|
|
'/\bswitch (errno) {/,/default:/s/default\:/} else {/' \
|
|
's/\bswitch (errno) {/if (0) {/' \
|
|
'/ENDLESSH_VERSION/i\static const struct in6_addr in6addr_any = {0};' \
|
|
's/int fd = accept(server, 0, 0);/struct sockaddr_in dummy1; unsigned int dummy2 = sizeof(dummy1); int fd = accept(server, (struct sockaddr *)\&dummy1, \&dummy2);/' \
|
|
&& ofc endlessh.c \
|
|
\
|
|
&& cd /root/lr \
|
|
&& patch -p1 -i /vagrant/cosmo-mini/lr.patch \
|
|
&& shed lr.c \
|
|
'/_GNU_SOURCE/a\\#include "libc/dce.h"' \
|
|
's/\bnlink_t\b/uint32_t/g' \
|
|
's/\bdefined(__/&sometimes_/g' \
|
|
's/\b__linux__\b/__sometimes_linux__/g' \
|
|
'/#warning fstype/d' \
|
|
&& ofc lr.c \
|
|
\
|
|
&& cd /root/xe \
|
|
&& ofc xe.c \
|
|
\
|
|
&& cd /root/selfie \
|
|
&& shed selfie.c '/\bPAGESIZE\b/i\\#undef PAGESIZE' \
|
|
&& ofc selfie.c \
|
|
\
|
|
&& cd /root/heatshrink \
|
|
&& shed heatshrink.c '/encoder\.h/a\\#include "heatshrink_encoder.c"' \
|
|
&& shed heatshrink.c '/decoder\.h/a\\#include "heatshrink_decoder.c"' \
|
|
&& shed heatshrink_encoder.c 's/\b\(output_info\|st_yield_literal\)\b/&_e/g' \
|
|
&& shed heatshrink_decoder.c 's/\b\(output_info\|st_yield_literal\)\b/&_d/g' \
|
|
&& CFLAGS="$CFLAGS -Wno-implicit-fallthrough" ofc heatshrink.c \
|
|
\
|
|
&& cd /root \
|
|
&& mkdir -p /opt/mini \
|
|
&& install -p -m 0755 -t /opt/mini/ */*.com.dbg */*.com \
|
|
&& touch /cosmo-mini.done \
|
|
|| exit $?
|
|
fi
|