diff --git a/hack/cluster/cluster.yaml b/config/cluster/cluster.yaml similarity index 100% rename from hack/cluster/cluster.yaml rename to config/cluster/cluster.yaml diff --git a/hack/cluster/config.yaml b/config/cluster/config.yaml similarity index 100% rename from hack/cluster/config.yaml rename to config/cluster/config.yaml diff --git a/config/versions.yaml b/config/versions.yaml index 1d30d5e..eeb8a59 100644 --- a/config/versions.yaml +++ b/config/versions.yaml @@ -13,13 +13,6 @@ binary: archs: - amd64 - arm64 - - name: yq - type: executable - url: https://github.com/mikefarah/yq/releases/download/v${version}/yq_${os}_${arch} - version: 4.44.3 - archs: - - amd64 - - arm64 package: add: [] # - name: "" @@ -29,24 +22,24 @@ package: remove: [] # - name: containerd # type: apt - group: - - name: docker - keyring: https://download.docker.com/${os}/ubuntu/gpg - repo: https://download.docker.com/${os}/ubuntu - type: apt - add: - - containerd.io - - docker-buildx-plugin - - docker-ce-cli - - docker-ce - - docker-compose-plugin - remove: - - containerd - - docker-compose - - docker-doc - - docker.io - - podman-docker - - runc + group: [] + # - name: docker + # keyring: https://download.docker.com/${os}/ubuntu/gpg + # repo: https://download.docker.com/${os}/ubuntu + # type: apt + # add: + # - containerd.io + # - docker-buildx-plugin + # - docker-ce-cli + # - docker-ce + # - docker-compose-plugin + # remove: + # - containerd + # - docker-compose + # - docker-doc + # - docker.io + # - podman-docker + # - runc plugin: - name: kubectl installer: krew diff --git a/scripts/configure.sh b/scripts/configure.sh index 89876c9..d2bd80f 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -9,6 +9,8 @@ if [[ -n $(command -v "apt-get") ]]; then "curl" "git" "gnupg2" + "jq" + "yq" "zsh" ) @@ -103,4 +105,8 @@ ln -sf .trunk/configs/.* . if [[ -n $(command -v "trunk") ]]; then trunk fmt trunk check +else + curl https://get.trunk.io -fsSL | bash + trunk fmt + trunk check fi diff --git a/scripts/install.sh b/scripts/install.sh index c2c323c..8cdf2df 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,6 +8,10 @@ VERSION_CONFIG="config/versions.yaml" export arch="$(uname -m)" export os="$(uname | tr '[:upper:]' '[:lower:]')" +if [[ "${arch}" == "aarch64" ]]; then + export arch="arm64" +fi + # todo: packages # note: package groups package_groups="$(yq '.package.group[] | .name' "${VERSION_CONFIG}")" @@ -30,8 +34,10 @@ done # note: binaries binaries="$(yq '.binary[] | .name' "${VERSION_CONFIG}")" + for name in ${binaries[@]}; do export name="${name}" + yq '.binary[] | select(.name == env(name))' "${VERSION_CONFIG}" export $(getenv <(yq '.binary[] | select(.name == env(name))' "${VERSION_CONFIG}")) if [[ -n $(command -v "${name}") ]]; then @@ -43,7 +49,7 @@ for name in ${binaries[@]}; do case "${type}" in archive) curl -fsSLo "/tmp/${name}.tgz" "${url}" - tar -xzf "/tmp/${name}.tgz" + tar -xzf "/tmp/${name}.tgz" -C /tmp/ install "/tmp/${os}-${arch}/${name}" "/usr/local/bin/${name}" "${name}" version ;; @@ -69,7 +75,7 @@ for name in ${plugins[@]}; do if [[ -z $(command -v "${name}") ]]; then echo "{name} is not installed" - elif "${name}" "${installer}" &>/dev/null; then + elif "${name}" "${installer}" >/dev/null 2>&1; then echo "================== installing ${name} plugins =================" list=$(yq '.plugin[] | select(.name == env(name)) | .list[]' "${VERSION_CONFIG}") "${name}" "${installer}" install ${list[*]} || true diff --git a/scripts/install/go.sh b/scripts/install/go.sh index 49b733f..5d2f266 100755 --- a/scripts/install/go.sh +++ b/scripts/install/go.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-3.0 -# source ../alias.sh -source ../environment.sh +# source scripts/alias.sh +source scripts/environment.sh # install golang if [[ -z $(command -v go) ]]; then @@ -9,12 +9,9 @@ if [[ -z $(command -v go) ]]; then sudo apt-get install -yq --no-install-recommends golang fi -# install sbctl -if [[ -z $(command -v sbctl) ]]; then - # version: 0.16 - # https://github.com/Foxboron/sbctl/commit/53e074d6934f5ecfffa81a576293219c717f7d19 - go install github.com/foxboron/sbctl/cmd/sbctl@53e074d6934f5ecfffa81a576293219c717f7d19 -fi +# install packages +command -v sbctl || go install github.com/foxboron/sbctl/cmd/sbctl@53e074d6934f5ecfffa81a576293219c717f7d19 # 0.16 https://github.com/Foxboron/sbctl/commit/53e074d6934f5ecfffa81a576293219c717f7d19 +command -v buf || go install github.com/bufbuild/buf/cmd/buf@8482b8f2dc17e93ac8a490cdfd86ff20f0bd1037 # v1.48.0 https://github.com/bufbuild/buf/commit/8482b8f2dc17e93ac8a490cdfd86ff20f0bd1037 go version -sbctl status +sbctl status || true diff --git a/scripts/install/rust.sh b/scripts/install/rust.sh index c4ea0ab..4949128 100755 --- a/scripts/install/rust.sh +++ b/scripts/install/rust.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-3.0 -# source ../alias.sh -source ../environment.sh +# source scripts/alias.sh +source scripts/environment.sh # install rust if [[ -z $(command -v rustup) ]]; then @@ -10,14 +10,17 @@ if [[ -z $(command -v rustup) ]]; then fi # set rust toolchain -if [[ -n $(command -v rustc) ]]; then +if [[ -z $(command -v rustc) ]]; then rustup default stable rustup component add rust-src fi # install bindgen-cli -[[ -n $(command -v bindgen-cli) ]] || cargo install bindgen-cli +command -v bindgen >/dev/null 2>&1 || echo cargo install bindgen-cli +cargo generate --version >/dev/null 2>&1 || echo cargo install cargo-generate +# cargo xtask >/dev/null 2>&1 || cargo install bpf-linker # fixme: bpf-linker rustc --version cargo --version +cargo generate --version bindgen --version diff --git a/scripts/install/swift.sh b/scripts/install/swift.sh index 9c314b3..9cf5637 100755 --- a/scripts/install/swift.sh +++ b/scripts/install/swift.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-3.0 -# source ../alias.sh -source ../environment.sh +# source scripts/alias.sh +source scripts/environment.sh ARCH="$(uname -m)" SWIFT_VERSION="6.0.2" diff --git a/scripts/install/toolchain.sh b/scripts/install/toolchain.sh index 3a2814d..3aa1bc2 100755 --- a/scripts/install/toolchain.sh +++ b/scripts/install/toolchain.sh @@ -5,27 +5,38 @@ apt-get update -yq apt-get install -yq --no-install-recommends \ + avahi-utils \ binutils \ bison \ build-essential \ ccache \ clang \ cmake \ + default-jre \ dfu-util \ flex \ + g++ \ gcc \ git \ gnupg2 \ gperf \ + libavahi-client-dev \ libc6-dev \ + libcairo2-dev \ libcurl4 \ + libdbus-1-dev \ libedit2 \ libelf-dev \ libffi-dev \ libgcc-9-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ libncurses6 \ + libreadline-dev \ + libsdl2-dev \ libsqlite3-0 \ libssl-dev \ + libssl-dev \ libstdc++-9-dev \ libusb-1.0-0 \ libxml2 \ @@ -35,9 +46,11 @@ apt-get install -yq --no-install-recommends \ ninja-build \ pkg-config \ python3 \ + python3-dev \ python3-pip \ python3-venv \ tzdata \ + unzip \ uuid-dev \ wget \ zlib1g-dev