소스 검색

Extract Tarball on boot (#127)

* reworking logic to untar on first boot and reducing sample size for chown logic as it is not recursive

* bad path in arm variants
Ryan Kuba 7 년 전
부모
커밋
0f9f1ef4d3
4개의 변경된 파일과 14개의 추가작업 그리고 27개의 파일을 삭제
  1. 2 8
      Dockerfile
  2. 2 8
      Dockerfile.aarch64
  3. 2 8
      Dockerfile.armhf
  4. 8 3
      root/etc/cont-init.d/30-config

+ 2 - 8
Dockerfile

@@ -320,14 +320,8 @@ RUN \
  echo "**** Add Picons ****" && \
  mkdir -p /picons && \
  curl -o \
-        /tmp/picons.tar.bz2 -L \
-        https://lsio-ci.ams3.digitaloceanspaces.com/picons/picons.tar.bz2 && \
- tar xf \
- /tmp/picons.tar.bz2 -C \
-        /picons && \
- echo "**** cleanup ****" && \
- rm -rf \
-        /tmp/*
+        /picons.tar.bz2 -L \
+        https://lsio-ci.ams3.digitaloceanspaces.com/picons/picons.tar.bz2
 
 # copy local files and buildstage artifacts
 COPY --from=buildstage /tmp/argtable-build/usr/ /usr/

+ 2 - 8
Dockerfile.aarch64

@@ -316,14 +316,8 @@ RUN \
  echo "**** Add Picons ****" && \
  mkdir -p /picons && \
  curl -o \
-        /tmp/picons.tar.bz2 -L \
-        https://lsio-ci.ams3.digitaloceanspaces.com/picons/picons.tar.bz2 && \
- tar xf \
- /tmp/picons.tar.bz2 -C \
-        /picons && \
- echo "**** cleanup ****" && \
- rm -rf \
-        /tmp/*
+        /picons.tar.bz2 -L \
+        https://lsio-ci.ams3.digitaloceanspaces.com/picons/picons.tar.bz2
 
 # copy local files and buildstage artifacts
 COPY --from=buildstage /tmp/argtable-build/usr/ /usr/

+ 2 - 8
Dockerfile.armhf

@@ -316,14 +316,8 @@ RUN \
  echo "**** Add Picons ****" && \
  mkdir -p /picons && \
  curl -o \
-        /tmp/picons.tar.bz2 -L \
-        https://lsio-ci.ams3.digitaloceanspaces.com/picons/picons.tar.bz2 && \
- tar xf \
- /tmp/picons.tar.bz2 -C \
-        /picons && \
- echo "**** cleanup ****" && \
- rm -rf \
-        /tmp/*
+        /picons.tar.bz2 -L \
+        https://lsio-ci.ams3.digitaloceanspaces.com/picons/picons.tar.bz2
 
 # copy local files and buildstage artifacts
 COPY --from=buildstage /tmp/argtable-build/usr/ /usr/

+ 8 - 3
root/etc/cont-init.d/30-config

@@ -12,12 +12,17 @@ mkdir -p \
 [[ ! -e /config/config ]] && \
         (cp /defaults/config /config/config)
 
+# extract picons on first run
+[[ -f /picons.tar.bz2 ]] && \
+	tar xf \
+		/picons.tar.bz2 -C \
+		/picons &&
+	rm -f /picons.tar.bz2
 
-
-# function to randomly sample 10 files for their owner and only chown if not abc
+# function to randomly sample 5 files for their owner and only chown if not abc
 chowner () {
 files=(${1}/*)
-for i in {1..10}; do
+for i in {1..5}; do
         user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}"))
         if [ "${user}" != "abc" ]; then
                 chown -R abc:abc ${1}