Skip to content

Commit 83fc8f4

Browse files
committed
feat(prelaunch): v0.0.14 - add GHCR Accept header and reduce password log noise
- Add Accept header with OCI/Docker manifest content types to GHCR pull verification curl to handle registries returning different manifest formats - Remove verbose echo lines in root password setup section to reduce unnecessary log output
1 parent 5c6bd1e commit 83fc8f4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

phala-cloud-prelaunch-script/prelaunch.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
echo "----------------------------------------------"
2-
echo "Running Phala Cloud Pre-Launch Script v0.0.13"
2+
echo "Running Phala Cloud Pre-Launch Script v0.0.14"
33
echo "----------------------------------------------"
44
set -e
55

@@ -166,6 +166,7 @@ if [[ "$DOCKER_REGISTRY_TARGET" == "ghcr.io" && -n "$DSTACK_DOCKER_USERNAME" &&
166166
exit 1
167167
fi
168168
http_code=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $token" \
169+
-H "Accept: application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.docker.distribution.manifest.v2+json" \
169170
"https://ghcr.io/v2/${repo}/manifests/${tag}")
170171
if [[ "$http_code" != "200" ]]; then
171172
echo "ERROR: GHCR pull access denied for $img (HTTP $http_code)"
@@ -179,7 +180,6 @@ fi
179180
#
180181
# Set root password.
181182
#
182-
echo "Setting root password.."
183183

184184
# Check if password files are writable
185185
PASSWD_WRITABLE=true
@@ -200,12 +200,10 @@ else
200200
echo "Using chpasswd method"
201201

202202
if [ -n "$DSTACK_ROOT_PASSWORD" ]; then
203-
echo "Setting root password from user.."
204203
echo "root:$DSTACK_ROOT_PASSWORD" | chpasswd
205204
unset DSTACK_ROOT_PASSWORD
206205
echo "Root password set/updated from DSTACK_ROOT_PASSWORD"
207206
elif [ -z "$(grep '^root:' /etc/shadow 2>/dev/null | cut -d: -f2)" ]; then
208-
echo "Setting random root password.."
209207
DSTACK_ROOT_PASSWORD=$(
210208
LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | dd bs=1 count=32 2>/dev/null
211209
)
@@ -219,13 +217,11 @@ else
219217
echo "Using passwd method"
220218

221219
if [ -n "$DSTACK_ROOT_PASSWORD" ]; then
222-
echo "Setting root password from user.."
223220
echo "$DSTACK_ROOT_PASSWORD" | passwd --stdin root 2>/dev/null \
224221
|| printf '%s\n%s\n' "$DSTACK_ROOT_PASSWORD" "$DSTACK_ROOT_PASSWORD" | passwd root
225222
unset DSTACK_ROOT_PASSWORD
226223
echo "Root password set/updated from DSTACK_ROOT_PASSWORD"
227224
elif [ -z "$(grep '^root:' /etc/shadow 2>/dev/null | cut -d: -f2)" ]; then
228-
echo "Setting random root password.."
229225
DSTACK_ROOT_PASSWORD=$(
230226
LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | dd bs=1 count=32 2>/dev/null
231227
)

0 commit comments

Comments
 (0)