From cf9eb578fed878a038d4c21aa15066d29526e3aa Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Wed, 16 Aug 2017 20:30:14 +0100 Subject: [PATCH] Add local etc skeleton files --- Dockerfile | 18 +++++++----------- skel/group | 26 ++++++++++++++++++++++++++ skel/passwd | 9 +++++++++ skel/profile | 20 ++++++++++++++++++++ skel/shadow | 9 +++++++++ 5 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 skel/group create mode 100644 skel/passwd create mode 100644 skel/profile create mode 100644 skel/shadow diff --git a/Dockerfile b/Dockerfile index 5ea12a1..8d96d33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,18 +80,12 @@ RUN curl -fL https://busybox.net/downloads/busybox-${BUSYB_VER}.tar.bz2 \ WORKDIR $PREFIX -# Add default skeleton configuration files -RUN for f in passwd shadow group profile; do \ - curl -fL -o "${PREFIX}/etc/$f" "https://git.busybox.net/buildroot/plain/system/skeleton/etc/$f"; \ - done && \ - \ - # Copy UTC localtime to output - cp /usr/share/zoneinfo/Etc/UTC etc/ - # Generate initial ld.so.cache so ELF binaries work. # This is important otherwise everything will error with # 'no such file or directory' when looking for libraries -RUN ${PREFIX}/sbin/ldconfig -r ${PREFIX} +RUN ${PREFIX}/sbin/ldconfig -r ${PREFIX} && \ + # Copy UTC localtime to output + cp /usr/share/zoneinfo/Etc/UTC etc/ # ============= @@ -99,9 +93,11 @@ FROM scratch WORKDIR / COPY --from=builder /output/ / -RUN mkdir -p /tmp && \ - chmod 1777 /tmp +# Add default skeleton configuration files +ADD skel/* /etc/ +RUN chmod 1777 /tmp +ENV ENV="/etc/profile" ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/bin CMD ["/bin/sh"] diff --git a/skel/group b/skel/group new file mode 100644 index 0000000..76346b3 --- /dev/null +++ b/skel/group @@ -0,0 +1,26 @@ +root:x:0: +daemon:x:1: +bin:x:2: +sys:x:3: +adm:x:4: +tty:x:5: +disk:x:6: +lp:x:7: +mail:x:8: +kmem:x:9: +wheel:x:10:root +cdrom:x:11: +dialout:x:18: +floppy:x:19: +video:x:28: +audio:x:29: +tape:x:32: +www-data:x:33: +operator:x:37: +utmp:x:43: +plugdev:x:46: +staff:x:50: +lock:x:54: +netdev:x:82: +users:x:100: +nogroup:x:65534: diff --git a/skel/passwd b/skel/passwd new file mode 100644 index 0000000..d8281d2 --- /dev/null +++ b/skel/passwd @@ -0,0 +1,9 @@ +root:x:0:0:root:/root:/bin/sh +daemon:x:1:1:daemon:/usr/sbin:/bin/false +bin:x:2:2:bin:/bin:/bin/false +sys:x:3:3:sys:/dev:/bin/false +sync:x:4:100:sync:/bin:/bin/sync +mail:x:8:8:mail:/var/spool/mail:/bin/false +www-data:x:33:33:www-data:/var/www:/bin/false +operator:x:37:37:Operator:/var:/bin/false +nobody:x:65534:65534:nobody:/home:/bin/false diff --git a/skel/profile b/skel/profile new file mode 100644 index 0000000..ce9f709 --- /dev/null +++ b/skel/profile @@ -0,0 +1,20 @@ +export PAGER='/bin/less -R' +export EDITOR='/bin/vi' +export PS1='\u@\h \w> ' + +# Source configuration files from /etc/profile.d +for i in /etc/profile.d/*.sh ; do + if [ -r "$i" ]; then + . $i + fi + unset i +done + +# Common interactive aliases +alias ls='ls --color=auto -Fh' +alias ll='ls -l' +alias la='ls -la' + +alias cp='cp -i' +alias mv='mv -i' +alias rm='rm -i' diff --git a/skel/shadow b/skel/shadow new file mode 100644 index 0000000..06778f1 --- /dev/null +++ b/skel/shadow @@ -0,0 +1,9 @@ +root::10933:0:99999:7::: +daemon:*:10933:0:99999:7::: +bin:*:10933:0:99999:7::: +sys:*:10933:0:99999:7::: +sync:*:10933:0:99999:7::: +mail:*:10933:0:99999:7::: +www-data:*:10933:0:99999:7::: +operator:*:10933:0:99999:7::: +nobody:*:10933:0:99999:7:::