xrsh/make

58 lines
1.6 KiB
Text
Raw Normal View History

2023-11-01 11:21:41 +01:00
#!/bin/sh
REDBEAN_VERSION=https://redbean.dev/redbean-2.2.com
2023-12-18 09:54:52 +01:00
APP=xrsh
2024-05-22 08:23:56 +00:00
DIR=$(dirname $(readlink -f $0))
2023-11-01 11:21:41 +01:00
export PATH=$PATH:.
silent(){ "$@" 1>/dev/null 2>/dev/null; }
2024-08-30 12:09:45 +02:00
deps(){ # check dependencies
2023-11-01 11:21:41 +01:00
echo "[v] checking dependencies "
test -f ${APP}.com || {
wget "$REDBEAN_VERSION" -O ${APP}.com
chmod +x ${APP}.com
}
}
2024-08-30 12:09:45 +02:00
standalone(){ # build standalone xrsh.com binary
2024-07-29 11:12:40 +02:00
rm ${APP}.com || true
2024-09-24 11:05:12 +00:00
deps
cp index.html /tmp/index.html
sed -i 's|isoterminal=".*"|isoterminal="iso: ./../xrsh.iso"|g' index.html
zip -x "*.git*" -r ${APP}.com index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,core.js}
cp /tmp/index.html index.html
2024-07-29 11:12:40 +02:00
sha256sum ${APP}.com > ${APP}.txt
ls -lah ${APP}.com
2023-11-01 11:21:41 +01:00
}
2024-08-30 12:09:45 +02:00
dev(){ # start dev http server
2024-05-22 08:23:56 +00:00
cd "$DIR"
2024-08-02 16:15:23 +00:00
test -f xrsh.com || standalone
2024-08-06 16:50:51 +02:00
test -f /tmp/cert.pem || openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /tmp/key.pem -out /tmp/cert.pem
2024-08-02 16:15:23 +00:00
./xrsh.com -c 0 -C /tmp/cert.pem -K /tmp/key.pem -D . "$@"
2023-11-01 11:21:41 +01:00
}
2024-08-30 12:09:45 +02:00
shell(){ # run xrsh shell via docker
OCI=$(which podman || which docker)
set -x
$OCI rm -f xrsh || true
$OCI run --name xrsh -d \
-v ./src/com/isoterminal/mnt:/mnt busybox:1.31.1-musl tail -f /dev/null
$OCI exec -it xrsh /bin/sh -i -c 'ln -s /mnt/profile /etc/profile && sh --login'
}
2024-08-30 12:09:45 +02:00
recordings(){ # compile vhs recordings
2024-08-26 19:57:35 +00:00
export PATH=$PATH:src/com/isoterminal/mnt
export BROWSER=0
test -z $1 && find src/tests/vhs/* | xargs -n1 vhs
test -z $1 || vhs $1
}
2024-08-30 12:09:45 +02:00
usage(){
echo "Usage:"
awk '/\(\){ #/ { gsub(/\(\){ #/," <----",$0); print " ./make "$0 }' $0
}
test -z $1 && usage
2023-11-01 11:21:41 +01:00
test -z $1 || "$@"