A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
packaging: give dpkg-shlibdeps its control file, stage installs privately, download the updater before running it
RoversXdf01b44df4fc
diff --git a/ci/deploy.sh b/ci/deploy.shindex 2a97fead..3f70871d 100755--- a/ci/deploy.sh+++ b/ci/deploy.sh@@ -490,9 +490,15 @@ EOFinstall -Dm644 assets/wezterm-nautilus.py $root/usr/share/nautilus-python/extensions/wezterm-nautilus.pyfi- # dpkg-shlibdeps wants to run from the directory holding debian/.+ # dpkg-shlibdeps reads source control information at debian/control,+ # separately from the binary package's DEBIAN/control.+ {+ printf 'Source: thinkterm\nMaintainer: RoversX\n\n'+ cat "$root/DEBIAN/control"+ } > "$root/control"local depsdeps=$(cd "pkg/$variant" && dpkg-shlibdeps -O -e debian/usr/bin/*)+ rm "$root/control"echo $deps | sed -e 's/shlibs:Depends=/Depends: /' >> $root/DEBIAN/controlcat $root/DEBIAN/controldiff --git a/install.sh b/install.shindex c3bfff93..f8bf23fb 100755--- a/install.sh+++ b/install.sh@@ -317,11 +317,12 @@ fi# ---- download and verify ---------------------------------------------------tmp=$(mktemp -d "${TMPDIR:-/tmp}/thinkterm-install.XXXXXX")-# Staged files all live next to their destination as .<name>.tmp, so the trap-# can find them without a list that a prefix containing spaces would break.+# Linux binaries are staged on the destination filesystem, in a directory+# owned by this invocation. Never glob temporary files in the shared bin/.+bin_stage=""cleanup() {rm -rf "$tmp"- rm -f "$bindir"/.*.tmp 2>/dev/null || true+ [ -z "$bin_stage" ] || rm -rf "$bin_stage" 2>/dev/null || true[ -z "$app_dir" ] || rm -rf "$app_dir/.ThinkTerm.app.tmp" 2>/dev/null || true[ -z "$app_dir" ] || rm -rf "$app_dir/.ThinkTerm.app.old" 2>/dev/null || true}@@ -491,10 +492,11 @@ else# existing install untouched, the rename is atomic so no reader ever sees# a half-written binary, and a running thinkterm-mux-server keeps its old# inode. Paths are not word-split into a list: a prefix may contain spaces.+ bin_stage=$(mktemp -d "$bindir/.thinkterm-install.XXXXXX")for f in "$src_bin"/*; doname=$(basename "$f")- cp "$f" "$bindir/.$name.tmp"- chmod 755 "$bindir/.$name.tmp"+ cp "$f" "$bin_stage/$name"+ chmod 755 "$bin_stage/$name"done# The variants are mutually exclusive: same CLI, same mux server, and only@@ -514,7 +516,7 @@ elsefor f in "$src_bin"/*; doname=$(basename "$f")- mv -f "$bindir/.$name.tmp" "$bindir/$name"+ mv -f "$bin_stage/$name" "$bindir/$name"say " $bindir/$name"donediff --git a/thinkterm-update/src/lib.rs b/thinkterm-update/src/lib.rsindex f242790e..9b63afc1 100644--- a/thinkterm-update/src/lib.rs+++ b/thinkterm-update/src/lib.rs@@ -296,10 +296,16 @@ pub fn is_newer_release(latest: &str, current: &str) -> bool {/// `~/.local/bin` goes on PATH first because a non-interactive ssh shell does/// not source the files that would add it, and the script's PATH reminder is/// aimed at a person reading a terminal.+/// Download to a private temporary file first: a failed or partial download+/// must never execute or look like a successful install to the restart UI.pub fn install_command(variant: &str, version: &str) -> String {format!(- "export PATH=\"$HOME/.local/bin:$PATH\"; \- curl -fsSL {INSTALL_SCRIPT_URL} | sh -s -- --{variant} --version {version}"+ "(export PATH=\"$HOME/.local/bin:$PATH\"; \+ installer=$(mktemp \"${{TMPDIR:-/tmp}}/thinkterm-update.XXXXXX\") || exit 1; \+ trap 'rm -f \"$installer\"' EXIT; \+ trap 'exit 130' INT; trap 'exit 143' TERM; \+ curl -fsSL -o \"$installer\" {INSTALL_SCRIPT_URL} && \+ sh \"$installer\" --{variant} --version {version})")}@@ -465,4 +471,36 @@ mod tests {assert!(cmd.contains("--server --version 0.2.0"), "{cmd}");assert!(cmd.contains(INSTALL_SCRIPT_URL), "{cmd}");}++ #[cfg(unix)]+ #[test]+ fn remote_installer_requires_a_complete_download_and_preserves_exit_status() {+ let dir = tempfile::tempdir().unwrap();+ let marker = dir.path().join("executed");+ for (download, expected_status, executed) in [+ ("return 22;", 22, false),+ (+ r#"printf '%s\n' 'printf executed > "$THINKTERM_UPDATE_TEST_MARKER"; exit 7' > "$3"; return 22;"#,+ 22,+ false,+ ),+ (+ r#"printf '%s\n' 'printf executed > "$THINKTERM_UPDATE_TEST_MARKER"; exit 7' > "$3"; return 0;"#,+ 7,+ true,+ ),+ ] {+ let status = std::process::Command::new("sh")+ .arg("-c")+ .arg(format!(+ "curl() {{ {download} }}\n{}",+ install_command("server", "0.2.0")+ ))+ .env("THINKTERM_UPDATE_TEST_MARKER", &marker)+ .status()+ .unwrap();+ assert_eq!(status.code(), Some(expected_status));+ assert_eq!(marker.exists(), executed);+ }+ }}