From 1aae68486f7418cfda3cea8421a96d318be506fb Mon Sep 17 00:00:00 2001
From: Patrick McDermott <patrick.mcdermott@libiquity.com>
Date: Sat, 16 Jan 2021 05:32:58 -0500
Subject: profile: Simplify function parameters

Save mirror and suite arguments in profile_prepare_install(), then use
them in other profile functions.
---
(limited to 'src/profile')

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
 }
 
--
cgit v0.9.1