Created
February 19, 2025 10:50
-
-
Save Vincinator/af8095c455dc504c20f48408c3fc18df to your computer and use it in GitHub Desktop.
Extract download URL of kernel package for a given Garden Linux version + architecture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
arch= | |
version= | |
while [[ $# -gt 0 ]]; do | |
case "$1" in | |
--arch) | |
arch="$2" | |
shift 2 | |
;; | |
--version) | |
version="$2" | |
shift 2 | |
;; | |
*) | |
echo "Usage: $0 --arch <arch> --version <version>" | |
exit 1 | |
;; | |
esac | |
done | |
if [[ -z "$arch" || -z "$version" ]]; then | |
echo "Error: Both --arch and --version are required." | |
echo "Usage: $0 --arch <arch> --version <version>" | |
exit 1 | |
fi | |
call_dir=$pwd | |
tmpdir=$(mktemp -d) | |
cd $tmpdir | |
trap 'cd $call_dir && rm -rf "$tmpdir"' EXIT | |
# Note: silently fails if URl does not exist. gunzip will complain about stdin not in gzip format | |
curl -s https://packages.gardenlinux.io/gardenlinux/dists/$version/main/binary-$arch/Packages.gz | gunzip > Packages | |
# Meta Package linux-image-$arch is only there to depend on the respective linux-image-<version>-<arch>, so user can just install linux-image-<arch> and gets the respective kernel version installed. | |
# | |
kernel_version=$(cat Packages | sed -n "/^Package: linux-image-${arch}$/,/^$/p" | grep "Depends:" | cut -d : -f 2 | cut -d' ' -f 2) | |
# Construct download Link of linux-image-<version>-<arch> packages. | |
pool_url=$(sed -n "/^Package: ${kernel_version}$/,/^$/p" Packages | grep "^Filename:" | cut -d : -f 2 | sed 's/^ *//' | sed 's|^|https://packages.gardenlinux.io/gardenlinux/|' ) | |
echo $pool_url | |
to inspect content you could do stuff like this
./get_kernel_download_url.sh --arch arm64 --version 1592.6 | xargs curl --output kernel.deb
The kernel.deb can be extracted with ar x kernel.deb
, and inside you will find a data.tar.xz, which should contain the kernel config for example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example: