From e0413089bdf3ddf423c0f6a7e8a2b82dba3ee222 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 26 Feb 2018 10:54:58 +0100 Subject: apt_install_if_not: Explicitly support command line options. --- install-itzks-workstation | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'install-itzks-workstation') diff --git a/install-itzks-workstation b/install-itzks-workstation index 9eeaba1..79250fc 100755 --- a/install-itzks-workstation +++ b/install-itzks-workstation @@ -17,12 +17,17 @@ set -e set -x function apt_install_if_not() { - pkgs=$@ + pkgs_and_opts=$@ install_pkgs="" - for pkg in $pkgs; do - [ -d "/usr/share/doc/$pkg" ] || install_pkgs="$install_pkgs $pkg" + options="" + for param in $pkgs_and_opts; do + echo "$param" | grep -qE '^-' && { + options="$options $param" + } || { + [ -d "/usr/share/doc/$param" ] || install_pkgs="$install_pkgs $param" + } done - test -n "$install_pkgs" && apt-get install -y $install_pkgs || true + test -n "$install_pkgs" && apt-get install -y $options $install_pkgs || true } # Add user locadm if not already there -- cgit v1.2.3