Skip to content

Commit

Permalink
workflow: add /etc/board-package
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Nov 19, 2023
1 parent c981b09 commit 2c77fe7
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/*.deb
board-package
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ all-boards: $(patsubst root-%,%-board,$(wildcard root-*))

else

board-package-$(BOARD_TARGET)-$(RELEASE_NAME)_all.deb: root-$(BOARD_TARGET)
root-$(BOARD_TARGET)/etc/board-package:
mkdir -p root-$(BOARD_TARGET)/etc
echo "BOARD=$(BOARD_TARGET)" > root-$(BOARD_TARGET)/etc/board-package

board-package-$(BOARD_TARGET)-$(RELEASE_NAME)_all.deb: root-$(BOARD_TARGET)/etc/board-package
fpm -s dir -t deb -n board-package-$(BOARD_TARGET)-$(RELEASE_NAME) -v $(RELEASE_NAME) \
-p $@ \
--deb-priority optional --category admin \
Expand Down
38 changes: 38 additions & 0 deletions root/usr/local/sbin/install_board_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -eo pipefail

if [[ -e /etc/board_package ]]; then
source /etc/board_package
fi
if [[ -z "$BOARD" ]]; then
echo "The BOARD= is not defined in /etc/board_package"
fi

if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 [latest] [package-version]"
exit 1
fi

find() {
if [[ "$2" != "latest" ]]; then
set -- "$1" "tags/$2"
fi
curl --silent --fail "https://api.github.com/repos/ayufan-rock64/$1/releases/$2" \
| jq -r '.assets | .[] | .browser_download_url' \
| grep -E "board-package-$BOARD-"
}

if FILES=$(find linux-package "$1"); then
echo "Installing $1..."
echo "$FILES"
install_deb $FILES
else
echo "Did not find kernel '$1' in:"
echo "- https://github.com/ayufan-rock64/linux-kernel/releases"
echo "- https://github.com/ayufan-rock64/linux-mainline-kernel/releases"
exit 1
fi

echo 'Now run `change-default-kernel.sh` to switch the used kernel.'
exit 0
36 changes: 36 additions & 0 deletions root/usr/local/sbin/install_bootloader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -eo pipefail

if [[ -e /etc/board_package ]]; then
source /etc/board_package
fi
if [[ -z "$BOARD" ]]; then
echo "The BOARD= is not defined in /etc/board_package"
fi

if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 [latest] [u-boot-version]"
exit 1
fi

find() {
if [[ "$2" != "latest" ]]; then
set -- "$1" "tags/$2"
fi
curl --silent --fail "https://api.github.com/repos/ayufan-rock64/$1/releases/$2" \
| jq -r '.assets | .[] | .browser_download_url' \
| grep -E "u-boot-$BOARD-"
}

if FILES=$(find linux-mainline-u-boot "$1"); then
echo "Installing $1..."
echo "$FILES"
install_deb $FILES
else
echo "Did not find u-boot '$1' in:"
echo "- https://github.com/ayufan-rock64/linux-mainline-u-boot/releases"
exit 1
fi

exit 0
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
set -eo pipefail

if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 <kernel-version>"
echo "Usage: $0 [latest] [kernel-version]"
exit 1
fi

find() {
curl --silent --fail "https://api.github.com/repos/ayufan-rock64/$1/releases/tags/$2" \
if [[ "$2" != "latest" ]]; then
set -- "$1" "tags/$2"
fi
curl --silent --fail "https://api.github.com/repos/ayufan-rock64/$1/releases/$2" \
| jq -r '.assets | .[] | .browser_download_url' \
| grep -E 'linux-image|linux-headers' \
| grep -v '\-dbg'
}

if FILES=$(find linux-mainline-kernel "$1"); then
echo "Installing..."
echo "Installing $1..."
echo "$FILES"
install_deb $FILES
elif FILES=$(find linux-kernel "$1"); then
echo "Installing..."
echo "Installing $1..."
echo "$FILES"
install_deb $FILES
else
Expand Down

0 comments on commit 2c77fe7

Please sign in to comment.