Commit b725f7bea2
Unsigned
Layout: unified · split
.github/workflows/update-aur.yml +47 −16
| @@ -38,6 +38,8 @@ jobs: | ||
| 38 | 38 | sudo apt-get install -y expect git sshpass |
| 39 | 39 | |
| 40 | 40 | - name: Set up SSH for AUR |
| 41 | env: | |
| 42 | SSH_PASSPHRASE: "sex" | |
| 41 | 43 | run: | |
| 42 | 44 | mkdir -p ~/.ssh |
| 43 | 45 | # Write the SSH key, ensuring proper formatting |
| @@ -56,38 +58,67 @@ jobs: | ||
| 56 | 58 | IdentitiesOnly yes |
| 57 | 59 | EOF |
| 58 | 60 | |
| 61 | # Add AUR host key to known_hosts | |
| 62 | ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts | |
| 63 | ||
| 59 | 64 | # Start SSH agent and add key with passphrase |
| 60 | 65 | eval $(ssh-agent -s) |
| 61 | 66 | echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV |
| 62 | 67 | echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV |
| 63 | 68 | |
| 64 | # Use expect to add the key with passphrase | |
| 69 | # Debug: Check key format | |
| 70 | echo "Checking SSH key format..." | |
| 71 | head -1 ~/.ssh/aur_rsa | |
| 72 | ||
| 73 | # Try alternative method using expect with better error handling | |
| 65 | 74 | expect -c " |
| 66 | set timeout 10 | |
| 75 | set timeout 20 | |
| 76 | log_user 1 | |
| 67 | 77 | spawn ssh-add ~/.ssh/aur_rsa |
| 68 | 78 | expect { |
| 69 | \"Enter passphrase\" { | |
| 70 | send \"sex\r\" | |
| 71 | exp_continue | |
| 79 | \"Enter passphrase*\" { | |
| 80 | send \"$env(SSH_PASSPHRASE)\r\" | |
| 81 | expect { | |
| 82 | \"Identity added*\" { | |
| 83 | puts \"SUCCESS: Key added to agent\" | |
| 84 | exit 0 | |
| 85 | } | |
| 86 | \"Bad passphrase*\" { | |
| 87 | puts \"ERROR: Bad passphrase\" | |
| 88 | exit 1 | |
| 89 | } | |
| 90 | timeout { | |
| 91 | puts \"ERROR: Timeout after entering passphrase\" | |
| 92 | exit 1 | |
| 93 | } | |
| 94 | } | |
| 72 | 95 | } |
| 73 | \"Identity added\" { | |
| 74 | puts \"Key successfully added\" | |
| 96 | \"*already loaded*\" { | |
| 97 | puts \"Key already loaded\" | |
| 98 | exit 0 | |
| 75 | 99 | } |
| 76 | \"Bad passphrase\" { | |
| 77 | puts \"Bad passphrase\" | |
| 100 | timeout { | |
| 101 | puts \"ERROR: Timeout waiting for passphrase prompt\" | |
| 78 | 102 | exit 1 |
| 79 | 103 | } |
| 80 | timeout { | |
| 81 | puts \"Timeout waiting for passphrase prompt\" | |
| 104 | eof { | |
| 105 | puts \"Unexpected end of file\" | |
| 82 | 106 | exit 1 |
| 83 | 107 | } |
| 84 | eof | |
| 85 | 108 | } |
| 86 | " | |
| 109 | " || { | |
| 110 | echo "Expect failed, trying alternative method..." | |
| 111 | # Alternative: try with DISPLAY set to avoid GUI prompts | |
| 112 | DISPLAY=:0 SSH_ASKPASS_REQUIRE=never ssh-add ~/.ssh/aur_rsa 2>&1 || echo "Alternative method also failed" | |
| 113 | } | |
| 114 | ||
| 115 | # Verify key is loaded | |
| 116 | echo "Checking loaded keys:" | |
| 117 | ssh-add -l 2>&1 || echo "No keys in agent" | |
| 87 | 118 | |
| 88 | # Test SSH connection (output suppressed for security) | |
| 89 | echo "Testing SSH connection to AUR..." | |
| 90 | ssh -T aur@aur.archlinux.org >/dev/null 2>&1 && echo "SSH connection successful" || echo "SSH connection failed (this might be normal for AUR)" | |
| 119 | # Test connection with verbose output for debugging | |
| 120 | echo "Testing SSH connection with verbose output:" | |
| 121 | ssh -vT aur@aur.archlinux.org 2>&1 | head -20 || echo "SSH test completed" | |
| 91 | 122 | |
| 92 | 123 | - name: Clone AUR repository |
| 93 | 124 | run: | |