diff --git a/Dockerfile b/Dockerfile index a5ec859..a7d160d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/assets/update_mirror_ubuntu.sh b/assets/update_mirror_ubuntu.sh index 72d8212..336eb00 100755 --- a/assets/update_mirror_ubuntu.sh +++ b/assets/update_mirror_ubuntu.sh @@ -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}