Lines 42-48
get_repo_path() {
Link Here
|
42 |
} |
42 |
} |
43 |
|
43 |
|
44 |
# get a list of valid profiles |
44 |
# get a list of valid profiles |
45 |
# returns a line <repo>::<repo_path>::<profile> for every profile |
45 |
# returns a line <repo>::<repo_path>::<profile>::<status> for every profile |
46 |
find_targets() { |
46 |
find_targets() { |
47 |
local arch desc repos repo_paths i p |
47 |
local arch desc repos repo_paths i p |
48 |
|
48 |
|
Lines 60-66
find_targets() {
Link Here
|
60 |
[[ -r ${desc} ]] || continue |
60 |
[[ -r ${desc} ]] || continue |
61 |
# parse profiles.desc and find profiles suitable for arch |
61 |
# parse profiles.desc and find profiles suitable for arch |
62 |
for p in $(sed -n -e \ |
62 |
for p in $(sed -n -e \ |
63 |
"s|^${arch}[[:space:]]\+\([^[:space:]]\+\).*$|\1|p" "${desc}") |
63 |
"s|^${arch}[[:space:]]\+\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$|\1::\2|p" \ |
|
|
64 |
"${desc}") |
64 |
do |
65 |
do |
65 |
echo "${repos[i]}::${repo_paths[i]}::${p}" |
66 |
echo "${repos[i]}::${repo_paths[i]}::${p}" |
66 |
done |
67 |
done |
Lines 85-90
set_symlink() {
Link Here
|
85 |
target=${targets[target-1]} |
86 |
target=${targets[target-1]} |
86 |
repo=${target%%::*}; target=${target#*::} |
87 |
repo=${target%%::*}; target=${target#*::} |
87 |
repopath=${target%%::*}; target=${target#*::} |
88 |
repopath=${target%%::*}; target=${target#*::} |
|
|
89 |
target=${target%%::*} |
88 |
elif [[ -n ${target} ]]; then |
90 |
elif [[ -n ${target} ]]; then |
89 |
# if the profile was explicitly specified (rather than a number) |
91 |
# if the profile was explicitly specified (rather than a number) |
90 |
# double check and make sure it's valid |
92 |
# double check and make sure it's valid |
Lines 174-180
describe_list() {
Link Here
|
174 |
} |
176 |
} |
175 |
|
177 |
|
176 |
do_list() { |
178 |
do_list() { |
177 |
local targets active i target repo repopath |
179 |
local targets active i target repo repopath status disp |
178 |
|
180 |
|
179 |
targets=( $(find_targets) ) |
181 |
targets=( $(find_targets) ) |
180 |
[[ ${#targets[@]} -eq 0 ]] \ |
182 |
[[ ${#targets[@]} -eq 0 ]] \ |
Lines 187-199
do_list() {
Link Here
|
187 |
target=${targets[i]} |
189 |
target=${targets[i]} |
188 |
repo=${target%%::*}; target=${target#*::} |
190 |
repo=${target%%::*}; target=${target#*::} |
189 |
repopath=${target%%::*}; target=${target#*::} |
191 |
repopath=${target%%::*}; target=${target#*::} |
190 |
if [[ ${repo} == "${DEFAULT_REPO}" ]]; then |
192 |
status=${target#*::}; status=${status%%::*} |
191 |
targets[i]=${target} |
193 |
target=${target%%::*} |
192 |
else |
194 |
disp=${target} |
193 |
targets[i]=${repo}:${target} |
195 |
[[ ${repo} != "${DEFAULT_REPO}" ]] && disp=${repo}:${disp} |
|
|
196 |
if ! is_output_mode brief; then |
197 |
case ${status} in |
198 |
dev|exp) disp+=" $(highlight_warning "(${status})")" ;; |
199 |
*) disp+=" $(highlight "(${status})")" ;; |
200 |
esac |
201 |
[[ $(canonicalise "${repopath}/profiles/${target}") \ |
202 |
== "${active}" ]] && disp=$(highlight_marker "${disp}") |
194 |
fi |
203 |
fi |
195 |
[[ $(canonicalise "${repopath}/profiles/${target}") == "${active}" ]] \ |
204 |
targets[i]=${disp} |
196 |
&& targets[i]=$(highlight_marker "${targets[i]}") |
|
|
197 |
done |
205 |
done |
198 |
write_list_start "Available profile symlink targets:" |
206 |
write_list_start "Available profile symlink targets:" |
199 |
write_numbered_list "${targets[@]}" |
207 |
write_numbered_list "${targets[@]}" |