diff options
Diffstat (limited to 'kernel/get-deps')
| -rwxr-xr-x | kernel/get-deps | 151 |
1 files changed, 26 insertions, 125 deletions
diff --git a/kernel/get-deps b/kernel/get-deps index d93b434..503a9a6 100755 --- a/kernel/get-deps +++ b/kernel/get-deps @@ -1,6 +1,6 @@ #! /bin/sh -set -ex +set -e srcdir="$(dirname "$0")" test -z "$srcdir" && srcdir=. @@ -11,160 +11,61 @@ clone_repo_commit() { if test -d "$2/.git"; then git -C "$2" reset --hard git -C "$2" clean -fd - if ! git -C "$2" checkout $3; then + if ! git -C "$2" -c advice.detachedHead=false checkout $3; then rm -rf "$2" fi else if test -d "$2"; then - set +x - echo "error: '$2' is not a Git repository" + echo "error: '$2' is not a Git repository" 1>&2 exit 1 fi fi if ! test -d "$2"; then git clone $1 "$2" - if ! git -C "$2" checkout $3; then + if ! git -C "$2" -c advice.detachedHead=false checkout $3; then rm -rf "$2" exit 1 fi fi } -download_by_hash() { - DOWNLOAD_COMMAND="curl -Lo" - if ! command -v "${DOWNLOAD_COMMAND%% *}" >/dev/null 2>&1; then - DOWNLOAD_COMMAND="wget -O" - if ! command -v "${DOWNLOAD_COMMAND%% *}" >/dev/null 2>&1; then - set +x - echo "error: Neither curl nor wget found" - exit 1 - fi - fi - SHA256_COMMAND="sha256sum" - if ! command -v "${SHA256_COMMAND%% *}" >/dev/null 2>&1; then - SHA256_COMMAND="sha256" - if ! command -v "${SHA256_COMMAND%% *}" >/dev/null 2>&1; then - set +x - echo "error: Cannot find sha256(sum) command" - exit 1 - fi - fi - if ! test -f "$2" || ! $SHA256_COMMAND "$2" | grep $3 >/dev/null 2>&1; then - rm -f "$2" - mkdir -p "$2" && rm -rf "$2" - $DOWNLOAD_COMMAND "$2" $1 - if ! $SHA256_COMMAND "$2" | grep $3 >/dev/null 2>&1; then - set +x - echo "error: Cannot download file '$2' by hash" - echo "incorrect hash:" - $SHA256_COMMAND "$2" - rm -f "$2" - exit 1 - fi - fi -} +rm -f .deps-obtained clone_repo_commit \ - https://codeberg.org/osdev/freestnd-c-hdrs.git \ + https://codeberg.org/OSDev/freestnd-c-hdrs.git \ freestnd-c-hdrs \ - 4039f438fb1dc1064d8e98f70e1cf122f91b763b + 5e11c3da645d8f203e93dc23703b14a15c5b7afc clone_repo_commit \ - https://codeberg.org/osdev/freestnd-cxx-hdrs.git \ + https://codeberg.org/OSDev/freestnd-cxx-hdrs.git \ freestnd-cxx-hdrs \ - 85096df5361a4d7ef2ce46947e555ec248c2858e + 9d6a92ab19a57140f1e3ecc6668014d7f46094b6 clone_repo_commit \ - https://codeberg.org/osdev/cc-runtime.git \ + https://codeberg.org/OSDev/cc-runtime.git \ cc-runtime \ dae79833b57a01b9fd3e359ee31def69f5ae899b -download_by_hash \ - https://github.com/limine-bootloader/limine/raw/4687a182be23939c2d9f15db970382dc353ed956/limine.h \ - src/limine.h \ - 6879e626f34c1be25ac2f72bf43b083fc2b53887280bb0fcdaee790e258c6974 -#! /bin/sh - -set -ex - -srcdir="$(dirname "$1")" -test -z "$srcdir" && srcdir=. - -cd "$srcdir" - -clone_repo_commit() { - if test -d "$2/.git"; then - git -C "$2" reset --hard - git -C "$2" clean -fd - if ! git -C "$2" checkout $3; then - rm -rf "$2" - fi - else - if test -d "$2"; then - set +x - echo "error: '$2' is not a Git repository" - exit 1 - fi - fi - if ! test -d "$2"; then - git clone $1 "$2" - if ! git -C "$2" checkout $3; then - rm -rf "$2" - exit 1 - fi - fi -} - -download_by_hash() { - DOWNLOAD_COMMAND="curl -Lo" - if ! command -v "${DOWNLOAD_COMMAND%% *}" >/dev/null 2>&1; then - DOWNLOAD_COMMAND="wget -O" - if ! command -v "${DOWNLOAD_COMMAND%% *}" >/dev/null 2>&1; then - set +x - echo "error: Neither curl nor wget found" - exit 1 - fi - fi - SHA256_COMMAND="sha256sum" - if ! command -v "${SHA256_COMMAND%% *}" >/dev/null 2>&1; then - SHA256_COMMAND="sha256" - if ! command -v "${SHA256_COMMAND%% *}" >/dev/null 2>&1; then - set +x - echo "error: Cannot find sha256(sum) command" - exit 1 - fi - fi - if ! test -f "$2" || ! $SHA256_COMMAND "$2" | grep $3 >/dev/null 2>&1; then - rm -f "$2" - mkdir -p "$2" && rm -rf "$2" - $DOWNLOAD_COMMAND "$2" $1 - if ! $SHA256_COMMAND "$2" | grep $3 >/dev/null 2>&1; then - set +x - echo "error: Cannot download file '$2' by hash" - echo "incorrect hash:" - $SHA256_COMMAND "$2" - rm -f "$2" - exit 1 - fi - fi -} +clone_repo_commit \ + https://codeberg.org/Limine/limine-protocol.git \ + limine-protocol \ + 068b6481557db836e41bf644382367f8dee76d21 clone_repo_commit \ - https://codeberg.org/osdev/freestnd-c-hdrs.git \ - freestnd-c-hdrs \ - 4039f438fb1dc1064d8e98f70e1cf122f91b763b + https://codeberg.org/Mintsuki/Flanterm.git \ + flanterm \ + 26f631fcc15bb7faea83572213cae5a0287fc3de clone_repo_commit \ - https://codeberg.org/osdev/freestnd-cxx-hdrs.git \ - freestnd-cxx-hdrs \ - 85096df5361a4d7ef2ce46947e555ec248c2858e + https://github.com/charlesnicholson/nanoprintf.git \ + nanoprintf \ + 47af8e576556d7be9621f431e442123eccc056d3 clone_repo_commit \ - https://codeberg.org/osdev/cc-runtime.git \ - cc-runtime \ - dae79833b57a01b9fd3e359ee31def69f5ae899b + https://github.com/uACPI/uACPI.git \ + uacpi \ + e05715b2e6a3ae913aecdb86f4fd2dba30304e45 + +touch .deps-obtained -download_by_hash \ - https://github.com/limine-bootloader/limine/raw/4687a182be23939c2d9f15db970382dc353ed956/limine.h \ - src/limine.h \ - 6879e626f34c1be25ac2f72bf43b083fc2b53887280bb0fcdaee790e258c6974 +printf "\nDependencies obtained successfully.\n" |
