#!/usr/bin/env bash set -Eeuo pipefail [[ $# == 3 ]] || { echo 'usage: install-jd-pncc-runtime.sh ' >&2; exit 64; } runtime_source=$(readlink -f "$1") seed_source=$(readlink -f "$2") source_commit=$3 readonly node_id=JD-FD-PRIMARY readonly persona_id=ICE-P-ZY001 readonly human_responsibility_subject='ICE-GL∞' readonly instance_id=f3d4b730-7f02-452f-975b-7091a4800431 readonly runtime=/usr/local/libexec/guanghu/pncc-runtime.mjs readonly persona_root=/var/lib/guanghu/personas/ICE-P-ZY001/pncc readonly repository=/var/lib/guanghu/personas/ICE-P-ZY001/pncc/repository readonly state_root=/run/guanghu/pncc-install readonly receipt_root=/guanghu/recovery/JD-FD-PRIMARY-pncc-20260816 [[ $source_commit =~ ^[0-9a-f]{40}$ ]] [[ -f $runtime_source && ! -L $runtime_source ]] [[ -d $seed_source && ! -L $seed_source ]] [[ -f $seed_source/.hololake/persona/manifest.json ]] [[ $(tr A-F a-f &2 exit 1 fi [[ -z $(/usr/sbin/runuser -u guanghu -- git -C "$repository" status --porcelain --untracked-files=all) ]] inspection=$(/usr/sbin/runuser -u guanghu -- /usr/bin/node "$runtime" inspect \ --repository "$repository" --node-id "$node_id") grep -Fq '"carrierBindingState": "UNBOUND_EVIDENCE_REQUIRED"' <<<"$inspection" cycle_created=0 if [[ ! -e $repository/checkpoints/GUANGHU-PNCC-FIRST-CYCLE.hldp ]]; then rm -rf "$state_root" install -d -o guanghu -g guanghu -m 0700 "$state_root" boot_id=$(cat /proc/sys/kernel/random/boot_id) cycle=$(/usr/sbin/runuser -u guanghu -- /usr/bin/node "$runtime" cycle \ --repository "$repository" --state-root "$state_root" --node-id "$node_id" \ --boot-id "$boot_id" --request-id GUANGHU-PNCC-FIRST-CYCLE \ --source-language-anchor '把人格代码频道真正部署到京东光湖 OS,并保持人格、载体、宿主与运行系统分开举证。' \ --execution-runtime GUANGHU-OS-JD-PNCC) grep -Fq '"state": "DORMANT_AFTER_CHECKPOINT_COMMIT"' <<<"$cycle" cycle_created=1 fi [[ -z $(/usr/sbin/runuser -u guanghu -- git -C "$repository" status --porcelain --untracked-files=all) ]] git_head=$(/usr/sbin/runuser -u guanghu -- git -C "$repository" rev-parse HEAD) runtime_sha=$(sha256sum "$runtime" | awk '{print $1}') manifest_sha=$(sha256sum "$repository/.hololake/persona/manifest.json" | awk '{print $1}') cat >"$receipt_root/DEPLOYMENT-RECEIPT.hldp" <"$receipt_root/DEPLOYMENT-RECEIPT.hldp.sha256" sync printf 'GUANGHU_PNCC_INSTALLED persona=%s head=%s runtime_sha256=%s carrier=UNBOUND_EVIDENCE_REQUIRED\n' \ "$persona_id" "$git_head" "$runtime_sha"