summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Volkov <av903u@att.com>2018-10-24 07:01:07 -0700
committerAndrey Volkov <av903u@att.com>2018-10-24 07:01:07 -0700
commit1cf350e59785ec77a3265bae42b748ff6c6cb3ad (patch)
tree82753dda7e02b6785f19526c78f965570bfb5f6f
parentfe54727339b66253e2e7e5a74a02e0536980efe2 (diff)
Release, components and repos as build args
-rw-r--r--Dockerfile8
-rwxr-xr-xassets/update_mirror_ubuntu.sh17
2 files changed, 14 insertions, 11 deletions
diff --git a/Dockerfile b/Dockerfile
index a5ec859..a7d160d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -55,12 +55,20 @@ ARG EMAIL_ADDRESS="youremail@example.com"
55ARG GPG_PASSWORD="PickAPassword" 55ARG GPG_PASSWORD="PickAPassword"
56ARG HOSTNAME=localhost 56ARG HOSTNAME=localhost
57ARG MODE=packages 57ARG MODE=packages
58ARG UBUNTU_RELEASE=xenial
59ARG UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
60ARG COMPONENTS="main universe"
61ARG REPOS="${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security"
58 62
59ENV FULL_NAME ${FULL_NAME} 63ENV FULL_NAME ${FULL_NAME}
60ENV EMAIL_ADDRESS ${EMAIL_ADDRESS} 64ENV EMAIL_ADDRESS ${EMAIL_ADDRESS}
61ENV GPG_PASSWORD ${GPG_PASSWORD} 65ENV GPG_PASSWORD ${GPG_PASSWORD}
62ENV HOSTNAME ${HOSTNAME} 66ENV HOSTNAME ${HOSTNAME}
63ENV MODE ${MODE} 67ENV MODE ${MODE}
68ENV UBUNTU_RELEASE=${UBUNTU_RELEASE}
69ENV UPSTREAM_URL=${UPSTREAM_URL}
70ENV COMPONENTS=${COMPONENTS}
71ENV REPOS=${REPOS}
64 72
65COPY assets/packages /opt/packages 73COPY assets/packages /opt/packages
66COPY assets/gpg/* /opt/aptly/ 74COPY 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
11# For more detail about each of the variables below refer to: 11# For more detail about each of the variables below refer to:
12# https://help.ubuntu.com/community/Repositories/CommandLine 12# https://help.ubuntu.com/community/Repositories/CommandLine
13 13
14UBUNTU_RELEASE=xenial
15UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
16COMPONENTS=( main universe )
17REPOS=( ${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security )
18
19if [ "$MODE" = "packages" ]; then 14if [ "$MODE" = "packages" ]; then
20 FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps) 15 FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
21else 16else
@@ -24,8 +19,8 @@ fi
24 19
25# Create repository mirrors if they don't exist 20# Create repository mirrors if they don't exist
26set +e 21set +e
27for component in ${COMPONENTS[@]}; do 22for component in ${COMPONENTS}; do
28 for repo in ${REPOS[@]}; do 23 for repo in ${REPOS}; do
29 aptly mirror list -raw | grep "^${repo}-${component}$" 24 aptly mirror list -raw | grep "^${repo}-${component}$"
30 if [[ $? -ne 0 ]]; then 25 if [[ $? -ne 0 ]]; then
31 echo "Creating mirror of ${repo}-${component} repository." 26 echo "Creating mirror of ${repo}-${component} repository."
@@ -37,16 +32,16 @@ done
37set -e 32set -e
38 33
39# Update all repository mirrors 34# Update all repository mirrors
40for component in ${COMPONENTS[@]}; do 35for component in ${COMPONENTS}; do
41 for repo in ${REPOS[@]}; do 36 for repo in ${REPOS}; do
42 echo "Updating ${repo}-${component} repository mirror.." 37 echo "Updating ${repo}-${component} repository mirror.."
43 aptly mirror update ${repo}-${component} 38 aptly mirror update ${repo}-${component}
44 done 39 done
45done 40done
46 41
47# Create snapshots of updated repositories 42# Create snapshots of updated repositories
48for component in ${COMPONENTS[@]}; do 43for component in ${COMPONENTS}; do
49 for repo in ${REPOS[@]}; do 44 for repo in ${REPOS}; do
50 echo "Creating snapshot of ${repo}-${component} repository mirror.." 45 echo "Creating snapshot of ${repo}-${component} repository mirror.."
51 SNAPSHOTARRAY+="${repo}-${component}-`date +%Y%m%d%H` " 46 SNAPSHOTARRAY+="${repo}-${component}-`date +%Y%m%d%H` "
52 aptly snapshot create ${repo}-${component}-`date +%Y%m%d%H` from mirror ${repo}-${component} 47 aptly snapshot create ${repo}-${component}-`date +%Y%m%d%H` from mirror ${repo}-${component}