diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-02-13 20:48:48 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-02-13 20:48:48 +0100 |
commit | 276a00d74bf5cdf599f6023b1a20bced7076e90a (patch) | |
tree | 293665ae3ce0a3113c641bdb09437056fcbacecc /install-itzks-workstation | |
parent | fd2ab42bcd28a11a4ed8856eed555ac026626115 (diff) | |
download | itzks-install-script-276a00d74bf5cdf599f6023b1a20bced7076e90a.tar.gz itzks-install-script-276a00d74bf5cdf599f6023b1a20bced7076e90a.tar.bz2 itzks-install-script-276a00d74bf5cdf599f6023b1a20bced7076e90a.zip |
Introduce apt_install_if_not function. Only install packages if not yet installed.
Diffstat (limited to 'install-itzks-workstation')
-rw-r--r-- | install-itzks-workstation | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/install-itzks-workstation b/install-itzks-workstation index afaddb5..a60929a 100644 --- a/install-itzks-workstation +++ b/install-itzks-workstation @@ -7,6 +7,15 @@ set -e # we want to see the commands being issued during script run set -x +function apt_install_if_not() { + pkgs=$@ + install_pkgs="" + for pkg in $pkgs; do + [ -d "/usr/share/doc/$pkg" ] || install_pkgs="$install_pkgs $pkg" + done + test -n "$install_pkgs" && apt-get install -y $install_pkgs || true +} + # Add user locadm if not already there if [ -z $"(getent passwd locadm)" ]; then adduser --gecos "Local Administrator" locadm @@ -46,38 +55,43 @@ find /var/lib/apt/lists/ -type f -delete # Get update and add itzks-keyring and itzks-systems-common package apt-get update -apt-get install -y itzks-keyring +apt_install_if_not itzks-keyring apt-get update -apt-get install -y itzks-systems-common +apt_install_if_not itzks-systems-common apt-get update # Install the itzks-systems-workstation package -apt-get install --yes ocsinventory-agent +apt_install_if_not ocsinventory-agent itzks-systems.do_preseed -apt-get install -y itzks-systems-workstation +apt_install_if_not itzks-systems-workstation # Install wireless-tools for configuration of WiFi -apt-get install -y wireless-tools uuid-runtime +apt_install_if_not wireless-tools +apt_install_if_not uuid-runtime # Install libpacparser1 -apt-get install -y libpacparser1 +apt_install_if_not libpacparser1 # Make sure, we have Oracle's JAVA 8... (and that it is the default that people use) -apt-get install -y oracle-java8-bin oracle-java8-jre oracle-java8-plugin +apt_install_if_not oracle-java8-bin oracle-java8-jre oracle-java8-plugin update-java-alternatives --jre --set java-8-oracle update-java-alternatives --plugin --set java-8-oracle -# Install libdvdcss2 if needed -read -p "Verfügt der Rechner über ein DVD-Laufwerk bzw. sollen DVDs abgespielt werden könnne? (j/n)? " answer -case ${answer:0:1} in - y|Y|j|J ) - apt-get install -y libdvdcss2 - ;; - *) - : - ;; -esac -unset answer +if [ ! -d "/usr/share/doc/libdvdcss2" ]; then + # Install libdvdcss2 if needed + echo + echo "############################################################################################" + read -p "Verfügt der Rechner über ein DVD-Laufwerk bzw. sollen DVDs abgespielt werden könnne? (j/n)? " answer + case ${answer:0:1} in + y|Y|j|J ) + apt_install_if_not libdvdcss2 + ;; + *) + : + ;; + esac + unset answer +fi #################### @@ -191,7 +205,7 @@ EOT #################### # Configure Plymouth -apt-get install -y plymouth-themes +apt_install_if_not -y plymouth-themes plymouth-set-default-theme solar update-initramfs -k all -u @@ -221,7 +235,7 @@ fi # Install and enable puppet-agent on client echo '! Puppet-Agent wird installiert... ' -apt-get install -y puppet +apt_install_if_not install -y puppet echo 'Nun mit ssh auf den tjener wechseln und dort mit puppet cert --list die am Master angemeldeten |