mirror of
https://github.com/correl/dotfiles.git
synced 2025-04-11 09:11:05 -09: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
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -z "$__apt_updated" ]; then
|
|
||||||
_run "Update APT cache" sudo apt-get update
|
|
||||||
__apt_updated=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
function _apt {
|
function _apt {
|
||||||
local pkg=$1
|
local pkg=$1
|
||||||
if ! dpkg -s $pkg >/dev/null 2>&1; then
|
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
|
_run "[apt] Install $pkg" sudo apt-get install -y $1
|
||||||
else
|
else
|
||||||
echo "[apt] $pkg is already installed, skipping."
|
echo "[apt] $pkg is already installed, skipping."
|
||||||
|
|
Loading…
Add table
Reference in a new issue