executable_luks-decrypt.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/usr/bin/env bash
  2. set -o nounset -o errexit -o pipefail -o xtrace
  3. if [[ -e /dev/mapper/crypt-nvme0n1 ]]
  4. then
  5. :
  6. else
  7. pass show luks2/luks2-header-210582390001289540AC \
  8. | sudo cryptsetup open \
  9. --allow-discards \
  10. --header="${HOME}/crypt/luks2-210582390001289540AC" \
  11. /dev/nvme0n1 \
  12. crypt-nvme0n1 \
  13. -
  14. fi
  15. subvols=(
  16. "archive"
  17. "phone"
  18. "src"
  19. "Maildir"
  20. )
  21. for subvol in "${subvols[@]}"
  22. do
  23. location="${HOME}/${subvol}"
  24. if mountpoint -q "$location"
  25. then
  26. :
  27. else
  28. sudo mount "$location"
  29. fi
  30. done
  31. if [[ -e /dev/lvm2/swap ]]
  32. then
  33. :
  34. else
  35. sudo lvchange -ay /dev/lvm2/swap
  36. sudo swapon /dev/lvm2/swap
  37. fi
  38. if [[ -e /dev/mapper/crypt-srv ]]
  39. then
  40. :
  41. else
  42. pass show luks2/luks2-header-wd-wd181purp-85b6hy0 \
  43. | sudo cryptsetup open \
  44. --header="${HOME}/crypt/luks2-wd181purp-85b6hy0" \
  45. /dev/sdb \
  46. crypt-srv \
  47. -
  48. fi
  49. if mountpoint -q /srv
  50. then
  51. :
  52. else
  53. sudo mount /srv
  54. fi
  55. if [[ -e /dev/lvm2/qbittorrent-incomplete ]]
  56. then
  57. :
  58. else
  59. sudo lvchange -ay /dev/lvm2/qbittorrent-incomplete
  60. fi
  61. if mountpoint -q /mnt/qbittorrent-incomplete
  62. then
  63. :
  64. else
  65. sudo mount /dev/lvm2/qbittorrent-incomplete /mnt/qbittorrent-incomplete
  66. fi
  67. # for kubelet
  68. if [[ -d /var/hpvolumes ]]
  69. then
  70. if mountpoint --quiet /var/hpvolumes
  71. then
  72. :
  73. else
  74. # Uncomment if '/var/hpvolumes' directory is on a '/' file-system.
  75. # mount --bind /var/hpvolumes /var/hpvolumes
  76. sudo mount /var/hpvolumes
  77. sudo mount --make-shared /var/hpvolumes
  78. fi
  79. fi