@@ -13,7 +13,6 @@ SSHD_PORT="${SSHD_PORT:-"2222"}"
13
13
USERNAME=" ${USERNAME:- " ${_REMOTE_USER:- " automatic" } " } "
14
14
START_SSHD=" ${START_SSHD:- " false" } "
15
15
NEW_PASSWORD=" ${NEW_PASSWORD:- " skip" } "
16
- FIX_ENVIRONMENT=" ${FIX_ENVIRONMENT:- " true" } "
17
16
18
17
set -e
19
18
@@ -93,35 +92,6 @@ sed -i -E "s/#*\s*Port\s+.+/Port ${SSHD_PORT}/g" /etc/ssh/sshd_config
93
92
# Need to UsePAM so /etc/environment is processed
94
93
sed -i -E " s/#?\s*UsePAM\s+.+/UsePAM yes/g" /etc/ssh/sshd_config
95
94
96
- # Script to store variables that exist at the time the ENTRYPOINT is fired
97
- store_env_script=" $( cat << 'EOF '
98
- # Wire in codespaces secret processing to zsh if present (since may have been added to image after script was run)
99
- if [ -f /etc/zsh/zlogin ] && ! grep '/etc/profile.d/00-restore-secrets.sh' /etc/zsh/zlogin > /dev/null 2>&1; then
100
- echo -e "if [ -f /etc/profile.d/00-restore-secrets.sh ]; then . /etc/profile.d/00-restore-secrets.sh; fi\n$(cat /etc/zsh/zlogin 2>/dev/null || echo '')" | sudoIf tee /etc/zsh/zlogin > /dev/null
101
- fi
102
- EOF
103
- ) "
104
-
105
- # Script to ensure login shells get the latest Codespaces secrets
106
- restore_secrets_script=" $( cat << 'EOF '
107
- #!/bin/sh
108
- if [ "${CODESPACES}" != "true" ] || [ "${VSCDC_FIXED_SECRETS}" = "true" ] || [ ! -z "${GITHUB_CODESPACES_TOKEN}" ]; then
109
- # Not codespaces, already run, or secrets already in environment, so return
110
- return
111
- fi
112
- if [ -f /workspaces/.codespaces/shared/.env-secrets ]; then
113
- while read line
114
- do
115
- key=$(echo $line | sed "s/=.*//")
116
- value=$(echo $line | sed "s/$key=//1")
117
- decodedValue=$(echo $value | base64 -d)
118
- export $key="$decodedValue"
119
- done < /workspaces/.codespaces/shared/.env-secrets
120
- fi
121
- export VSCDC_FIXED_SECRETS=true
122
- EOF
123
- ) "
124
-
125
95
# Write out a scripts that can be referenced as an ENTRYPOINT to auto-start sshd and fix login environments
126
96
tee /usr/local/share/ssh-init.sh > /dev/null \
127
97
<< 'EOF '
@@ -141,15 +111,6 @@ sudoIf()
141
111
}
142
112
143
113
EOF
144
- if [ " ${FIX_ENVIRONMENT} " = " true" ]; then
145
- echo " ${store_env_script} " >> /usr/local/share/ssh-init.sh
146
- echo " ${restore_secrets_script} " > /etc/profile.d/00-restore-secrets.sh
147
- chmod +x /etc/profile.d/00-restore-secrets.sh
148
- # Wire in zsh if present
149
- if type zsh > /dev/null 2>&1 ; then
150
- echo -e " if [ -f /etc/profile.d/00-restore-secrets.sh ]; then . /etc/profile.d/00-restore-secrets.sh; fi\n$( cat /etc/zsh/zlogin 2> /dev/null || echo ' ' ) " > /etc/zsh/zlogin
151
- fi
152
- fi
153
114
tee -a /usr/local/share/ssh-init.sh > /dev/null \
154
115
<< 'EOF '
155
116
0 commit comments