From 7798369fe643ad4683c6015f5ac2d1a5abdfc9bb Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Fri, 18 Aug 2023 08:05:53 +0200 Subject: [PATCH] =?utf8?q?Usuniecie=20nie=20potrzebnej=20funkcji=20main=5F?= =?utf8?q?upgrade.=20Dodanie=20mo=C5=BCliwo=C5=9Bci=20aktualizacji=20syste?= =?utf8?q?mu=20po=20uruchomieniu=20go=20z=20p=C5=82yty/pendrive-a?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- tools/immudex-upgrade | 55 ++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/tools/immudex-upgrade b/tools/immudex-upgrade index 5f008aa..55e9331 100755 --- a/tools/immudex-upgrade +++ b/tools/immudex-upgrade @@ -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 -- 2.39.5