init_env.sh
AArch64 (ARM64) architecture stringMake install clean command
SHA-256cf5f03bd96c9057589bb1f4a403275500caf557f535c7f68a2e0d6e98e6db222
Evidence
1#!/usr/bin/env bash
2
3# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/gojue/ecapture/master/builder/init_env.sh)"
4
5set -euo pipefail
6
7echo "Welcome to eCapture project development environment initialization script."
8echo "Home page: https://ecapture.cc"
9echo "Github: https://github.com/gojue/ecapture"
10
11if [[ "$(uname -s)" != Linux || ! -r /etc/os-release ]]; then
12 echo "Environment initialization requires supported Ubuntu or Debian Linux." >&2
13 exit 1
14fi
15# shellcheck disable=SC1091
16source /etc/os-release
17if [[ "${ID:-}" != ubuntu && "${ID:-}" != debian ]]; then
18 echo "Environment initialization requires Ubuntu or Debian; found ${PRETTY_NAME:-unknown}." >&2
19 exit 1
20fi
21
22case "$(uname -m)" in
23 x86_64) host_arch=amd64; minimum_kernel=4.18 ;;
24 aarch64|arm64) host_arch=arm64; minimum_kernel=5.5 ;;
25 loongarch64|loong64) host_arch=loong64; minimum_kernel=6.6 ;;
26 *) echo "Unsupported …
26:30… host architecture: $(uname -m)" >&2; exit 1 ;;
27esac
28host_kernel=$(uname -r | cut -d- -f1)
29if [[ "$(printf '%s\n%s\n' "$minimum_kernel" "$host_kernel" | sort -V | head -n 1)" != "$minimum_kernel" ]]; then
30 echo "Host kernel $host_kernel is too old for $host_arch; require $minimum_kernel or newer." >&2
31 exit 1
32fi
33
34target_arch=${TARGET_ARCH-${CROSS_ARCH-$host_arch}}
35target_arch=${target_arch:-$host_arch}
36if [[ "$ID" == debian ]]; then
37 if [[ "$host_arch" != loong64 || "$target_arch" != loong64 ||
38 ! "${VERSION_ID:-}" =~ ^[0-9]+([.][0-9]+)*$ ]] ||
39 [[ "$(printf '%s\n%s\n' 13 "${VERSION_ID:-0}" | sort -V | head -n 1)" != 13 ]]; then
40 echo 'Debian initialization supports native LoongArch64 on Debian 13+ only.' >&2
41 exit 1
42 fi
43elif [[ "$ …
48:3… oss_packages=()
49case "$target_arch" in
50 amd64)
51 kernel_arch=x86
52 if [[ "$host_arch" != amd64 ]]; then
53 cross_compile=x86_64-linux-gnu-
54 cross_packages=(gcc-x86-64-linux-gnu libc6-dev-amd64-cross)
55 fi
56 ;;
57 arm64)
58 kernel_arch=arm64
59 if [[ "$host_arch" != arm64 ]]; then
60 cross_compile=aarch64-linux-gnu-
61 cross_packages=(gcc-aarch64-linux-gnu libc6-dev-arm64-cross)
62 fi
63 ;;
⋯4 lines
67:55… & "$VERSION_ID" == 24.04 ]]; then
68 cross_packages=(dwarves qemu-user-static
69 libc6-dev-loong64-cross linux-libc-dev-loong64-cross
70 libgcc-13-dev-loong64-cross libatomic1-loong64-cross)
71 …
91:25… loong64 ]]; then
92 clang_suffix=-22
93fi
94
95# Reuse the checkout containing this script, including its current branch.
96# The curl/bash bootstrap has no script path and uses ~/ecapture instead.
97repo_dir="$HOME/ecapture"
98if [[ -n "${BASH_SOURCE[0]:-}" ]]; then
99 script_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
100 if [[ -f "$script_root/go.mod" && -f "$script_root/variables.mk" ]]; then
101 repo_dir=$script_root
102 fi
103fi
104if [[ -e "$repo_dir" && ( ! -f "$repo_dir/go.mod" || ! -f "$repo_dir/variables.mk" ) ]]; then
105 echo "Checko …