mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-03-13 12:06:28 -04:00
update pkg_installed function
This commit is contained in:
parent
ac1493fcfc
commit
041caf286b
8
debian/security-misc.config
vendored
8
debian/security-misc.config
vendored
@ -33,13 +33,13 @@ pkg_installed() {
|
|||||||
package_name="$1"
|
package_name="$1"
|
||||||
## Cannot use '&>' because it is a bashism.
|
## Cannot use '&>' because it is a bashism.
|
||||||
dpkg_query_output="$(dpkg-query --show --showformat='${Status}' "$package_name" 2>/dev/null)" || true
|
dpkg_query_output="$(dpkg-query --show --showformat='${Status}' "$package_name" 2>/dev/null)" || true
|
||||||
## dpkg_query_output Exampels:
|
## dpkg_query_output Examples:
|
||||||
## install ok half-configured
|
## install ok half-configured
|
||||||
## install ok installed
|
## install ok installed
|
||||||
|
|
||||||
requested_action=$(echo "$dpkg_query_output" | awk '{print $1}')
|
requested_action=$(printf '%s' "$dpkg_query_output" | awk '{print $1}')
|
||||||
status=$(echo "$dpkg_query_output" | awk '{print $2}')
|
status=$(printf '%s' "$dpkg_query_output" | awk '{print $2}')
|
||||||
error_state=$(echo "$dpkg_query_output" | awk '{print $3}')
|
error_state=$(printf '%s' "$dpkg_query_output" | awk '{print $3}')
|
||||||
|
|
||||||
if [ "$requested_action" = 'install' ]; then
|
if [ "$requested_action" = 'install' ]; then
|
||||||
true "$0: INFO: $package_name is installed, ok."
|
true "$0: INFO: $package_name is installed, ok."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user