summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/version.sh2
-rw-r--r--src/profile/proteanos.sh100
2 files changed, 74 insertions, 28 deletions
diff --git a/src/cmd/version.sh b/src/cmd/version.sh
index 3f22e49..931733a 100644
--- a/src/cmd/version.sh
+++ b/src/cmd/version.sh
@@ -23,7 +23,7 @@ cmd_version_main()
printf '%s (%s) %s\n' "${0##*/}" "${PACKAGE_NAME}" "${PACKAGE_VERSION}"
printf "$(get_msg 'cmd_version_copyright')\n" \
- '2012-2016, 2019' 'Patrick McDermott'
+ '2012-2016, 2019, 2021' 'Patrick McDermott'
return 0
}
diff --git a/src/profile/proteanos.sh b/src/profile/proteanos.sh
index 30e20f4..8a2cf91 100644
--- a/src/profile/proteanos.sh
+++ b/src/profile/proteanos.sh
@@ -1,6 +1,6 @@
# ProteanOS architecture detection and feeds lists.
#
-# Copyright (C) 2013-2016 Patrick McDermott
+# Copyright (C) 2013-2016, 2021 Patrick McDermott
#
# This file is part of the ProteanOS Development Kit.
#
@@ -36,7 +36,60 @@ start()
rm -f "${SCRIPT}"
}
'
-_prof_proteanos_manifest=''
+
+_prof_proteanos_platforms=''
+_prof_proteanos_platforms_platform=''
+_prof_proteanos_platforms_type=''
+_prof_proteanos_platforms_sections=''
+
+_prof_proteanos_platforms_field()
+{
+ local name="${1}"
+ local value="${2}"
+ shift 2
+
+ case "${name}" in
+ 'Platform')
+ _prof_proteanos_platforms_platform="${value}"
+ ;;
+ 'Type')
+ _prof_proteanos_platforms_type="${value}"
+ ;;
+ 'Sections')
+ _prof_proteanos_platforms_sections="${value}"
+ ;;
+ esac
+}
+
+_prof_proteanos_platforms_paragraph()
+{
+ local platform=
+ local archplat=
+
+ platform="${_prof_proteanos_platforms_platform}"
+ archplat="$(printf '%s' "${platform}" | tr -c '[a-z0-9/]' '_')"
+ archplat="${archplat%/*}__${archplat#*/}"
+
+ _prof_proteanos_platforms="${_prof_proteanos_platforms}${platform} "
+ eval "_prof_proteanos_archplat_type_${archplat}=$(: \
+ )\"\${_prof_proteanos_platforms_type}\""
+ eval "_prof_proteanos_archplat_sections_${archplat}=$(: \
+ )\"\${_prof_proteanos_platforms_sections}\""
+}
+
+_prof_proteanos_get_platforms()
+{
+ local mirror="${1}"
+ local suite="${2}"
+ shift 2
+
+ [ -n "${_prof_proteanos_platforms}" ] && return
+
+ parse_control - _prof_proteanos_platforms_field \
+ _prof_proteanos_platforms_paragraph 0<<-EOF
+ $(${WGET} -q -O - -- "${mirror}/feeds/${suite}/Platforms")
+ EOF
+}
prof_proteanos_detect_root()
{
@@ -118,20 +171,13 @@ prof_proteanos_validate_archplat()
shift 4
local archplat=
- [ -z "${_prof_proteanos_manifest}" ] && \
- _prof_proteanos_manifest="$(${WGET} -q -O - -- \
- "${mirror}/feeds/${suite}/Manifest")"
+ _prof_proteanos_get_platforms "${mirror}" "${suite}"
- while read -r archplat; do
- case "${archplat}" in
- all/*/* | */all/*) ;;
- "${arch}/${plat}/"*)
- return 0
- ;;
- esac
- done <<-EOF
- ${_prof_proteanos_manifest}
- EOF
+ case " ${_prof_proteanos_platforms} " in
+ *" ${arch}/${plat} "*)
+ return 0
+ ;;
+ esac
return 1
}
@@ -155,27 +201,27 @@ prof_proteanos_feeds()
local plat="${3}"
local suite="${4}"
shift 4
+ local arch_clean=
+ local plat_clean=
+ local archplat=
local sects=
+ local manifest=
local a=
local p=
local s=
- [ -z "${_prof_proteanos_manifest}" ] && \
- _prof_proteanos_manifest="$(${WGET} -q -O - -- \
- "${mirror}/feeds/${suite}/Manifest")"
+ _prof_proteanos_get_platforms "${mirror}" "${suite}"
+ arch_clean="$(printf '%s' "${arch}" | tr -c '[a-z0-9/]' '_')"
+ plat_clean="$(printf '%s' "${plat}" | tr -c '[a-z0-9/]' '_')"
+ archplat="${arch_clean}__${plat_clean}"
+ eval "sects=\"\${_prof_proteanos_archplat_sections_${archplat}}\""
+
+ manifest="$(${WGET} -q -O - -- "${mirror}/feeds/${suite}/Manifest")"
- case "${plat}" in
- 'dev')
- sects='base dev lib libdev share util'
- ;;
- *)
- sects='base boot lib share util'
- esac
-
for a in "${arch}" 'all'; do
for p in "${plat}" 'all'; do
for s in ${sects}; do
- case "${LF}${_prof_proteanos_manifest}${LF}" in
+ case "${LF}${manifest}${LF}" in
*"${LF}${a}/${p}/${s}${LF}"*) ;;
*) continue;;
esac