Created
October 2, 2021 09:09
-
-
Save tai/0895ec50b60e5a9fdcd42711124b2a52 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
| : ${KERNEL:=5.4.51-piCore} | |
| : ${VER:=12.x} | |
| : ${REPO:="http://repo.tinycorelinux.net"} | |
| : ${ARCH:=armv6} | |
| usage() { | |
| local p=${0##*/} | |
| cat <<EOF 1>&2 | |
| $p - Fetch TinyCoreLinux packages | |
| Usage: $p <package-names...> | |
| Example: | |
| $ $p wifi | |
| $ $p wireless-KERNEL.tcz | |
| EOF | |
| exit 0 | |
| } | |
| run() { | |
| local i | |
| local dep="$@" | |
| mkdir -p $VER | |
| test -e $VER/00index.txt || (curl $REPO/$VER/$ARCH/tcz/ > $VER/00index.txt) | |
| while test -n "$dep"; do | |
| for i in $dep; do | |
| local fn=$(echo ${i%.tcz}.tcz | sed s/-KERNEL/-$KERNEL/) | |
| test -e $VER/$fn || echo $REPO/$VER/$ARCH/tcz/$fn | |
| local ext | |
| for ext in dep info list md5.txt tree zsync; do | |
| test -e $VER/$fn.$ext || echo $REPO/$VER/$ARCH/tcz/$fn.$ext | |
| done | |
| done | aria2c -i - -d $VER | |
| dep= | |
| for i in $(sed s/-KERNEL/-$KERNEL/ $VER/*.dep); do | |
| test -e $VER/$i || dep="$dep $i" | |
| done | |
| done | |
| } | |
| test $# -gt 0 || usage | |
| run "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment