]> gitweb.morketsmerke.org Git - immudex-testing.git/commitdiff
Dopisanie funkcji upgrade-u do narzędzia immudex-upgrade
authorxf0r3m <jakubstasinski@protonmail.com>
Mon, 14 Aug 2023 12:35:20 +0000 (14:35 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Mon, 14 Aug 2023 12:35:20 +0000 (14:35 +0200)
tools/immudex-upgrade

index ce8d5f6e6f07e6f08bf52e7c90dc3c2a42414e1b..ba0aba56c66c5e9e1eb0c33d1f6eba70f2446095 100755 (executable)
@@ -44,10 +44,31 @@ if [ "$1" ]; then
       check_distro_commit --print;
     fi
   elif [ "$1" ] && [ "$1" = "--upgrade" ]; then
-  
+    echo -n "Mounting iso image...";
+    sudo mount $2 /mnt > /dev/null 2>&1;
+    if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
+    part=$(sudo blkid | grep 'LABEL="immudex"' | awk '{printf $1}' | cut -d ":" -f 1);
+    mountPointList=$(sudo mount | grep "$part" | awk '{printf $3" "}');
+    for mountPoint in $mountPointList; do
+      echo -n "Unlocking $mountPoint ..."; 
+      sudo mount $part $mountPoint -o remount,rw > /dev/null 2>&1;
+      if [ $? -eq 0 ]; then
+        echo -e "[ ${GREEN}OK${ENDCOLOR} ]";
+      else
+        echo -e "[ ${RED}FAIL${ENDCOLOR} ]";
+      fi
+    done
+    echo "Copying immudex files to the disk...";
+    sudo cp -vv /mnt/live/* ${mountPoint}/live;
+    if [ $? -eq 0 ]; then
+      echo -e "Copying immudex files to the disk...[ ${GREEN}OK${ENDCOLOR} ]";
+    else
+      echo -e "Copying immudex files to the disk...[ ${RED}FAIL${ENDCOLOR} ]";
+    fi
   else
     help;
     exit 1;
+  fi
 else
   help;
   exit 1;