executable_luks-decrypt.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/usr/bin/env bash
  2. set -o errexit -o pipefail -o xtrace
  3. if [[ $LUKS_DECRYPT_WIN10 == FALSE ]]
  4. then
  5. :
  6. else
  7. if [[ -e /dev/lvm1/win10 ]]
  8. then
  9. :
  10. else
  11. sudo lvchange -ay /dev/lvm1/win10
  12. fi
  13. fi
  14. if [[ $LUKS_DECRYPT_NVME == FALSE ]]
  15. then
  16. :
  17. else
  18. if [[ -e /dev/mapper/crypt-nvme0n1 ]]
  19. then
  20. :
  21. else
  22. pass show luks2/luks2-header-210582390001289540AC \
  23. | sudo cryptsetup open \
  24. --allow-discards \
  25. --header="${HOME}/crypt/luks2-210582390001289540AC" \
  26. /dev/nvme0n1 \
  27. crypt-nvme0n1 \
  28. -
  29. fi
  30. if [[ -e /dev/lvm2/swap ]]
  31. then
  32. :
  33. else
  34. sudo lvchange -ay /dev/lvm2/swap
  35. sudo swapon /dev/lvm2/swap
  36. fi
  37. if [[ -e /dev/lvm2/ntfsgames ]]
  38. then
  39. :
  40. else
  41. sudo lvchange -ay /dev/lvm2/ntfsgames
  42. fi
  43. fi
  44. if [[ $LUKS_DECRYPT_QBITTORRENT == FALSE ]]
  45. then
  46. :
  47. else
  48. if [[ -e /dev/lvm2/qbittorrent-incomplete ]]
  49. then
  50. :
  51. else
  52. sudo lvchange -ay /dev/lvm2/qbittorrent-incomplete
  53. fi
  54. if mountpoint -q /mnt/qbittorrent-incomplete
  55. then
  56. :
  57. else
  58. sudo mount -o discard /dev/lvm2/qbittorrent-incomplete /mnt/qbittorrent-incomplete
  59. fi
  60. fi
  61. if [[ $LUKS_DECRYPT_HOME == FALSE ]]
  62. then
  63. :
  64. else
  65. subvols=(
  66. "archive"
  67. "phone"
  68. "src"
  69. "Maildir"
  70. )
  71. for subvol in "${subvols[@]}"
  72. do
  73. location="${HOME}/${subvol}"
  74. if mountpoint -q "$location"
  75. then
  76. :
  77. else
  78. sudo mount "$location"
  79. fi
  80. done
  81. fi
  82. if [[ $LUKS_DECRYPT_SRV == FALSE ]]
  83. then
  84. :
  85. else
  86. if [[ -e /dev/mapper/crypt-srv ]]
  87. then
  88. :
  89. else
  90. pass show luks2/luks2-header-wd-wd181purp-85b6hy0 \
  91. | sudo cryptsetup open \
  92. --header="${HOME}/crypt/luks2-wd181purp-85b6hy0" \
  93. /dev/sdb \
  94. crypt-srv \
  95. -
  96. fi
  97. if mountpoint -q /srv
  98. then
  99. :
  100. else
  101. sudo mount /srv
  102. fi
  103. fi
  104. # for kubelet
  105. if [[ -d /var/hpvolumes ]]
  106. then
  107. if mountpoint --quiet /var/hpvolumes
  108. then
  109. :
  110. else
  111. # Uncomment if '/var/hpvolumes' directory is on a '/' file-system.
  112. # mount --bind /var/hpvolumes /var/hpvolumes
  113. sudo mount /var/hpvolumes
  114. sudo mount --make-shared /var/hpvolumes
  115. fi
  116. fi