-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
40 lines (33 loc) · 1.06 KB
/
entrypoint.sh
File metadata and controls
40 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
trap 'echo "Shutting down..."; exit 0' SIGTERM SIGINT
if [ -z "$INTERNXT_EMAIL" ] || [ -z "$INTERNXT_PASSWORD" ]; then
echo "Error: INTERNXT_EMAIL and INTERNXT_PASSWORD must be set."
exit 1
fi
if [ -n "$INTERNXT_TOTP" ]; then
echo "Generating TOTP..."
TOTP=$(node -e "const { TOTP } = require('otpauth'); const totp = new TOTP({ secret: '$INTERNXT_TOTP' }); console.log(totp.generate());")
echo "Logging into Internxt..."
internxt login --email="$INTERNXT_EMAIL" --password="$INTERNXT_PASSWORD" --twofactor="$TOTP" --non-interactive
else
echo "Logging into Internxt without TOTP..."
internxt login --email="$INTERNXT_EMAIL" --password="$INTERNXT_PASSWORD" --non-interactive
fi
if ! internxt webdav-config --http; then
echo "Error: Failed to configure WebDAV"
exit 1
fi
if ! internxt webdav enable; then
echo "Error: Failed to enable WebDAV"
exit 1
fi
echo "WebDAV enabled successfully"
while true; do
internxt --version
if ! internxt webdav status; then
echo "Warning: WebDAV status check failed"
fi
sleep 300 &
wait $!
done