You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
883 B
Bash
34 lines
883 B
Bash
#!/bin/bash
|
|
|
|
parent_package="$1"
|
|
target_package="$2" # so far, this is unused
|
|
|
|
function list_depends() {
|
|
package_name="$1"
|
|
prepend_string="$2"
|
|
|
|
if [[ "$prepend_string" == '' ]]; then
|
|
prepend_string="$package_name"
|
|
fi
|
|
|
|
depends_list="$(apt-cache depends "$package_name" | grep Depends | cut -d ' ' -f 4)"
|
|
if [[ $depends_list != '' ]]; then
|
|
for depend in $depends_list; do
|
|
if [[ "$depend" == "$target_package" ]]; then
|
|
echo "${prepend_string}>${depend}"
|
|
exit 0
|
|
fi
|
|
done
|
|
for depend in $depends_list; do
|
|
if ! echo "$prepend_string" | grep -q "$depend"; then
|
|
list_depends "$depend" "${prepend_string}>${depend}"
|
|
fi
|
|
done
|
|
fi
|
|
}
|
|
|
|
list_depends "$parent_package"
|
|
|
|
# Output should look like this.
|
|
# package_name->dep_name->dep2_name
|