diff --git a/BasicMetaDesktop/Dockerfile b/BasicMetaDesktop/Dockerfile index 8cbb876563d3a48e7193cc91cce9a7aa801c9a3b..723ce7fb97bdd871ac20cde9bfb3e640f6484241 100644 --- a/BasicMetaDesktop/Dockerfile +++ b/BasicMetaDesktop/Dockerfile @@ -37,41 +37,41 @@ RUN chmod 755 /opt/tigervnc/xstartup RUN apt-get install imwheel zenity x11-xserver-utils -y # Create the Desktop -RUN mkdir /metauser_vanilla/Desktop && chown metauser:metauser /metauser_vanilla/Desktop +RUN mkdir /metauser_home_vanilla/Desktop && chown metauser:metauser /metauser_home_vanilla/Desktop # Add mouse scrolling script COPY files/set_mouse_scrolling_speed /usr/bin/ -COPY files/Set_Mouse_Scrolling_Speed.desktop /metauser_vanilla/Desktop/ +COPY files/Set_Mouse_Scrolling_Speed.desktop /metauser_home_vanilla/Desktop/ RUN chmod 755 /usr/bin/set_mouse_scrolling_speed # Add Display Resolution stuff #COPY add_display_resolution /usr/bin/ #COPY add_display_resolution_gui /usr/bin/ -#COPY Set_Display_Resolution.desktop /metauser_vanilla/Desktop/ -#COPY Add_Display_Resolution.desktop /metauser_vanilla/Desktop/ +#COPY Set_Display_Resolution.desktop /metauser_home_vanilla/Desktop/ +#COPY Add_Display_Resolution.desktop /metauser_home_vanilla/Desktop/ #RUN chmod 755 /usr/bin/add_display_resolution && chmod 755 /usr/bin/add_display_resolution_gui # Correct ownership of Desktop shortcuts -RUN chown -R metauser:metauser /metauser_vanilla/Desktop/ +RUN chown -R metauser:metauser /metauser_home_vanilla/Desktop/ # Shorter bash prompt -#RUN echo "PS1=\"\u@MetaBox:\W $ \"" >> /metauser_vanilla/.bashrc +#RUN echo "PS1=\"\u@MetaBox:\W $ \"" >> /metauser_home_vanilla/.bashrc # Default conf (mostly eyecandy) -COPY files/home_metauser_.config /metauser_vanilla/.config -#COPY data/desktop-cf881dd7/metauser_vanilla/.config /metauser_vanilla/.config -RUN chown -R metauser:metauser /metauser_vanilla/.config +COPY files/home_metauser_.config /metauser_home_vanilla/.config +#COPY data/desktop-cf881dd7/metauser_home_vanilla/.config /metauser_home_vanilla/.config +RUN chown -R metauser:metauser /metauser_home_vanilla/.config # Disable screensaver -COPY files/dot_xscreensaver /metauser_vanilla/.xscreensaver -RUN chown metauser:metauser /metauser_vanilla/.xscreensaver +COPY files/dot_xscreensaver /metauser_home_vanilla/.xscreensaver +RUN chown metauser:metauser /metauser_home_vanilla/.xscreensaver # Disable logout dialog RUN chmod 000 /usr/bin/xfce4-session-logout # Create Downloads folder. This is "required" for showing proper spacing between icons in the filemanager a bounch -RUN mkdir /metauser_vanilla/Downloads && chown metauser:metauser /metauser_vanilla/Downloads +RUN mkdir /metauser_home_vanilla/Downloads && chown metauser:metauser /metauser_home_vanilla/Downloads #---------------------- diff --git a/BasicMetaDesktop/files/runshell.sh b/BasicMetaDesktop/files/runshell.sh index 164bdb1cc9656dae7bc4d550d0207326a92a532c..032fcc3b82ae397127989aa4aff56b57efa22df6 100644 --- a/BasicMetaDesktop/files/runshell.sh +++ b/BasicMetaDesktop/files/runshell.sh @@ -1,3 +1,3 @@ #!/bin/bash -cd /metauser +cd /home/metauser exec /bin/bash diff --git a/DevMetaDesktop/Dockerfile b/DevMetaDesktop/Dockerfile index 189b57eac1121673105146d1689b93601c96f8b1..32985c78aed2523dbc2e17b0a466dc9ceb33de28 100644 --- a/DevMetaDesktop/Dockerfile +++ b/DevMetaDesktop/Dockerfile @@ -30,11 +30,11 @@ COPY files/PyDev_3.4.1.zip /tmp RUN cd eclipse/dropins/ && unzip /tmp/PyDev_3.4.1.zip RUN mv eclipse /opt/ COPY files/eclipse128.png /opt/eclipse/eclipse128.png -COPY files/Eclipse.desktop /metauser_vanilla/Desktop/ -RUN chown -R metauser:metauser /metauser_vanilla/Desktop/ +COPY files/Eclipse.desktop /metauser_home_vanilla/Desktop/ +RUN chown -R metauser:metauser /metauser_home_vanilla/Desktop/ # Set terminals interrupt shortcut to ctrl-x -#RUN echo "stty intr ^x" >> /metauser_vanilla/.bashrc +#RUN echo "stty intr ^x" >> /metauser_home_vanilla/.bashrc # Enable Inet for ssh X forwarding #RUN echo "AddressFamily inet" >> /etc/ssh/sshd_config diff --git a/MinimalMetaDesktop/Dockerfile b/MinimalMetaDesktop/Dockerfile index b11015b3469ce931921bf498685f885cd40789ce..6499c5db993ae352224d54becdff743b4214d8ae 100644 --- a/MinimalMetaDesktop/Dockerfile +++ b/MinimalMetaDesktop/Dockerfile @@ -23,7 +23,7 @@ RUN apt-get install -y nano telnet unzip wget supervisor build-essential python- RUN groupadd -g 65527 metauser # Add user. We chose UID 65527 to try avoiding conflicts. -RUN useradd metauser -d /metauser -u 65527 -g 65527 -m -s /bin/bash +RUN useradd metauser -d /home/metauser -u 65527 -g 65527 -m -s /bin/bash # Add metuaser user to sudoers RUN adduser metauser sudo @@ -78,16 +78,20 @@ COPY files/xstartup /opt/tigervnc/ RUN chmod 755 /opt/tigervnc/xstartup # Prepare for logs -RUN mkdir /metauser/logs && chown metauser:metauser /metauser/logs +RUN mkdir /home/metauser/.logs && chown metauser:metauser /home/metauser/.logs # Rename metauser home folder as a "vanilla" home folder -RUN mv /metauser /metauser_vanilla +RUN mv /home/metauser /metauser_home_vanilla # Add fluxbox customisations -COPY files/dot_fluxbox /metauser_vanilla/.fluxbox -RUN chown -R metauser:metauser /metauser_vanilla/.fluxbox +COPY files/dot_fluxbox /metauser_home_vanilla/.fluxbox +RUN chown -R metauser:metauser /metauser_home_vanilla/.fluxbox COPY files/background.jpg /usr/share/images/fluxbox/background.jpg +# Give write access to anyone to the home folder so the entrypoint will be able +# to copy over the /home/matauser_vanilla into /home/metause (for Singularity) +RUN chmod 777 /home + #---------------------- # Entrypoint diff --git a/MinimalMetaDesktop/files/dot_fluxbox/init b/MinimalMetaDesktop/files/dot_fluxbox/init index 6b26e6ea519f1d592db3fdee11aeb7c19dbf8fbe..bf43e669fc8806be374d772f50fe6a1bbc5c1115 100644 --- a/MinimalMetaDesktop/files/dot_fluxbox/init +++ b/MinimalMetaDesktop/files/dot_fluxbox/init @@ -43,7 +43,7 @@ session.screen0.windowPlacement: RowMinOverlapPlacement session.screen0.focusNewWindows: true session.screen0.clickRaises: true session.screen0.maxDisableResize: false -session.screen0.windowMenu: /metauser/.fluxbox/windowmenu +session.screen0.windowMenu: /home/metauser/.fluxbox/windowmenu session.screen0.allowRemoteActions: false session.screen0.strftimeFormat: %d %b, %a %02k:%M:%S session.screen0.focusSameHead: false @@ -58,18 +58,18 @@ session.screen0.focusModel: ClickFocus session.screen0.showwindowposition: false session.screen0.maxIgnoreIncrement: true session.screen0.workspaces: 1 -session.styleOverlay: /metauser/.fluxbox/overlay +session.styleOverlay: /home/metauser/.fluxbox/overlay session.keyFile: ~/.fluxbox/keys session.cacheMax: 200 session.tabsAttachArea: Window -session.slitlistFile: /metauser/.fluxbox/slitlist +session.slitlistFile: /home/metauser/.fluxbox/slitlist session.forcePseudoTransparency: false session.tabPadding: 0 session.colorsPerChannel: 4 session.styleFile: /usr/share/fluxbox/styles//ubuntu-light session.autoRaiseDelay: 250 session.cacheLife: 5 -session.appsFile: /metauser/.fluxbox/apps +session.appsFile: /home/metauser/.fluxbox/apps session.ignoreBorder: false session.configVersion: 13 session.doubleClickInterval: 250 diff --git a/MinimalMetaDesktop/files/entrypoint.sh b/MinimalMetaDesktop/files/entrypoint.sh index fa31aea7eb8ec8e6cfcd9cb85e4de5ead8b0a121..8f083b9d0209ecf3da80cc33b2e7b162acc111f7 100644 --- a/MinimalMetaDesktop/files/entrypoint.sh +++ b/MinimalMetaDesktop/files/entrypoint.sh @@ -1,107 +1,99 @@ #!/bin/bash -# Exit on any error. More complex thing could be done in future + # Exit on any error. More complex thing could be done in future # (see https://stackoverflow.com/questions/4381618/exit-a-script-on-error) set -e -echo "" -echo "[INFO] Executing entrypoint..." -if [ "x$BASE_PORT" == "x" ]; then - echo "[INFO] No task base port set, will set noVNC port 8590 and VNC port 5900 with desktop id \"0\"" -else - echo "[INFO] Task base port set, will set noVNC port $BASE_PORT and noVNC port $(($BASE_PORT+1)) with desktop id \"$(($BASE_PORT-5900+1))\"" -fi - -#--------------------- -# Setup home -#--------------------- - -if [ -f "/metauser/.initialized" ]; then - : +if [ "x$SAFE_MODE" == "xTrue" ]; then + echo "" + echo "[INFO] Not executing entrypoint as we are in safe mode, just opening a Bash shell." + exec /bin/bash else - # First try without sudo (Singularity with --writable-tmpfs), then sudo (Docker) - echo "[INFO] Setting up home" + echo "" + echo "[INFO] Executing entrypoint..." - # Get immune to -e inside the curly brackets - { - cp -a /metauser_vanilla /metauser &> /dev/null - EXIT_CODE=$? - } || true + if [ "x$BASE_PORT" == "x" ]; then + echo "[INFO] No task base port set, will set noVNC port 8590 and VNC port 5900 with desktop id \"0\"" + else + echo "[INFO] Task base port set, will set noVNC port $BASE_PORT and noVNC port $(($BASE_PORT+1)) with desktop id \"$(($BASE_PORT-5900+1))\"" + fi - # Check if the above failed and we thus have to use sudo - if [ "$EXIT_CODE" != "0" ]; then - sudo cp -a /metauser_vanilla/. /metauser + #--------------------- + # Setup home + #--------------------- + + if [ -f "/home/metauser/.initialized" ]; then + : + else + echo "[INFO] Setting up home" + + # Copy over vanilla home contents + for x in /metauser_home_vanilla/* /metauser_home_vanilla/.[!.]* /metauser_home_vanilla/..?*; do + if [ -e "$x" ]; then cp -a "$x" /home/metauser/; fi + done + + # Mark as initialized + touch /home/metauser/.initialized fi - # Fix issues is mounting /metauser_vanilla from the outside - if [ -d "/metauser/metauser_vanilla" ]; then - for x in /metauser/metauser_vanilla/* /metauser/metauser_vanilla/.[!.]* /metauser/metauser_vanilla/..?*; do - if [ -e "$x" ]; then mv -- "$x" /metauser/; fi - done - rmdir /metauser/metauser_vanilla + # Manually set home (mainly for Singularity) + echo "[INFO] Setting up HOME env var" + export HOME=/home/metauser + cd /home/metauser + + #--------------------- + # Save env + #--------------------- + echo "[INFO] Dumping env" + + # Save env vars for later usage (e.g. ssh) + + env | \ + while read env_var; do + if [[ $env_var == HOME\=* ]]; then + : # Skip HOME var + elif [[ $env_var == PWD\=* ]]; then + : # Skip PWD var + else + echo "export $env_var" >> /tmp/env.sh + fi + done + + #--------------------- + # Password + #--------------------- + + if [ "x$AUTH_PASS" != "x" ]; then + echo "[INFO] Setting up VNC password..." + mkdir -p /home/metauser/.vnc + /opt/tigervnc/usr/bin/vncpasswd -f <<< $AUTH_PASS > /home/metauser/.vnc/passwd + chmod 600 /home/metauser/.vnc/passwd + export VNC_AUTH=True + else + echo "[INFO] Not setting up any VNC password" + fi - # Mark as initialized - touch /metauser/.initialized -fi - -# Manually set home (mainly for Singularity) -echo "[INFO] Setting up HOME env var" -export HOME=/metauser -cd /metauser - -#--------------------- -# Save env -#--------------------- -echo "[INFO] Dumping env" - -# Save env vars for later usage (e.g. ssh) - -env | \ -while read env_var; do - if [[ $env_var == HOME\=* ]]; then - : # Skip HOME var - elif [[ $env_var == PWD\=* ]]; then - : # Skip PWD var - else - echo "export $env_var" >> /tmp/env.sh - fi -done - -#--------------------- -# Password -#--------------------- + echo "[INFO] Setting new prompt @$CONTAINER_NAME container" + echo 'export PS1="${debian_chroot:+($debian_chroot)}\u@$CONTAINER_NAME@\h:\w\$ "' >> /home/metauser/.bashrc + + + + #--------------------- + # Entrypoint command + #--------------------- + + if [ "$@x" == "x" ]; then + DEFAULT_COMMAND="supervisord -c /etc/supervisor/supervisord.conf" + echo -n "[INFO] Executing default entrypoint command: " + echo $DEFAULT_COMMAND + exec $DEFAULT_COMMAND + else + echo -n "[INFO] Executing entrypoint command: " + echo $@ + exec $@ + fi -if [ "x$AUTH_PASS" != "x" ]; then - echo "[INFO] Setting up VNC password..." - mkdir -p /metauser/.vnc - /opt/tigervnc/usr/bin/vncpasswd -f <<< $AUTH_PASS > /metauser/.vnc/passwd - chmod 600 /metauser/.vnc/passwd - export VNC_AUTH=True -else - echo "[INFO] Not setting up any VNC password" - fi -echo "[INFO] Setting new prompt @$CONTAINER_NAME container" -echo 'export PS1="${debian_chroot:+($debian_chroot)}\u@$CONTAINER_NAME@\h:\w\$ "' >> /metauser/.bashrc - - - -#--------------------- -# Entrypoint command -#--------------------- - -if [ "$@x" == "x" ]; then - DEFAULT_COMMAND="supervisord -c /etc/supervisor/supervisord.conf" - echo -n "[INFO] Executing default entrypoint command: " - echo $DEFAULT_COMMAND - exec $DEFAULT_COMMAND -else - echo -n "[INFO] Executing entrypoint command: " - echo $@ - exec $@ -fi - - diff --git a/MinimalMetaDesktop/files/supervisord.conf b/MinimalMetaDesktop/files/supervisord.conf index 28b8cc96a8f447b99391250055d46dab5f6e3b56..16827aa904358c924888618a01e2b3026c9db68b 100644 --- a/MinimalMetaDesktop/files/supervisord.conf +++ b/MinimalMetaDesktop/files/supervisord.conf @@ -1,14 +1,14 @@ ; supervisor config file (modified for our own purpose) [unix_http_server] -file=/metauser/.supervisor.sock ; (the path to the socket file) -chmod=0700 ; sockef file mode (default 0700) +file=/home/metauser/.supervisor.sock ; (the path to the socket file) +chmod=0700 ; sockef file mode (default 0700) [supervisord] -logfile=/metauser/logs/supervisord.log ; (main log file;default $CWD/supervisord.log) -pidfile=/metauser/logs/supervisord.pid ; (supervisord pidfile;default supervisord.pid) -childlogdir=/metauser/logs ; ('AUTO' child log dir, default $TEMP) -nodaemon=true ; Mandatory to run Supervisor in foreground and avoid Docker to exit! +logfile=/home/metauser/.logs/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/home/metauser/.logs/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/home/metauser/.logs ; ('AUTO' child log dir, default $TEMP) +nodaemon=true ; Mandatory to run Supervisor in foreground and avoid Docker to exit! ; The below section must remain in the config file for RPC ; (supervisorctl/web interface) to work, additional interfaces may be @@ -17,7 +17,7 @@ nodaemon=true ; Mandatory to run Supervisor in foreground and supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] -serverurl=unix:///metauser/.supervisor.sock ; use a unix:// URL for a unix socket +serverurl=unix:///home/metauser/.supervisor.sock ; use a unix:// URL for a unix socket ; The [include] section can just contain the "files" setting. This ; setting can list multiple files (separated by whitespace or diff --git a/MinimalMetaDesktop/files/supervisord_novnc.conf b/MinimalMetaDesktop/files/supervisord_novnc.conf index abedb273d4af8e95a6e733ed952c9c118db36b7c..2a4e685fe1aead80d61cd4a5b48b6c981d8348f1 100644 --- a/MinimalMetaDesktop/files/supervisord_novnc.conf +++ b/MinimalMetaDesktop/files/supervisord_novnc.conf @@ -15,9 +15,9 @@ stopwaitsecs = 30 process_name = novnc ; Standard out / error -stdout_logfile = /metauser/logs/%(program_name)s.log +stdout_logfile = /home/metauser/.logs/%(program_name)s.log stdout_logfile_maxbytes = 5MB stdout_logfile_backups = 10 -stderr_logfile = /metauser/logs/%(program_name)s.log +stderr_logfile = /home/metauser/.logs/%(program_name)s.log stderr_logfile_maxbytes = 5MB stderr_logfile_backups = 10 diff --git a/MinimalMetaDesktop/files/supervisord_vnc.conf b/MinimalMetaDesktop/files/supervisord_vnc.conf index 782c7ffa08dcdb2a8bed029a967603ff8445b923..42aa37b339d52d8bddfd8a974c70446e51cfc786 100644 --- a/MinimalMetaDesktop/files/supervisord_vnc.conf +++ b/MinimalMetaDesktop/files/supervisord_vnc.conf @@ -15,9 +15,9 @@ stopwaitsecs = 30 process_name = vnc ; Standard out / error -stdout_logfile = /metauser/logs/%(program_name)s.log +stdout_logfile = /home/metauser/.logs/%(program_name)s.log stdout_logfile_maxbytes = 5MB stdout_logfile_backups = 10 -stderr_logfile = /metauser/logs/%(program_name)s.log +stderr_logfile = /home/metauser/.logs/%(program_name)s.log stderr_logfile_maxbytes = 5MB stderr_logfile_backups = 10 diff --git a/MinimalMetaDesktop/files/xstartup b/MinimalMetaDesktop/files/xstartup index 2d0930726762c4b60763f6eef60cecf2742a7b6b..0e58b35be8ad2dabf72090f0c66aa55126340acc 100644 --- a/MinimalMetaDesktop/files/xstartup +++ b/MinimalMetaDesktop/files/xstartup @@ -1,6 +1,6 @@ #!/bin/sh -cd /metauser +cd /home/metauser unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS diff --git a/MinimalMetaDesktop/metauser_home/.fluxbox/init b/MinimalMetaDesktop/metauser_home/.fluxbox/init index 6b26e6ea519f1d592db3fdee11aeb7c19dbf8fbe..bf43e669fc8806be374d772f50fe6a1bbc5c1115 100644 --- a/MinimalMetaDesktop/metauser_home/.fluxbox/init +++ b/MinimalMetaDesktop/metauser_home/.fluxbox/init @@ -43,7 +43,7 @@ session.screen0.windowPlacement: RowMinOverlapPlacement session.screen0.focusNewWindows: true session.screen0.clickRaises: true session.screen0.maxDisableResize: false -session.screen0.windowMenu: /metauser/.fluxbox/windowmenu +session.screen0.windowMenu: /home/metauser/.fluxbox/windowmenu session.screen0.allowRemoteActions: false session.screen0.strftimeFormat: %d %b, %a %02k:%M:%S session.screen0.focusSameHead: false @@ -58,18 +58,18 @@ session.screen0.focusModel: ClickFocus session.screen0.showwindowposition: false session.screen0.maxIgnoreIncrement: true session.screen0.workspaces: 1 -session.styleOverlay: /metauser/.fluxbox/overlay +session.styleOverlay: /home/metauser/.fluxbox/overlay session.keyFile: ~/.fluxbox/keys session.cacheMax: 200 session.tabsAttachArea: Window -session.slitlistFile: /metauser/.fluxbox/slitlist +session.slitlistFile: /home/metauser/.fluxbox/slitlist session.forcePseudoTransparency: false session.tabPadding: 0 session.colorsPerChannel: 4 session.styleFile: /usr/share/fluxbox/styles//ubuntu-light session.autoRaiseDelay: 250 session.cacheLife: 5 -session.appsFile: /metauser/.fluxbox/apps +session.appsFile: /home/metauser/.fluxbox/apps session.ignoreBorder: false session.configVersion: 13 session.doubleClickInterval: 250 diff --git a/MinimalMetaDesktop/metauser_home/logs/vnc.log b/MinimalMetaDesktop/metauser_home/logs/vnc.log index 51cc1d9a4a62e302ecfb8fbb54f0bca60e40264b..f7f02bebf021867c4fa4089c403107bc5f843f03 100644 --- a/MinimalMetaDesktop/metauser_home/logs/vnc.log +++ b/MinimalMetaDesktop/metauser_home/logs/vnc.log @@ -1,14 +1,14 @@ -xauth: file /metauser/.Xauthority does not exist +xauth: file /home/metauser/.Xauthority does not exist New '8424db806320:0 ()' desktop is 8424db806320:0 -Creating default config /metauser/.vnc/config +Creating default config /home/metauser/.vnc/config Starting applications specified in /opt/tigervnc/xstartup -Log file is /metauser/.vnc/8424db806320:0.log +Log file is /home/metauser/.vnc/8424db806320:0.log New 'f4fd1f7a7af8:0 ()' desktop is f4fd1f7a7af8:0 Starting applications specified in /opt/tigervnc/xstartup -Log file is /metauser/.vnc/f4fd1f7a7af8:0.log +Log file is /home/metauser/.vnc/f4fd1f7a7af8:0.log