Files
wekan/releases/release-bundle.sh
T
Lauri Ojansivu aeff4900df Every file the scripts write stays in .tools/: temporary files, downloads, Meteor, Node.js, npm.
build.sh and the releases/ scripts wrote all over the machine: temporary
files to /tmp and macOS's /var/folders, downloads and release zips to
~/Downloads or ~/Lataukset, Meteor to ~/.meteor, Node.js to /usr/local
(sudo n) or ~/.nvm, the npm cache to ~/.npm, Volta to ~/.volta, the
Sandstorm toolchain to ~/projects, and PATH lines into ~/.zshrc and
~/.bashrc. A sandboxed editor (Flatpak on Linux, sandbox-exec on macOS)
can reach only the checkout, and a container's own /tmp is a few hundred
megabytes. Everything is in .tools/ now, which git and Meteor ignore:

- releases/tools-env.sh, sourced by build.sh and every script that writes
  files, sets TMPDIR/TMP/TEMP to .tools/tmp (also downloads and release
  zips), NVM_DIR, npm_config_cache, VOLTA_HOME and the meteor-spk
  directory to .tools/, METEOR_WAREHOUSE_DIR to .tools/.meteor once Meteor
  is installed there, and puts those tools first on PATH, so no shell rc
  file is edited. HOME is not moved: git needs ~/.gitconfig and ~/.ssh.
  A TMPDIR already inside a .tools/ is kept, so a test's own directory
  there stays its own; without a writable one it stops rather than fall
  back to /tmp. It never fails a caller running set -euo pipefail.
- macOS's mktemp ignores TMPDIR when given no template, so every mktemp
  names one: mktemp "$TMPDIR/name.XXXXXX". Fixed /tmp files are in
  $TMPDIR.
- build.sh installs Node.js on Linux into .tools/n (N_PREFIX, no sudo),
  nvm on macOS into .tools/nvm (PROFILE=/dev/null: no rc file edited), and
  Meteor with HOME=.tools for the installer only, into .tools/.meteor.
  build.sh is replaced, not edited in place, while it may be running.
- Containers get this checkout's .tools/tmp as their /tmp: every
  db-conformance database (MariaDB's temporary tables were verified to land
  there, and MongoDB's socket) and the repack container, which empty it
  themselves before they are removed. install-node-for-arch.sh requires
  the mounted TMPDIR.
- tests/run-node-suites.cjs gives every suite TMPDIR in .tools/tmp, and the
  tests that copied a script into a fixture copy tools-env.sh too; tests
  that pinned ~/.meteor, the rc file edits, sudo n or /tmp/manifest.json
  pin the .tools/ places now and say why.

tests/toolsDirOnly.test.cjs runs tools-env.sh against a TMPDIR already
set elsewhere and under set -euo pipefail, and fails on any script that
makes a temporary file without naming .tools/tmp, writes to the home
directory, or edits a shell rc file, or on a container whose /tmp is its
own.

Thanks to xet7 !
2026-10-27 23:49:55 +02:00

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
. "$(dirname "${BASH_SOURCE[0]}")/tools-env.sh" # temporary files and downloads go to .tools/tmp
# The checkout is wherever this script is: ~/repos/wekan on Linux,
# ~/Documents/repos/wekan on macOS, Downloads\repos\wekan on Windows.
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if [ "$#" -ne 1 ]; then
echo "Usage: ./release-bundle.sh <version>"
exit 1
fi
# Downloads and release zips stay in .tools/tmp (releases/tools-env.sh), not
# in ~/Downloads or ~/Lataukset.
DOWNLOAD_DIR="${DOWNLOAD_DIR:-$WEKAN_DOWNLOADS}"
cd "$REPO_DIR"
#sudo apt-get -y install parallel
./releases/rebuild-release.sh
#./releases/delete-phantomjs.sh
cd "$REPO_DIR/.build"
zip -r wekan-$1-amd64.zip bundle
mkdir -p "$DOWNLOAD_DIR"
mv -f "wekan-$1-amd64.zip" "$DOWNLOAD_DIR/"
#{
#scp "$REPO_DIR/releases/build-bundle-arm64.sh" a:/home/wekan/
#scp "$REPO_DIR/releases/build-bundle-s390x.sh" s:/home/linux1/
#scp "$REPO_DIR/releases/build-bundle-ppc64el.sh" o:/home/ubuntu/
#scp "$REPO_DIR/releases/release-x2.sh" 20i:/data/websites/
#scp wekan-$1-amd64.zip 20i:/data/websites/releases.wekan.team/
#scp wekan-$1-amd64.zip a:/home/wekan/
#scp wekan-$1-amd64.zip s:/home/linux1/
#scp wekan-$1.zip o:/home/ubuntu/
#} | parallel -k
cd ..
#echo "x64 bundle and arm64/s390x build scripts uploaded to x2/a/s."
#echo "x64 bundle and build script uploaded to 20i."
echo "x64 bundle done: $DOWNLOAD_DIR/wekan-$1-amd64.zip"