Inital commit.

This commit is contained in:
Shady Ibraheem
2019-11-15 15:23:41 -05:00
parent a8289fbefa
commit f396818e23
208 changed files with 10770 additions and 95 deletions

View File

@@ -0,0 +1,23 @@
#!/bin/bash
################################################################################
## File: apt.sh
## Desc: This script contains helper functions for using dpkg and apt
################################################################################
## Use dpkg to figure out if a package has already been installed
## Example use:
## if ! IsInstalled packageName; then
## echo "packageName is not installed!"
## fi
function IsInstalled {
dpkg -S $1 &> /dev/null
}
# Configure apt to always assume Y
echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
# Use apt-fast for parallel downloads
apt-get install aria2
add-apt-repository -y ppa:apt-fast/stable
apt-get update
apt-get -y install apt-fast

View File

@@ -0,0 +1,31 @@
#!/bin/bash
source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.sh
# Check prereqs
echo "Checking prereqs for image pulls"
if ! command -v docker; then
echo "Docker is not installed, cant pull images"
exit 1
fi
# Information output
systemctl status docker --no-pager
# Pull images
images=(
docker.io/jekyll/builder
mcr.microsoft.com/azure-pipelines/node8-typescript
)
for image in "${images[@]}"; do
docker pull "$image"
done
## Add container information to the metadata file
DocumentInstalledItem "Cached container images"
while read -r line; do
DocumentInstalledItemIndent "$line"
done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')"

View File

@@ -0,0 +1,30 @@
#!/bin/bash
################################################################################
## File: document.sh
## Desc: Helper functions for writing information to the metadata document
################################################################################
function WriteItem {
if [ -z "$METADATA_FILE" ]; then
echo "METADATA_FILE environment variable must be set to output to Metadata Document!"
return 1;
else
echo -e "$1" >> "$METADATA_FILE"
fi
}
function AddTitle {
WriteItem "# $1"
}
function AddSubTitle {
WriteItem "## $1"
}
function DocumentInstalledItem {
WriteItem "- $1"
}
function DocumentInstalledItemIndent {
WriteItem " - $1"
}