Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienix/blob/main/aienos # aienix AienOS front door: pinned repositories, source-linked lessons and verification paths. AienOS is in alpha testing; components remain separate and each states its own status. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienix / aienos` 69 lines ยท 2543 bytes Raw Blame History 1 #!/bin/sh 2 # aienos -- the front door to the AIEN tree. 3 # 4 # Every component is linked in as a git submodule pinned at one commit, so 5 # a checkout of this repository names exactly which version of each part 6 # belongs together. 7 # 8 # ./aienos get fetch every component at its pinned commit 9 # ./aienos status each component: pinned commit, its main, current or behind 10 # ./aienos bump [path...] move pins to each component's main (all if none named); 11 # stages the change for a pull request, commits nothing 12 # 13 # Needs: POSIX sh, git. Network only for get, status and bump. 14 set -eu 15 cd "$(dirname "$0")" 16 17 paths() { git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | awk '{print $2}'; } 18 url_of() { git config -f .gitmodules --get "submodule.$1.url"; } 19 pin_of() { git ls-files -s -- "$1" | awk '{print $2}'; } 20 main_of() { git ls-remote "$(url_of "$1")" refs/heads/main | awk '{print $1}'; } 21 short() { printf '%.10s' "$1"; } 22 23 cmd=${1:-help} 24 [ $# -gt 0 ] && shift 25 case "$cmd" in 26 get) 27 git submodule sync -q 28 git submodule update --init --depth 1 --recommend-shallow 29 echo "aienos: $(paths | wc -l | tr -d ' ') components at their pinned commits" 30 ;; 31 status) 32 behind=0 33 for p in $(paths); do 34 pin=$(pin_of "$p") 35 main=$(main_of "$p") 36 if [ -z "$main" ]; then 37 printf '%-28s pinned %s main: unreachable\n' "$p" "$(short "$pin")" 38 behind=$((behind + 1)) 39 elif [ "$pin" = "$main" ]; then 40 printf '%-28s pinned %s current\n' "$p" "$(short "$pin")" 41 else 42 printf '%-28s pinned %s main %s behind\n' "$p" "$(short "$pin")" "$(short "$main")" 43 behind=$((behind + 1)) 44 fi 45 done 46 echo "aienos: $behind behind" 47 [ "$behind" -eq 0 ] 48 ;; 49 bump) 50 list=${*:-$(paths)} 51 moved=0 52 for p in $list; do 53 paths | grep -qx "$p" || { echo "aienos: no component at $p" >&2; exit 2; } 54 main=$(main_of "$p") 55 [ -n "$main" ] || { echo "aienos: $p: main unreachable" >&2; exit 1; } 56 [ "$(pin_of "$p")" = "$main" ] && continue 57 git submodule update --init --depth 1 -- "$p" >/dev/null 58 git -C "$p" fetch -q --depth 1 origin "$main" 59 git -C "$p" checkout -q --detach "$main" 60 git add -- "$p" 61 echo "aienos: $p -> $(short "$main")" 62 moved=$((moved + 1)) 63 done 64 echo "aienos: $moved moved (staged; commit on a branch and open a pull request)" 65 ;; 66 *) 67 sed -n '2,15s/^# \{0,1\}//p' "$0" 68 ;; 69 esac