summaryrefslogtreecommitdiff
path: root/src/transition_0.22_0.23
blob: 3328e8c9a9c38fcdb5a9496b865381c1bdc7b1e7 (plain)
  1. #!/bin/bash
  2. # This is a post-install script for monkeysphere, to transition an old
  3. # (<=0.22) setup to the new (>0.22) setup
  4. SYSDATADIR=${MONKEYSPHERE_SYSDATADIR:-"/var/lib/monkeysphere"}
  5. MADATADIR="${SYSDATADIR}/authentication"
  6. MHDATADIR="${SYSDATADIR}/host"
  7. ############################################################
  8. ### transfer host setup
  9. if [ -d "$SYSDATADIR"/gnupg-host ] ; then
  10. if [ -s "$SYSDATADIR"/ssh_host_rsa_key ] ; then
  11. # This would be simple, but it would generate a new pgp key,
  12. #and we don't want that, right?
  13. #monkeysphere-host expert import_key "$SYSDATADIR"/ssh_host_rsa_key
  14. # create host home
  15. mkdir -p "${MHDATADIR}"
  16. mkdir -p "${MHTMPDIR}"
  17. mkdir -p "${GNUPGHOME_HOST}"
  18. chmod 700 "${GNUPGHOME_HOST}"
  19. # transfer the host secret key from the old home to the new
  20. GNUPGHOME="$SYSDATADIR"/gnupg-host gpg --export-secret-keys \
  21. GNUPGHOME="$MHDATADIR" gpg --import
  22. # make sure the ssh_host_rsa_key.pub and ssh_host_rsa_key.pub.gpg
  23. # files exist
  24. # anything else?
  25. fi
  26. #rm -rf "$SYSDATADIR"/gnupg-host
  27. fi
  28. ############################################################
  29. ### transfer authentication setup
  30. # should we test for something else/better than the existence of this
  31. # directory to know that we should go through the setup?
  32. if [ -d "$SYSDATADIR"/gnupg-authentication ] ; then
  33. # run the authentication setup
  34. monkeysphere-authentication setup
  35. # transfer certifiers
  36. # FIXME: how?
  37. # i think we'll need to run something like
  38. # gpg_core_sphere_sig_transfer after transfering certifiers ltsigs
  39. # do we need to do some sort of transfer of ownertrust?
  40. # move the authorized_keys directory
  41. mv "$SYSDATADIR"/authorized_keys "$MADATADIR"/
  42. # do we need to transfer anything else? running update-users will
  43. # regenerate everything else in the sphere keyring, right?
  44. #rm -rf "$SYSDATADIR"/gnupg-authentication
  45. fi