Release, components and repos as build args

This commit is contained in:
Andrey Volkov 2018-10-24 07:01:07 -07:00
parent fe54727339
commit 1cf350e597
2 changed files with 14 additions and 11 deletions

View File

@ -55,12 +55,20 @@ ARG EMAIL_ADDRESS="youremail@example.com"
ARG GPG_PASSWORD="PickAPassword"
ARG HOSTNAME=localhost
ARG MODE=packages
ARG UBUNTU_RELEASE=xenial
ARG UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
ARG COMPONENTS="main universe"
ARG REPOS="${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security"
ENV FULL_NAME ${FULL_NAME}
ENV EMAIL_ADDRESS ${EMAIL_ADDRESS}
ENV GPG_PASSWORD ${GPG_PASSWORD}
ENV HOSTNAME ${HOSTNAME}
ENV MODE ${MODE}
ENV UBUNTU_RELEASE=${UBUNTU_RELEASE}
ENV UPSTREAM_URL=${UPSTREAM_URL}
ENV COMPONENTS=${COMPONENTS}
ENV REPOS=${REPOS}
COPY assets/packages /opt/packages
COPY assets/gpg/* /opt/aptly/

View File

@ -11,11 +11,6 @@ set -x
# For more detail about each of the variables below refer to:
# https://help.ubuntu.com/community/Repositories/CommandLine
UBUNTU_RELEASE=xenial
UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
COMPONENTS=( main universe )
REPOS=( ${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security )
if [ "$MODE" = "packages" ]; then
FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
else
@ -24,8 +19,8 @@ fi
# Create repository mirrors if they don't exist
set +e
for component in ${COMPONENTS[@]}; do
for repo in ${REPOS[@]}; do
for component in ${COMPONENTS}; do
for repo in ${REPOS}; do
aptly mirror list -raw | grep "^${repo}-${component}$"
if [[ $? -ne 0 ]]; then
echo "Creating mirror of ${repo}-${component} repository."
@ -37,16 +32,16 @@ done
set -e
# Update all repository mirrors
for component in ${COMPONENTS[@]}; do
for repo in ${REPOS[@]}; do
for component in ${COMPONENTS}; do
for repo in ${REPOS}; do
echo "Updating ${repo}-${component} repository mirror.."
aptly mirror update ${repo}-${component}
done
done
# Create snapshots of updated repositories
for component in ${COMPONENTS[@]}; do
for repo in ${REPOS[@]}; do
for component in ${COMPONENTS}; do
for repo in ${REPOS}; do
echo "Creating snapshot of ${repo}-${component} repository mirror.."
SNAPSHOTARRAY+="${repo}-${component}-`date +%Y%m%d%H` "
aptly snapshot create ${repo}-${component}-`date +%Y%m%d%H` from mirror ${repo}-${component}