We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 15dff4b commit 3ebfca5Copy full SHA for 3ebfca5
packagecheck.sh
@@ -0,0 +1,22 @@
1
+#!/bin/bash
2
+
3
+PACKAGES=$1
4
5
+notinstall_pkgs=""
6
+install=false
7
8
+for pkg in $PACKAGES; do
9
+ status="$(dpkg-query -W --showformat='${db:Status-Status}' "$pkg" 2>&1)"
10
+ if [ ! $? = 0 ] || [ ! "$status" = installed ]; then
11
+ install=true
12
+ notinstall_pkgs=$pkg" "$notinstall_pkgs
13
+ else
14
+ installed_pkgs=$pkg" "$installed_pkgs
15
+ fi
16
+done
17
18
+if "$install"; then
19
+ apt-get install -y --no-install-recommends $notinstall_pkgs && rm -rf /var/lib/apt/lists/*
20
+else
21
+ echo "### WARNING ${installed_pkgs} Package[s] already installed. ###"
22
+fi
0 commit comments