/ scripts / verify-binary.sh
verify-binary.sh
 1  #!/bin/bash
 2  
 3  # Exit on error
 4  set -e
 5  
 6  echo "╔════════════════════════════════════════════════════════════════╗"
 7  echo "║                                                                ║"
 8  echo "║                KeepSync Binary Verification                    ║"
 9  echo "║                                                                ║"
10  echo "╚════════════════════════════════════════════════════════════════╝"
11  
12  # Check if the binary exists
13  if [ ! -f "bin/keepsync" ]; then
14      echo "Error: Binary not found at bin/keepsync"
15      exit 1
16  fi
17  
18  # Make sure the binary is executable
19  chmod +x bin/keepsync
20  
21  # Check if the binary runs
22  echo "Checking if the binary runs..."
23  ./bin/keepsync --help > /dev/null 2>&1
24  if [ $? -ne 0 ]; then
25      echo "Error: Binary does not run correctly"
26      exit 1
27  fi
28  echo "✓ Binary runs correctly"
29  
30  # Save help output to a file
31  HELP_OUTPUT_FILE="help_output.txt"
32  ./bin/keepsync --help > "$HELP_OUTPUT_FILE" 2>/dev/null
33  
34  # Check if the binary has all providers
35  echo "Checking if the binary has all providers..."
36  PROVIDERS_OUTPUT=$(./bin/keepsync --list-providers 2>/dev/null)
37  echo "$PROVIDERS_OUTPUT" | grep -q "s3" && echo "✓ S3 provider available" || { echo "Error: S3 provider not available"; exit 1; }
38  echo "$PROVIDERS_OUTPUT" | grep -q "webdav" && echo "✓ WebDAV provider available" || { echo "Error: WebDAV provider not available"; exit 1; }
39  echo "$PROVIDERS_OUTPUT" | grep -q "sftp" && echo "✓ SFTP provider available" || { echo "Error: SFTP provider not available"; exit 1; }
40  
41  # Check for TPM flag in help output
42  echo "Checking for TPM flag..."
43  if grep -q "Enable TPM" "$HELP_OUTPUT_FILE"; then
44      echo "✓ TPM flag available (use with -tpm to enable TPM support)"
45  else
46      echo "Error: TPM flag not available"
47      exit 1
48  fi
49  
50  # Check for quantum flag in help output
51  echo "Checking for quantum-resistant encryption flag..."
52  if grep -q "Enable quantum-resistant encryption" "$HELP_OUTPUT_FILE"; then
53      echo "✓ Quantum-resistant encryption flag available (use with -quantum to enable)"
54  else
55      echo "Error: Quantum-resistant encryption flag not available"
56      exit 1
57  fi
58  
59  # Check for FUSE flag in help output
60  echo "Checking for FUSE flag..."
61  if grep -q "Run in FUSE mode" "$HELP_OUTPUT_FILE"; then
62      echo "✓ FUSE flag available (use with -fuse to enable FUSE mode)"
63  else
64      echo "Error: FUSE flag not available"
65      exit 1
66  fi
67  
68  echo "╔════════════════════════════════════════════════════════════════╗"
69  echo "║                                                                ║"
70  echo "║                Binary Verification Complete                    ║"
71  echo "║                                                                ║"
72  echo "╚════════════════════════════════════════════════════════════════╝"
73  
74  echo "The binary has been verified to have all required features:"
75  echo "- All providers (S3, WebDAV, SFTP)"
76  echo "- TPM support (disabled by default, enable with -tpm)"
77  echo "- Quantum-resistant encryption (disabled by default, enable with -quantum)"
78  echo "- FUSE support (disabled by default, enable with -fuse)"