#!/bin/sh REDBEAN_VERSION=https://redbean.dev/redbean-2.2.com APP=xrsh DIR=$(dirname $(readlink -f $0)) export PATH=$PATH:. silent(){ "$@" 1>/dev/null 2>/dev/null; } install(){ echo "[v] checking dependencies " test -f ${APP}.com || { wget "$REDBEAN_VERSION" -O ${APP}.com chmod +x ${APP}.com } standalone } standalone(){ test -f ${APP}.com || install cd src set -x zip -x "*.git*" -r ../${APP}.com * ls -lah ../${APP}.com } dev(){ test -d src/xrsh-apps || git submodule update --init --recursive cd /tmp test -f redbean.com || wget "$REDBEAN_VERSION" -O redbean.com && chmod 755 redbean.com test -f cert.pem || openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem cd - cd "$DIR" /tmp/redbean.com -c 0 -C /tmp/cert.pem -K /tmp/key.pem -D . "$@" } test -z $1 && install test -z $1 || "$@"