File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,11 +8,16 @@ ARCH=$(uname -m)
88# Context check
99[[ -z " ${AMPUSERID} " ]] && { echo " [Error] This docker image cannot be used directly by itself - it must be started by ampinstmgr" ; exit 100; }
1010
11- # Create /etc/machine-id (addresses Proton/dbus issues)
11+ # Create /etc/machine-id using the instance UUID if AMP_INSTANCE_ID exists (addresses Proton/dbus issues)
1212mkdir -p /var/lib/dbus
1313rm -f /etc/machine-id /var/lib/dbus/machine-id
14- dbus-uuidgen --ensure=/etc/machine-id
15- ln -s /etc/machine-id /var/lib/dbus/machine-id
14+ if [[ -n " ${AMP_INSTANCE_ID:- } " ]]; then
15+ printf ' %s\n' " ${AMP_INSTANCE_ID// -/ } " > /etc/machine-id
16+ else
17+ dbus-uuidgen --ensure=/etc/machine-id
18+ fi
19+ ln -sf /etc/machine-id /var/lib/dbus/machine-id
20+ chmod 0444 /etc/machine-id
1621
1722# Create /tmp/.X11-unix (for Xvfb etc)
1823install -d -o root -g root -m 1777 /tmp/.X11-unix
@@ -110,7 +115,7 @@ keep_env=(
110115 CARGO_HOME=" ${CARGO_HOME} "
111116)
112117# Always keep these AMP_ env vars if set
113- for v in AMPHOSTPLATFORM AMP_CONTAINER AMP_CONTAINER_HOST_NETWORK AMPMEMORYLIMIT AMPSWAPLIMIT AMPCONTAINERCPUS; do
118+ for v in AMPHOSTPLATFORM AMP_CONTAINER AMP_CONTAINER_HOST_NETWORK AMPMEMORYLIMIT AMPSWAPLIMIT AMPCONTAINERCPUS AMP_INSTANCE_ID ; do
114119 if [[ -n " ${! v-} " ]]; then keep_env+=(" $v =${! v} " ); fi
115120done
116121# Extra passthrough of env vars listed in AMP_ADDITIONAL_ENV_VARS in the Dockerfile
Original file line number Diff line number Diff line change @@ -8,11 +8,16 @@ ARCH=$(uname -m)
88# Context check
99[[ -z " ${AMPUSERID} " ]] && { echo " [Error] This docker image cannot be used directly by itself - it must be started by ampinstmgr" ; exit 100; }
1010
11- # Create /etc/machine-id (addresses Proton/dbus issues)
11+ # Create /etc/machine-id using the instance UUID if AMP_INSTANCE_ID exists (addresses Proton/dbus issues)
1212mkdir -p /var/lib/dbus
1313rm -f /etc/machine-id /var/lib/dbus/machine-id
14- dbus-uuidgen --ensure=/etc/machine-id
15- ln -s /etc/machine-id /var/lib/dbus/machine-id
14+ if [[ -n " ${AMP_INSTANCE_ID:- } " ]]; then
15+ printf ' %s\n' " ${AMP_INSTANCE_ID// -/ } " > /etc/machine-id
16+ else
17+ dbus-uuidgen --ensure=/etc/machine-id
18+ fi
19+ ln -sf /etc/machine-id /var/lib/dbus/machine-id
20+ chmod 0444 /etc/machine-id
1621
1722# Create /tmp/.X11-unix (for Xvfb etc)
1823install -d -o root -g root -m 1777 /tmp/.X11-unix
@@ -106,7 +111,7 @@ keep_env=(
106111 XDG_RUNTIME_DIR=" ${XDG_RUNTIME_DIR} "
107112)
108113# Always keep these AMP_ env vars if set
109- for v in AMPHOSTPLATFORM AMP_CONTAINER AMP_CONTAINER_HOST_NETWORK AMPMEMORYLIMIT AMPSWAPLIMIT AMPCONTAINERCPUS; do
114+ for v in AMPHOSTPLATFORM AMP_CONTAINER AMP_CONTAINER_HOST_NETWORK AMPMEMORYLIMIT AMPSWAPLIMIT AMPCONTAINERCPUS AMP_INSTANCE_ID ; do
110115 if [[ -n " ${! v-} " ]]; then keep_env+=(" $v =${! v} " ); fi
111116done
112117# Extra passthrough of env vars listed in AMP_ADDITIONAL_ENV_VARS in the Dockerfile
Original file line number Diff line number Diff line change @@ -8,11 +8,16 @@ ARCH=$(uname -m)
88# Context check
99[[ -z " ${AMPUSERID} " ]] && { echo " [Error] This docker image cannot be used directly by itself - it must be started by ampinstmgr" ; exit 100; }
1010
11- # Create /etc/machine-id (addresses Proton/dbus issues)
11+ # Create /etc/machine-id using the instance UUID if AMP_INSTANCE_ID exists (addresses Proton/dbus issues)
1212mkdir -p /var/lib/dbus
1313rm -f /etc/machine-id /var/lib/dbus/machine-id
14- dbus-uuidgen --ensure=/etc/machine-id
15- ln -s /etc/machine-id /var/lib/dbus/machine-id
14+ if [[ -n " ${AMP_INSTANCE_ID:- } " ]]; then
15+ printf ' %s\n' " ${AMP_INSTANCE_ID// -/ } " > /etc/machine-id
16+ else
17+ dbus-uuidgen --ensure=/etc/machine-id
18+ fi
19+ ln -sf /etc/machine-id /var/lib/dbus/machine-id
20+ chmod 0444 /etc/machine-id
1621
1722# Create /tmp/.X11-unix (for Xvfb etc)
1823install -d -o root -g root -m 1777 /tmp/.X11-unix
@@ -103,7 +108,7 @@ keep_env=(
103108 XDG_RUNTIME_DIR=" ${XDG_RUNTIME_DIR} "
104109)
105110# Always keep these AMP_ env vars if set
106- for v in AMPHOSTPLATFORM AMP_CONTAINER AMP_CONTAINER_HOST_NETWORK AMPMEMORYLIMIT AMPSWAPLIMIT AMPCONTAINERCPUS; do
111+ for v in AMPHOSTPLATFORM AMP_CONTAINER AMP_CONTAINER_HOST_NETWORK AMPMEMORYLIMIT AMPSWAPLIMIT AMPCONTAINERCPUS AMP_INSTANCE_ID ; do
107112 if [[ -n " ${! v-} " ]]; then keep_env+=(" $v =${! v} " ); fi
108113done
109114# Extra passthrough of env vars listed in AMP_ADDITIONAL_ENV_VARS in the Dockerfile
You can’t perform that action at this time.
0 commit comments