From 18764d58cb560efd2976988c8a3c97293bd8dc32 Mon Sep 17 00:00:00 2001
From: Griefed <griefed@griefed.de>
Date: Tue, 22 Jun 2021 22:02:13 +0200
Subject: [PATCH] refactor: Rename default user. Hopefully ensure aliases are
 set in resulting container

---
 Dockerfile                       | 11 ++++++-----
 root/etc/cont-init.d/10-adduser  | 16 ++++++++--------
 root/etc/profile.d/00-aliases.sh |  2 ++
 3 files changed, 16 insertions(+), 13 deletions(-)
 create mode 100644 root/etc/profile.d/00-aliases.sh

diff --git a/Dockerfile b/Dockerfile
index 19587c5..171d8db 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -93,6 +93,7 @@ RUN \
     > /run/systemd/container && \
   echo "**** Install apt-utils and locales ****" && \
   apt-get update && \
+  apt-get upgrade -y && \
   apt-get install -y \
     apt-utils \
     locales && \
@@ -104,22 +105,22 @@ RUN \
     tzdata && \
   echo "**** Generate locale ****" && \
   locale-gen en_US.UTF-8 && \
-  echo "**** Create abc user and make our folders ****" && \
-  useradd -u 911 -U -d /config -s /bin/false abc && \
-  usermod -G users abc && \
+  echo "**** Create grfd user and make our folders ****" && \
+  useradd -u 911 -U -d /config -s /bin/false grfd && \
+  usermod -G users grfd && \
   mkdir -p \
     /app \
     /config \
     /data \
     /defaults && \
   mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
-  patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
   echo "**** Create our bash-aliases ****" && \
   alias ll="LC_COLLATE=C ls -ahl --group-directories-first --color=auto" && \
   alias ..="cd .." && \
   echo "**** Cleanup ****" && \
   apt-get remove -y patch && \
-  apt-get autoremove && \
+  apt-get autoremove -y && \
+  apt-get autoclean -y
   apt-get clean && \
   rm -rf \
     /tmp/* \
diff --git a/root/etc/cont-init.d/10-adduser b/root/etc/cont-init.d/10-adduser
index ebe7e48..19f391d 100644
--- a/root/etc/cont-init.d/10-adduser
+++ b/root/etc/cont-init.d/10-adduser
@@ -3,8 +3,8 @@
 PUID=${PUID:-911}
 PGID=${PGID:-911}
 
-groupmod -o -g "$PGID" abc
-usermod -o -u "$PUID" abc
+groupmod -o -g "$PGID" grfd
+usermod -o -u "$PUID" grfd
 
 echo '
 -------------------------------------
@@ -34,8 +34,8 @@ echo '
 GID/UID
 -------------------------------------'
 echo "
-User uid:    $(id -u abc)
-User gid:    $(id -g abc)
+User uid:    $(id -u grfd)
+User gid:    $(id -g grfd)
 -------------------------------------
 "
 
@@ -55,7 +55,7 @@ Some apps might not behave correctly without this
 '
 fi
 
-chown abc:abc /app
-chown abc:abc /config
-chown abc:abc /data
-chown abc:abc /defaults
+chown grfd:grfd /app
+chown grfd:grfd /config
+chown grfd:grfd /data
+chown grfd:grfd /defaults
diff --git a/root/etc/profile.d/00-aliases.sh b/root/etc/profile.d/00-aliases.sh
new file mode 100644
index 0000000..be71cca
--- /dev/null
+++ b/root/etc/profile.d/00-aliases.sh
@@ -0,0 +1,2 @@
+alias ll="LC_COLLATE=C ls -ahl --group-directories-first --color=auto"
+alias ..="cd .."
\ No newline at end of file
-- 
GitLab