@@ -160,8 +160,15 @@ package_latest_version() { #returns the latest available versions of the specifi
160
160
local package=" $1 "
161
161
[ -z " $package " ] && error " package_latest_version(): no package specified!"
162
162
163
+ # support repo selection as '-t bookworm-backports' for $2 and $3
164
+ local additional_flags
165
+ additional_flags=()
166
+ if [ " $2 " == ' -t' ]; then
167
+ additional_flags=(-t " $3 " )
168
+ fi
169
+
163
170
# use slower but more accurate apt list command to get package version for current architecture
164
- apt-cache policy " $package " 2> /dev/null | grep " Candidate: " | awk ' {print $2}'
171
+ apt-cache policy " ${additional_flags[@]} " " $ package" 2> /dev/null | grep " Candidate: " | awk ' {print $2}'
165
172
# grep -rx "Package: $package" /var/lib/apt/lists --exclude="lock" --exclude-dir="partial" --after 4 | grep -o 'Version: .*' | awk '{print $2}' | sort -rV | head -n1
166
173
}
167
174
@@ -476,8 +483,11 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n
476
483
477
484
# convert input array to newline-separated string
478
485
local IFS=' '
486
+ local repo_selection=' ' # store selected repo to install from, eg. bookworm-backports
479
487
while [ $# -gt 0 ]; do
480
- if [ " $1 " == ' -t' ]; then # pass through -t args to apt: for "-t bookworm-backports"
488
+ # pass through -t args to apt: for "-t bookworm-backports"
489
+ if [ " $1 " == ' -t' ]; then
490
+ repo_selection=" $2 "
481
491
apt_flags+=(' -t' " $2 " )
482
492
shift
483
493
shift
@@ -575,7 +585,7 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n
575
585
using_local_packages=1 # remember that the pi-apps-local-packages repository is being used
576
586
577
587
# replace package url with name of package
578
- packages=" $( echo " $packages " | sed " s|$ package |$packagename (>= $packageversion )|" ) "
588
+ packages=" $( echo " $packages " | sed " s|^ ${ package} $ |$packagename (>= $packageversion )|" ) "
579
589
580
590
# expand regex (package-name contains *)
581
591
elif echo " $package " | grep -q ' *' ; then
@@ -586,6 +596,12 @@ install_packages() { #Make some packages dependencies of the $app app. Package-n
586
596
587
597
# replace package with expanded list
588
598
packages=" $( echo " $packages " | grep -vF " $package " ) " $' \n ' " $list "
599
+
600
+ # request package version if backports repo was specified
601
+ elif [ ! -z " $repo_selection " ]; then
602
+ local packageversion=" $( package_latest_version " $package " -t " $repo_selection " | sed ' s/+.*//g' ) "
603
+ # add version specification to package
604
+ packages=" $( echo " $packages " | sed " s|^${package} $|$package (>= $packageversion )|" ) "
589
605
fi
590
606
done
591
607
# now package list shouldn't contain any '*' characters, urls, local filepaths
0 commit comments