Fix build.sh to handle passwords with # character
Use heredoc to write ldflags to temp file. This allows passwords containing # (hash) characters to be embedded correctly. Known limitation: Passwords with both spaces AND quotes together may still fail. Most other special characters work fine.
This commit is contained in:
1 parent
8d3eedc6a3
commit
de487d049c
1 file changed
+17
-3
@@ -107,9 +107,23 @@ echo "Building nextcloud-mail..."
|
|||||||
cd "$SCRIPT_DIR/tools/go/nextcloud-mail"
|
cd "$SCRIPT_DIR/tools/go/nextcloud-mail"
|
||||||
|
|
||||||
# Build with compile-time credentials
|
# Build with compile-time credentials
|
||||||
# Note: This simple approach works for most passwords but may fail with
|
# Use heredoc to write ldflags to temp file - handles # character
|
||||||
# passwords containing spaces, double quotes, or $ characters
|
LDFLAGS_FILE="/tmp/nextcloud-mail-ldflags.$$"
|
||||||
go build -ldflags="-X main.BuildIMAPServer=$IMAP_SERVER -X main.BuildIMAPPort=$IMAP_PORT -X main.BuildIMAPUser=$IMAP_USER -X main.BuildIMAPPassword=$IMAP_PASS -X main.BuildSMTPServer=$SMTP_SERVER -X main.BuildSMTPPort=$SMTP_PORT -X main.BuildSMTPUser=$SMTP_USER -X main.BuildSMTPPassword=$SMTP_PASS -X main.BuildUseSSL=$USE_SSL -X main.BuildIgnoreCerts=$IGNORE_CERTS" -o ~/bin/nextcloud-mail .
|
cat > "$LDFLAGS_FILE" <<LDFLAGSEOF
|
||||||
|
-X main.BuildIMAPServer=$IMAP_SERVER
|
||||||
|
-X main.BuildIMAPPort=$IMAP_PORT
|
||||||
|
-X main.BuildIMAPUser=$IMAP_USER
|
||||||
|
-X main.BuildIMAPPassword=$IMAP_PASS
|
||||||
|
-X main.BuildSMTPServer=$SMTP_SERVER
|
||||||
|
-X main.BuildSMTPPort=$SMTP_PORT
|
||||||
|
-X main.BuildSMTPUser=$SMTP_USER
|
||||||
|
-X main.BuildSMTPPassword=$SMTP_PASS
|
||||||
|
-X main.BuildUseSSL=$USE_SSL
|
||||||
|
-X main.BuildIgnoreCerts=$IGNORE_CERTS
|
||||||
|
LDFLAGSEOF
|
||||||
|
|
||||||
|
go build -ldflags="$(cat "$LDFLAGS_FILE")" -o ~/bin/nextcloud-mail .
|
||||||
|
rm -f "$LDFLAGS_FILE"
|
||||||
echo "✓ nextcloud-mail built successfully"
|
echo "✓ nextcloud-mail built successfully"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in new issue
Block a user