Bladeren bron

Fix Apptainer username

Seungmin Kim 1 jaar geleden
bovenliggende
commit
e99622239e
2 gewijzigde bestanden met toevoegingen van 5 en 5 verwijderingen
  1. 3 3
      entrypoint.sh
  2. 2 2
      supervisord.conf

+ 3 - 3
entrypoint.sh

@@ -10,10 +10,10 @@ trap "echo TRAPed signal" HUP INT QUIT TERM
 
 # Wait for XDG_RUNTIME_DIR
 until [ -d "${XDG_RUNTIME_DIR}" ]; do sleep 0.5; done
-# Make user directory owned by the default ubuntu user
-chown -f ubuntu:ubuntu ~ || sudo-root chown -f ubuntu:ubuntu ~ || chown -R -f -h --no-preserve-root ubuntu:ubuntu ~ || sudo-root chown -R -f -h --no-preserve-root ubuntu:ubuntu ~ || echo 'Failed to change user directory permissions, there may be permission issues'
+# Make user directory owned by the default user
+chown -f "$(id -nu):$(id -ng)" ~ || sudo-root chown -f "$(id -nu):$(id -ng)" ~ || chown -R -f -h --no-preserve-root "$(id -nu):$(id -ng)" ~ || sudo-root chown -R -f -h --no-preserve-root "$(id -nu):$(id -ng)" ~ || echo 'Failed to change user directory permissions, there may be permission issues'
 # Change operating system password to environment variable
-(echo "${PASSWD}"; echo "${PASSWD}";) | sudo passwd ubuntu || (echo "mypasswd"; echo "${PASSWD}"; echo "${PASSWD}";) | passwd ubuntu || echo 'Password change failed, using default password'
+(echo "${PASSWD}"; echo "${PASSWD}";) | sudo passwd "$(id -nu)" || (echo "mypasswd"; echo "${PASSWD}"; echo "${PASSWD}";) | passwd "$(id -nu)" || echo 'Password change failed, using default password'
 # Remove directories to make sure the desktop environment starts
 rm -rf /tmp/.X* ~/.cache || echo 'Failed to clean X11 paths'
 # Change time zone from environment variable

+ 2 - 2
supervisord.conf

@@ -14,7 +14,7 @@ loglevel=info
 pidfile=/tmp/supervisord.pid
 childlogdir=/tmp
 nodaemon=true
-user=ubuntu
+user=%(ENV_USER)s
 
 [rpcinterface:supervisor]
 supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
@@ -38,7 +38,7 @@ autorestart=true
 priority=1
 
 [program:dbus]
-command=bash -c "mkdir -pm700 \"${XDG_RUNTIME_DIR}\"; chown -f ubuntu:ubuntu \"${XDG_RUNTIME_DIR}\"; chmod -f 700 \"${XDG_RUNTIME_DIR}\"; dbus-daemon --system --nofork --nosyslog --nopidfile --address=\"${DBUS_SYSTEM_BUS_ADDRESS}\""
+command=bash -c "mkdir -pm700 \"${XDG_RUNTIME_DIR}\"; chown -f \"$(id -nu):$(id -ng)\" \"${XDG_RUNTIME_DIR}\"; chmod -f 700 \"${XDG_RUNTIME_DIR}\"; dbus-daemon --system --nofork --nosyslog --nopidfile --address=\"${DBUS_SYSTEM_BUS_ADDRESS}\""
 environment=DISPLAY="%(ENV_DISPLAY)s",XDG_RUNTIME_DIR="%(ENV_XDG_RUNTIME_DIR)s",DBUS_SYSTEM_BUS_ADDRESS="%(ENV_DBUS_SYSTEM_BUS_ADDRESS)s"
 stdout_logfile=/tmp/dbus.log
 stdout_logfile_maxbytes=5MB