Spaces:
Sleeping
Sleeping
udbhav
commited on
Commit
Β·
c6b2354
1
Parent(s):
164917f
fixing bom
Browse files- entrypoint.sh +6 -7
- test.sh +6 -0
entrypoint.sh
CHANGED
|
@@ -21,14 +21,12 @@
|
|
| 21 |
# # Finally run your app
|
| 22 |
# exec python app.py
|
| 23 |
|
| 24 |
-
|
| 25 |
#!/bin/bash
|
| 26 |
set -e
|
| 27 |
|
| 28 |
-
# Make a writable certs directory
|
| 29 |
mkdir -p /app/certs
|
| 30 |
|
| 31 |
-
# Decode base64 certs from Hugging Face Secrets (if present)
|
| 32 |
if [ -n "$CORP_CERT1" ]; then
|
| 33 |
echo "$CORP_CERT1" | base64 -d > /app/certs/corp_cert1.crt
|
| 34 |
fi
|
|
@@ -42,14 +40,15 @@ if [ -n "$CORP_CERT4" ]; then
|
|
| 42 |
echo "$CORP_CERT4" | base64 -d > /app/certs/corp_cert4.crt
|
| 43 |
fi
|
| 44 |
|
| 45 |
-
# Build a single bundle (ignore errors if no certs provided)
|
| 46 |
cat /app/certs/*.crt > /app/certs/corp_bundle.crt 2>/dev/null || true
|
| 47 |
-
|
| 48 |
-
# Point Python + requests + huggingface_hub to this bundle
|
| 49 |
export REQUESTS_CA_BUNDLE=/app/certs/corp_bundle.crt
|
| 50 |
|
| 51 |
echo "β
Corporate certs configured (if provided)."
|
| 52 |
echo "π REQUESTS_CA_BUNDLE set to $REQUESTS_CA_BUNDLE"
|
| 53 |
|
| 54 |
-
# Run the actual app
|
| 55 |
exec "$@"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# # Finally run your app
|
| 22 |
# exec python app.py
|
| 23 |
|
| 24 |
+
cat > entrypoint.sh <<'EOF'
|
| 25 |
#!/bin/bash
|
| 26 |
set -e
|
| 27 |
|
|
|
|
| 28 |
mkdir -p /app/certs
|
| 29 |
|
|
|
|
| 30 |
if [ -n "$CORP_CERT1" ]; then
|
| 31 |
echo "$CORP_CERT1" | base64 -d > /app/certs/corp_cert1.crt
|
| 32 |
fi
|
|
|
|
| 40 |
echo "$CORP_CERT4" | base64 -d > /app/certs/corp_cert4.crt
|
| 41 |
fi
|
| 42 |
|
|
|
|
| 43 |
cat /app/certs/*.crt > /app/certs/corp_bundle.crt 2>/dev/null || true
|
|
|
|
|
|
|
| 44 |
export REQUESTS_CA_BUNDLE=/app/certs/corp_bundle.crt
|
| 45 |
|
| 46 |
echo "β
Corporate certs configured (if provided)."
|
| 47 |
echo "π REQUESTS_CA_BUNDLE set to $REQUESTS_CA_BUNDLE"
|
| 48 |
|
|
|
|
| 49 |
exec "$@"
|
| 50 |
+
EOF
|
| 51 |
+
|
| 52 |
+
chmod +x entrypoint.sh
|
| 53 |
+
|
| 54 |
+
|
test.sh
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
for f in *.sh; do
|
| 2 |
+
echo "Fixing $f"
|
| 3 |
+
sed -i '1s/^\xEF\xBB\xBF//' "$f" # remove BOM if present
|
| 4 |
+
dos2unix "$f" 2>/dev/null || sed -i 's/\r$//' "$f" # convert CRLF β LF
|
| 5 |
+
chmod +x "$f" # make executable
|
| 6 |
+
done
|