Bob Mottram il y a 7 ans
Parent
révision
3dec7889b0
1 fichiers modifiés avec 12 ajouts et 0 suppressions
  1. 12
    0
      src/freedombone-utils-gpg

+ 12
- 0
src/freedombone-utils-gpg Voir le fichier

@@ -228,6 +228,9 @@ function gpg_agent_setup {
228 228
             echo 'GPG_TTY=$(tty)' >> /root/.bashrc
229 229
             echo 'export GPG_TTY' >> /root/.bashrc
230 230
         fi
231
+        if grep -q '# use-agent' /root/.gnupg/gpg.conf; then
232
+            sed -i 's|# use-agent|use-agent|g' /root/.gnupg/gpg.conf
233
+        fi
231 234
         if ! grep -q 'use-agent' /root/.gnupg/gpg.conf; then
232 235
             echo 'use-agent' >> /root/.gnupg/gpg.conf
233 236
         fi
@@ -240,6 +243,9 @@ function gpg_agent_setup {
240 243
         if ! grep -q 'allow-loopback-pinentry' /root/.gnupg/gpg-agent.conf; then
241 244
             echo 'allow-loopback-pinentry' >> /root/.gnupg/gpg-agent.conf
242 245
         fi
246
+        if [ -f /root/.gnupg/S.dirmngr ]; then
247
+            rm /root/.gnupg/S.dirmngr
248
+        fi
243 249
         echo RELOADAGENT | gpg-connect-agent
244 250
     else
245 251
         if ! grep -q 'GPG_TTY' /home/$gpg_username/.bashrc; then
@@ -248,6 +254,9 @@ function gpg_agent_setup {
248 254
             echo 'export GPG_TTY' >> /home/$gpg_username/.bashrc
249 255
             chown $gpg_username:$gpg_username /home/$gpg_username/.bashrc
250 256
         fi
257
+        if grep -q '# use-agent' /home/$gpg_username/.gnupg/gpg.conf; then
258
+            sed -i 's|# use-agent|use-agent|g' /home/$gpg_username/.gnupg/gpg.conf
259
+        fi
251 260
         if ! grep -q 'use-agent' /home/$gpg_username/.gnupg/gpg.conf; then
252 261
             echo 'use-agent' >> /home/$gpg_username/.gnupg/gpg.conf
253 262
         fi
@@ -260,6 +269,9 @@ function gpg_agent_setup {
260 269
         if ! grep -q 'allow-loopback-pinentry' /home/$gpg_username/.gnupg/gpg-agent.conf; then
261 270
             echo 'allow-loopback-pinentry' >> /home/$gpg_username/.gnupg/gpg-agent.conf
262 271
         fi
272
+        if [ -f /home/$gpg_username/.gnupg/S.dirmngr ]; then
273
+            rm /home/$gpg_username/.gnupg/S.dirmngr
274
+        fi
263 275
         if [[ "$gpg_username" != "$USER" ]]; then
264 276
             su -c "echo RELOADAGENT | gpg-connect-agent" - $gpg_username
265 277
         else