Add curl one-liner install and rebuild-before-commit note
README: install straight from git with curl | sh, and a reminder to rebuild dist/install-cabinchat.sh before every commit. Installer: usage text no longer depends on reading its own file, so --help works when piped into sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7e8d07e6c1
commit
863d30eeba
@@ -10,6 +10,15 @@ the built-in `uhttpd` web server with one small shell CGI script.
|
|||||||
|
|
||||||
## Install on the router
|
## Install on the router
|
||||||
|
|
||||||
|
Straight from git, in an SSH session on the router (`ssh root@192.168.8.1`):
|
||||||
|
|
||||||
|
curl -fsSL https://git.psuter.ch/psuter/cabinchat/raw/branch/main/dist/install-cabinchat.sh | sh
|
||||||
|
|
||||||
|
Add options after `sh -s --`, e.g. `... | sh -s -- -p 8090`. If `curl` is
|
||||||
|
missing, `wget -qO- <same URL> | sh` works too.
|
||||||
|
|
||||||
|
Or copy it over from a checkout:
|
||||||
|
|
||||||
scp -O dist/install-cabinchat.sh root@192.168.8.1:/tmp/
|
scp -O dist/install-cabinchat.sh root@192.168.8.1:/tmp/
|
||||||
ssh root@192.168.8.1 sh /tmp/install-cabinchat.sh
|
ssh root@192.168.8.1 sh /tmp/install-cabinchat.sh
|
||||||
|
|
||||||
@@ -38,6 +47,12 @@ Edit `www/`, reload the browser. Chat data lives in `data/` and photos in
|
|||||||
normal and a private window) to test private chats and typing notices. When you're happy: bump `www/VERSION`, run `sh build.sh`, copy
|
normal and a private window) to test private chats and typing notices. When you're happy: bump `www/VERSION`, run `sh build.sh`, copy
|
||||||
`dist/install-cabinchat.sh` to the router.
|
`dist/install-cabinchat.sh` to the router.
|
||||||
|
|
||||||
|
> **Before every commit, run `sh build.sh` and commit the rebuilt
|
||||||
|
> `dist/install-cabinchat.sh` together with your changes.** The built
|
||||||
|
> installer is tracked in git on purpose: the curl one-liner above installs
|
||||||
|
> whatever is in `dist/` on `main`, so a stale installer means people get an
|
||||||
|
> old version.
|
||||||
|
|
||||||
## Storage
|
## Storage
|
||||||
|
|
||||||
On the router's flash: `/www-chat/data/messages` (one line per message) and
|
On the router's flash: `/www-chat/data/messages` (one line per message) and
|
||||||
|
|||||||
Vendored
+7
-4
@@ -23,7 +23,10 @@ STAGE=/tmp/cabinchat-stage.$$
|
|||||||
info() { echo ">> $*"; }
|
info() { echo ">> $*"; }
|
||||||
warn() { echo "WARNING: $*" >&2; }
|
warn() { echo "WARNING: $*" >&2; }
|
||||||
die() { echo "ERROR: $*" >&2; rm -rf "$STAGE"; exit 1; }
|
die() { echo "ERROR: $*" >&2; rm -rf "$STAGE"; exit 1; }
|
||||||
usage() { sed -n '4,9p' "$0" | sed 's/^# \{0,1\}//'; }
|
usage() {
|
||||||
|
if [ -f "$0" ]; then sed -n '4,9p' "$0" | sed 's/^# \{0,1\}//'
|
||||||
|
else echo "usage: sh install-cabinchat.sh [-p <port> | wipe | uninstall]"; fi
|
||||||
|
}
|
||||||
|
|
||||||
listening() { netstat -tln 2>/dev/null | grep -qE "[:.]$1[[:space:]]"; }
|
listening() { netstat -tln 2>/dev/null | grep -qE "[:.]$1[[:space:]]"; }
|
||||||
|
|
||||||
@@ -46,9 +49,6 @@ remove_config() {
|
|||||||
extract_payload() {
|
extract_payload() {
|
||||||
rm -rf "$STAGE"
|
rm -rf "$STAGE"
|
||||||
mkdir -p "$STAGE" || die "cannot create $STAGE"
|
mkdir -p "$STAGE" || die "cannot create $STAGE"
|
||||||
cat > "$STAGE/VERSION" <<'__CABINCHAT_EOF__'
|
|
||||||
3.0.0
|
|
||||||
__CABINCHAT_EOF__
|
|
||||||
mkdir -p "$STAGE/cgi-bin"
|
mkdir -p "$STAGE/cgi-bin"
|
||||||
cat > "$STAGE/cgi-bin/chat" <<'__CABINCHAT_EOF__'
|
cat > "$STAGE/cgi-bin/chat" <<'__CABINCHAT_EOF__'
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
@@ -1455,6 +1455,9 @@ if (nick) { $('me').textContent = nick; loop(); } else askName(true);
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
__CABINCHAT_EOF__
|
||||||
|
cat > "$STAGE/VERSION" <<'__CABINCHAT_EOF__'
|
||||||
|
3.0.0
|
||||||
__CABINCHAT_EOF__
|
__CABINCHAT_EOF__
|
||||||
[ -f "$STAGE/index.html" ] && [ -f "$STAGE/cgi-bin/chat" ] && [ -f "$STAGE/VERSION" ] \
|
[ -f "$STAGE/index.html" ] && [ -f "$STAGE/cgi-bin/chat" ] && [ -f "$STAGE/VERSION" ] \
|
||||||
|| die "installer payload is incomplete"
|
|| die "installer payload is incomplete"
|
||||||
|
|||||||
+4
-1
@@ -23,7 +23,10 @@ STAGE=/tmp/cabinchat-stage.$$
|
|||||||
info() { echo ">> $*"; }
|
info() { echo ">> $*"; }
|
||||||
warn() { echo "WARNING: $*" >&2; }
|
warn() { echo "WARNING: $*" >&2; }
|
||||||
die() { echo "ERROR: $*" >&2; rm -rf "$STAGE"; exit 1; }
|
die() { echo "ERROR: $*" >&2; rm -rf "$STAGE"; exit 1; }
|
||||||
usage() { sed -n '4,9p' "$0" | sed 's/^# \{0,1\}//'; }
|
usage() {
|
||||||
|
if [ -f "$0" ]; then sed -n '4,9p' "$0" | sed 's/^# \{0,1\}//'
|
||||||
|
else echo "usage: sh install-cabinchat.sh [-p <port> | wipe | uninstall]"; fi
|
||||||
|
}
|
||||||
|
|
||||||
listening() { netstat -tln 2>/dev/null | grep -qE "[:.]$1[[:space:]]"; }
|
listening() { netstat -tln 2>/dev/null | grep -qE "[:.]$1[[:space:]]"; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user