fix unfinalized install
This commit is contained in:
+2
-5
@@ -21,7 +21,6 @@ function debian_update_repo {
|
|||||||
function debian_add {
|
function debian_add {
|
||||||
debian_update_repo
|
debian_update_repo
|
||||||
declare -a wanted=("$@")
|
declare -a wanted=("$@")
|
||||||
declare -a unrecognized=()
|
|
||||||
declare -a missing=()
|
declare -a missing=()
|
||||||
mapfile -t queries < <(dpkg-query -W -f='${Package}: ${Status}\n' "${wanted[@]}" 2>&1 || true)
|
mapfile -t queries < <(dpkg-query -W -f='${Package}: ${Status}\n' "${wanted[@]}" 2>&1 || true)
|
||||||
|
|
||||||
@@ -29,15 +28,13 @@ function debian_add {
|
|||||||
local missing_regex='(.*): .* not-installed$'
|
local missing_regex='(.*): .* not-installed$'
|
||||||
for query in "${queries[@]}"; do
|
for query in "${queries[@]}"; do
|
||||||
if [[ "$query" =~ $unrecognized_regex ]]; then
|
if [[ "$query" =~ $unrecognized_regex ]]; then
|
||||||
unrecognized+=("${BASH_REMATCH[1]}")
|
missing+=("${BASH_REMATCH[1]}")
|
||||||
elif [[ "$query" =~ $missing_regex ]]; then
|
elif [[ "$query" =~ $missing_regex ]]; then
|
||||||
missing+=("${BASH_REMATCH[1]}")
|
missing+=("${BASH_REMATCH[1]}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${#unrecognized[@]} -gt 0 ]]; then
|
if [[ "${#missing[@]}" -gt 0 ]]; then
|
||||||
>&2 echo "$(basename "$0") error: unrecognized packages: ${unrecognized[*]}" && return 2
|
|
||||||
elif [[ "${#missing[@]}" -gt 0 ]]; then
|
|
||||||
echo installing packages: "${missing[@]}"
|
echo installing packages: "${missing[@]}"
|
||||||
apt-get install -y "${missing[@]}"
|
apt-get install -y "${missing[@]}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user