summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2021-01-16 05:32:58 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2021-01-16 05:42:04 (EST)
commit1aae68486f7418cfda3cea8421a96d318be506fb (patch)
treeb0450dc54b9406101db770ad847d6bfda97b5184
parent45e8fd75c621899365406141d9b9fe0aab0183e0 (diff)
profile: Simplify function parameters
Save mirror and suite arguments in profile_prepare_install(), then use them in other profile functions.
-rw-r--r--src/install.sh7
-rw-r--r--src/profile/proteanos.sh50
2 files changed, 27 insertions, 30 deletions
diff --git a/src/install.sh b/src/install.sh
index c5d3a5a..975845b 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -129,7 +129,7 @@ install_find_pkgs()
fi
pkgs_fd=${FD}
- if cert_url="$(profile_get_cert_url "${mirror}")"; then
+ if cert_url="$(profile_get_cert_url)"; then
# This is a hack to generate a fake certificate with some valid
# (but incorrect) key and the mirror-specific certificate URL to
# make opkg-cert download and verify the actual certificate.
@@ -175,7 +175,7 @@ install_find_pkgs()
_install_md5sum_cb _install_sha256sum_cb \
>&${pkgs_fd}
done <<-EOF
- $(profile_feeds "${mirror}" "${arch}" "${plat}" "${suite}")
+ $(profile_feeds "${arch}" "${plat}")
EOF
printf '\ndest root /\n' >&${opkg_conf_fd}
@@ -339,8 +339,7 @@ install_system()
fi
profile_prepare_install "${mirror}" "${suite}"
- if ! profile_validate_archplat "${mirror}" "${arch}" "${plat}" \
- "${suite}"; then
+ if ! profile_validate_archplat "${arch}" "${plat}"; then
error "$(get_msg 'install_bad_archplat')" "${arch}" "${plat}"
return 1
fi
diff --git a/src/profile/proteanos.sh b/src/profile/proteanos.sh
index e208464..4d5578a 100644
--- a/src/profile/proteanos.sh
+++ b/src/profile/proteanos.sh
@@ -37,6 +37,8 @@ start()
}
'
+_prof_proteanos_mirror=
+_prof_proteanos_suite=
_prof_proteanos_platforms=''
_prof_proteanos_platforms_platform=''
_prof_proteanos_platforms_type=''
@@ -154,8 +156,8 @@ prof_proteanos_prepare_install()
local suite="${2}"
shift 2
- [ -n "${_prof_proteanos_platforms}" ] && return
-
+ _prof_proteanos_mirror="${mirror}"
+ _prof_proteanos_suite="${suite}"
parse_control - _prof_proteanos_platforms_field \
_prof_proteanos_platforms_paragraph 0<<-EOF
$(${WGET} -q -O - -- "${mirror}/feeds/${suite}/Platforms")
@@ -164,11 +166,9 @@ prof_proteanos_prepare_install()
prof_proteanos_installer_type()
{
- local mirror="${1}"
- local suite="${2}"
- local arch="${3}"
- local plat="${4}"
- shift 4
+ local arch="${1}"
+ local plat="${2}"
+ shift 2
local arch_clean=
local plat_clean=
local archplat=
@@ -184,11 +184,9 @@ prof_proteanos_installer_type()
prof_proteanos_validate_archplat()
{
- local mirror="${1}"
- local arch="${2}"
- local plat="${3}"
- local suite="${4}"
- shift 4
+ local arch="${1}"
+ local plat="${2}"
+ shift 2
local archplat=
case " ${_prof_proteanos_platforms} " in
@@ -214,11 +212,9 @@ prof_proteanos_opkg_conf_file()
prof_proteanos_feeds()
{
- local mirror="${1}"
- local arch="${2}"
- local plat="${3}"
- local suite="${4}"
- shift 4
+ local arch="${1}"
+ local plat="${2}"
+ shift 2
local arch_clean=
local plat_clean=
local archplat=
@@ -233,7 +229,8 @@ prof_proteanos_feeds()
archplat="${arch_clean}__${plat_clean}"
eval "sects=\"\${_prof_proteanos_archplat_sections_${archplat}}\""
- manifest="$(${WGET} -q -O - -- "${mirror}/feeds/${suite}/Manifest")"
+ manifest="$(${WGET} -q -O - -- "${_prof_proteanos_mirror}/feeds/$(: \
+ )${_prof_proteanos_suite}/Manifest")"
for a in "${arch}" 'all'; do
for p in "${plat}" 'all'; do
@@ -243,10 +240,12 @@ prof_proteanos_feeds()
*) continue;;
esac
printf 'src/gz proteanos_%s_%s_%s_%s_%s.gz ' \
- "${suite%/*}" "${suite#*/}" \
+ "${_prof_proteanos_suite%/*}" \
+ "${_prof_proteanos_suite#*/}" \
"${a}" "${p}" "${s}"
printf '%s/feeds/%s/%s/%s/%s\n' \
- "${mirror}" "${suite}" \
+ "${_prof_proteanos_mirror}" \
+ "${_prof_proteanos_suite}" \
"${a}" "${p}" "${s}"
done
done
@@ -254,20 +253,19 @@ prof_proteanos_feeds()
for s in 'base' 'src'; do
printf 'src/gz proteanos_%s_%s_%s_%s_%s.gz ' \
- "${suite%/*}" "${suite#*/}" \
+ "${_prof_proteanos_suite%/*}" \
+ "${_prof_proteanos_suite#*/}" \
'src' 'all' "${s}"
printf '%s/feeds/%s/%s/%s/%s\n' \
- "${mirror}" "${suite}" \
+ "${_prof_proteanos_mirror}" \
+ "${_prof_proteanos_suite}" \
'src' 'all' "${s}"
done
}
prof_proteanos_get_cert_url()
{
- local mirror="${1}"
- shift 1
-
- printf '%s/archive.cert' "${mirror}"
+ printf '%s/archive.cert' "${_prof_proteanos_mirror}"
return 0
}