mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-23 03:00:08 +00:00
[provisioning] Only update APT cache when necessary
This commit is contained in:
parent
79d0fc0447
commit
c6c494d070
1 changed files with 4 additions and 5 deletions
|
@ -1,14 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ -z "$__apt_updated" ]; then
|
||||
_run "Update APT cache" sudo apt-get update
|
||||
__apt_updated=yes
|
||||
fi
|
||||
|
||||
function _apt {
|
||||
local pkg=$1
|
||||
if ! dpkg -s $pkg >/dev/null 2>&1; then
|
||||
if [ -z "$__apt_updated" ]; then
|
||||
_run "Update APT cache" sudo apt-get update
|
||||
__apt_updated=yes
|
||||
fi
|
||||
_run "[apt] Install $pkg" sudo apt-get install -y $1
|
||||
else
|
||||
echo "[apt] $pkg is already installed, skipping."
|
||||
|
|
Loading…
Reference in a new issue