]> gitweb.morketsmerke.org Git - immudex.git/commitdiff
Dostosowanie immudex-padlock do obsługi LVM.
authorxf0r3m <jakubstasinski@protonmail.com>
Sun, 6 Jul 2025 16:00:48 +0000 (18:00 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Sun, 6 Jul 2025 16:00:48 +0000 (18:00 +0200)
tools/bin/immudex-padlock

index 59343d7dd5c8e0d51c2beb85a260e192edd50ddd..902ce97e709c6c07097ee33981dbff0e083a821a 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+source /usr/local/bin/library.sh;
+
 launcher="/home/${USER}/.config/xfce4/panel/launcher-14/16844255236.desktop";
 
 function main_unlock() {
@@ -40,7 +42,7 @@ function lock() {
   if [ "$mapperDeviceList" ]; then
          for dmDevice in $mapperDeviceList; do
                  if sudo cryptsetup status /dev/mapper/${dmDevice} > /dev/null 2>&1; then
-                         mountPoint=$(df --output=source,target /dev/mapper/${dmDevice} | tail -n 1 | awk '{printf $2}');
+                         mountPoint=$(df --output=source,target /media/${USER}/${dmDevice} | tail -n 1 | awk '{printf $2}');
                          if [ "$mountPoint" ]; then
                                  if $(sudo lsof $mountPoint > /dev/null 2>&1); then
                                          notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are opened file or running proceses." --icon=dialog-error;
@@ -48,10 +50,13 @@ function lock() {
                                          sudo umount $mountPoint;
             if [ $? -ne 0 ]; then
               notify-send "Padlock" "The /dev/mapper/${dmDevice} cannot be unmount, because there are other filesystem is mounted in." --icon=dialog-error;
+            else
+              deactivate_lvm_w_swap $dmDevice;
+                                           sudo cryptsetup close /dev/mapper/${dmDevice};
             fi
-                                         sudo cryptsetup close /dev/mapper/${dmDevice};
                                  fi
                          else
+          deactivate_lvm_w_swap $dmDevice;
           sudo cryptsetup close /dev/mapper/${dmDevice};
                          fi
                  fi