]> gitweb.morketsmerke.org Git - immudex-testing.git/commitdiff
Usuniecie nie potrzebnej funkcji main_upgrade. Dodanie możliwości aktualizacji system...
authorxf0r3m <jakubstasinski@protonmail.com>
Fri, 18 Aug 2023 06:05:53 +0000 (08:05 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Fri, 18 Aug 2023 06:05:53 +0000 (08:05 +0200)
tools/immudex-upgrade

index 5f008aa450723ed48b9b9135048c009020466fdd..55e93313a0fb9bcb6eb00bbc07bcaacd3cdcb1e2 100755 (executable)
@@ -18,23 +18,6 @@ function help() {
   echo " --upgrade - upgrade immudex from given source";
 }
 
-function main_upgrade() {
-  set -e
-  ARCH=$(get_machine_arch);
-  if [ ! "$BRANCH" ]; then
-    BRANCH=$(get_debian_branch);
-  fi
-  MIRROR=$(check_mirror);
-  rootPart=$(grep "${1}" /etc/mtab | head -1 | awk '{printf $1}');
-  sudo mount $rootPart $1 -o remount,rw;
-  sudo rm -f ${1}/live/*;
-  sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/filesystem.squashfs -O ${1}/live/filesystem.squashfs;
-  sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/initrd -O ${1}/live/initrd;
-  sudo wget -q ${MIRROR}/immudex/${BRANCH}/upgrades/${2}/${ARCH}/vmlinuz -O ${1}/live/vmlinuz;
-  echo "$2" > /tmp/version;
-  sudo cp /tmp/version ${1}/live;
-}
-
 if [ "$1" ]; then
   if [ "$1" ] && [ "$1" = "--check" ]; then
     if check_distro_commit; then 
@@ -45,22 +28,30 @@ 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 sudo mount | grep -q "$part"; then
+      echo -n "Mounting iso image...";
+      sudo mount $2 /mnt > /dev/null 2>&1;
+      if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
+      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;
+    else
+      echo "Mounting immudex partition...";
+      sudo mount $part /mnt >> /dev/null 2>&1;
+      if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi
+      echo "Copying immudex files to the disk...";
+      sudo cp -vv /run/live/medium/live/* /mnt/live;
+    fi
     if [ $? -eq 0 ]; then
       echo -e "Copying immudex files to the disk...[ ${GREEN}OK${ENDCOLOR} ]";
     else