From 43058840ce852ef8865c455c65214d117b3b86b9 Mon Sep 17 00:00:00 2001
From: Griefed <griefed@griefed.de>
Date: Sun, 18 Oct 2020 00:18:00 +0200
Subject: [PATCH] Fix links, permissions, initial setup

---
 Dockerfile                                     | 18 +++++++-----------
 .../etc/cont-init.d/{40-install => 50-install} |  2 +-
 root/etc/cont-init.d/{50-config => 60-config}  | 18 ++++++++++--------
 3 files changed, 18 insertions(+), 20 deletions(-)
 rename root/etc/cont-init.d/{40-install => 50-install} (90%)
 rename root/etc/cont-init.d/{50-config => 60-config} (83%)

diff --git a/Dockerfile b/Dockerfile
index 5e9c3f3..4a60fe7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -66,18 +66,14 @@ RUN \
             zip && \
         echo "**** configure php, including symlink ****" && \
         ln -sf \
-            /usr/bin/php7 \
-            /usr/bin/php && \
+       	    /usr/bin/php7 \
+       	    /usr/bin/php && \
         sed -i \
-            -e "s#\output_buffering =.*#\output_buffering = \off#g" \
-            -e "s/post_max_size =.*$/post_max_size = 1560M/" \
-            -e "s/upload_max_filesize =.*$/upload_max_filesize = 2048M/" \
-            -e 's#;session.save_path = "/tmp"#session.save_path = "/config/sess"#g' \
-                /etc/php7/php.ini && \
-        echo "**** Cleanup ****" && \
-        rm -rf \
-            /root/.cache \
-            /tmp/* && \
+       	    -e "s#\output_buffering =.*#\output_buffering = \off#g" \
+       	    -e "s/post_max_size =.*$/post_max_size = 1560M/" \
+       	    -e "s/upload_max_filesize =.*$/upload_max_filesize = 2048M/" \
+   	        -e 's#;session.save_path = "/tmp"#session.save_path = "/config/sess"#g' \
+       		     /etc/php7/php.ini && \
         echo "**** Misc ****" && \
         echo ${ICECODER_VERSION} > /version.txt
 
diff --git a/root/etc/cont-init.d/40-install b/root/etc/cont-init.d/50-install
similarity index 90%
rename from root/etc/cont-init.d/40-install
rename to root/etc/cont-init.d/50-install
index 6e7334a..40e90c7 100644
--- a/root/etc/cont-init.d/40-install
+++ b/root/etc/cont-init.d/50-install
@@ -1,7 +1,7 @@
 #!/usr/bin/with-contenv bash
 
 ICECODER_VERSION=$(cat /version.txt)
-if [ ! -f "/config/www/ICEcoder/index.php" ]; then
+if [ ! -f "/app/ICEcoder/index.php" ]; then
 	curl -o /tmp/install.zip  -L \
 		"https://github.com/icecoder/ICEcoder/archive/${ICECODER_VERSION}.zip"
 	cd /tmp || exit
diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/60-config
similarity index 83%
rename from root/etc/cont-init.d/50-config
rename to root/etc/cont-init.d/60-config
index dced70d..079ba5f 100644
--- a/root/etc/cont-init.d/50-config
+++ b/root/etc/cont-init.d/60-config
@@ -6,13 +6,15 @@ ln -sf /plugins /app/ICEcoder/plugins
 
 # permissions
 chown -R abc:abc \
-/config \
-/data \
-/plugins
+  /config \
+  /data \
+  /plugins
 
+echo "[cont-init.d] Checking for lock.file"
 # check for lock file to only run git operations once
 if [ ! -e /lock.file ]; then
   # Give abc a sudo shell for development
+  echo "Lock does not exist, cloning repository"
   chsh abc -s /bin/bash
   sed -e 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' \
     -i /etc/sudoers
@@ -26,7 +28,7 @@ if [ ! -e /lock.file ]; then
   fi
 else
   # lock exists not importing project this is a restart
-  echo "Lock exists just starting pylon"
+  echo "Lock exists just starting ICEcoder"
 fi
 
 # create lock file after first run
@@ -41,9 +43,9 @@ cp /config/php/php.ini /etc/php7/php.ini
 mkdir -p /config/sessions
 echo "[cont-init.d] Setting permissions this may take some time"
 chown -R abc:abc \
- /data \
- /config \
- /plugins
+  /data \
+  /config \
+  /plugins
 # make our folders
 mkdir -p \
-/config/{log/ICEcoder,php,sess}
+  /config/{log/ICEcoder,php,sess}
-- 
GitLab