Skip to content

Commit

Permalink
Create lib.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr authored Aug 17, 2023
1 parent 80a6104 commit 01bc866
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# https://github.com/devcontainers/features/blob/9fd5daf06b40794a067c4cdbb8e258d99eeefc24/src/node/install.sh
apt_get_update() {
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}

# https://github.com/devcontainers/features/blob/9fd5daf06b40794a067c4cdbb8e258d99eeefc24/src/node/install.sh
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}

0 comments on commit 01bc866

Please sign in to comment.