Files
Mycelium-ui-private/scripts/fetch-mycelium.sh
syoul 8b83fc10d5 fork: initialize Mycellium UI Private from Mycell-UI@5229e2c
This repo is a hard fork of mycellium-ui dedicated to the
mycelium-private experimental track upstream. The two apps coexist
on the same machine via distinct app identifiers, polkit actions,
and binary names.

Renames
- package + crate: mycellium-ui → mycellium-ui-private
- bundle identifier: tech.threefold.mycellium-ui-private
- daemon binary: mycelium-private (separate upstream release tarball)
- bootstrap wrapper: /usr/bin/mycellium-bootstrap-private
- polkit policy file + action id

Functional changes
- SidecarConfig.network_name field (UTF-8, 2..=64 bytes)
- start() refuses to spawn without a network name AND a 32-byte
  key file at app_data_dir/network_key.bin; surfaces a clear
  error rather than letting mycelium-private fail mid-startup
- network_key_status / generate / import / export / delete
  commands; uses OS RNG (rand) and writes 0600
- empty default peers list (no Threefold seed for private overlays)
- new Settings → Private network panel: name input, key generate /
  reveal-hex / import / delete, status indicator

Adapted bootstrap script kills both `mycelium` and
`mycelium-private` orphans (cross-clash on UDP/9650 + TCP/8990).

CI workflow + sidebar branding updated. The README explains the
divergence model and how to cherry-pick upstream fixes.
2026-04-27 01:37:07 +02:00

66 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Fetches the official mycelium-private release binary and places it in
# src-tauri/binaries/ with the target-triple suffix expected by Tauri's
# externalBin bundler.
#
# Usage: scripts/fetch-mycelium.sh [VERSION]
# VERSION defaults to MYCELIUM_VERSION below.
MYCELIUM_VERSION="${1:-${MYCELIUM_VERSION:-v0.6.1}}"
REPO="threefoldtech/mycelium"
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DEST_DIR="${ROOT_DIR}/src-tauri/binaries"
mkdir -p "${DEST_DIR}"
detect_target_triple() {
local arch os
arch="$(uname -m)"
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "${os}-${arch}" in
linux-x86_64) echo "x86_64-unknown-linux-gnu" ;;
linux-aarch64) echo "aarch64-unknown-linux-gnu" ;;
*) echo "unsupported: ${os}-${arch}" >&2; exit 1 ;;
esac
}
# Map our target triple to the asset name pattern used by upstream releases.
asset_for_triple() {
case "$1" in
x86_64-unknown-linux-gnu) echo "mycelium-private-x86_64-unknown-linux-musl.tar.gz" ;;
aarch64-unknown-linux-gnu) echo "mycelium-private-aarch64-unknown-linux-musl.tar.gz" ;;
*) echo "unsupported triple: $1" >&2; exit 1 ;;
esac
}
TRIPLE="$(detect_target_triple)"
ASSET="$(asset_for_triple "${TRIPLE}")"
URL="https://github.com/${REPO}/releases/download/${MYCELIUM_VERSION}/${ASSET}"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "${TMP_DIR}"' EXIT
echo "→ downloading ${URL}"
curl -fsSL "${URL}" -o "${TMP_DIR}/mycelium-private.tar.gz"
echo "→ extracting"
tar -xzf "${TMP_DIR}/mycelium-private.tar.gz" -C "${TMP_DIR}"
# The archive contains a single 'mycelium-private' binary at the root.
SRC="${TMP_DIR}/mycelium-private"
if [[ ! -f "${SRC}" ]]; then
SRC="$(find "${TMP_DIR}" -name 'mycelium-private' -type f -executable | head -n1)"
fi
if [[ -z "${SRC}" || ! -f "${SRC}" ]]; then
echo "could not locate mycelium-private binary in archive" >&2
exit 1
fi
DEST="${DEST_DIR}/mycelium-private-${TRIPLE}"
install -m 0755 "${SRC}" "${DEST}"
echo "✓ installed ${DEST}"
echo " version: ${MYCELIUM_VERSION}"
echo " size: $(stat -c%s "${DEST}") bytes"