From: xf0r3m Date: Mon, 14 Aug 2023 12:35:20 +0000 (+0200) Subject: Dopisanie funkcji upgrade-u do narzędzia immudex-upgrade X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=ca4f52ee442921a8879751d708625363d7f14ee8;p=immudex-testing.git Dopisanie funkcji upgrade-u do narzędzia immudex-upgrade --- diff --git a/tools/immudex-upgrade b/tools/immudex-upgrade index ce8d5f6..ba0aba5 100755 --- a/tools/immudex-upgrade +++ b/tools/immudex-upgrade @@ -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;