From 37e1c0d164f98d37a33d63315c7db0cc6fcdb894 Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Wed, 24 Apr 2024 20:20:58 +0200 Subject: [PATCH] =?utf8?q?immudex-upgrade=20-=20aktualizacja=20GRUB-a=20-?= =?utf8?q?=20BT=20#169=20-=20zmiana=20logiki=20ga=C5=82=C4=99zi=20--upgrad?= =?utf8?q?e=20dodanie=20obs=C5=82ugi=20zmiany=20pliku=20GRUB-a=20tak=C5=BC?= =?utf8?q?e=20w=20drugim=20przypadku=20aktualizacji.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- tools/sbin/immudex-upgrade | 42 ++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/tools/sbin/immudex-upgrade b/tools/sbin/immudex-upgrade index 6a147bb..fea7981 100755 --- a/tools/sbin/immudex-upgrade +++ b/tools/sbin/immudex-upgrade @@ -57,24 +57,44 @@ if [ "$1" ]; then done echo "Copying immudex files to the disk..."; 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 - echo "Mounting immudex partition..."; + echo -n "Mounting immudex partition..."; mount $part /mnt >> /dev/null 2>&1; if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi echo "Copying immudex files to the disk..."; cp -vv /run/live/medium/live/* /mnt/live; - if $(sudo efibootmgr > /dev/null 2>&1); then - echo "Copying grub config to the disk..."; - cp -vv /run/live/medium/boot/grub/grub.cfg /mnt/boot/grub/grub.cfg; - if [ $? -eq 0 ]; then echo -e "[ ${GREEN}OK${ENDCOLOR} ]"; fi - sed -i '/set\ timeout=/ s/30/5/' /mnt/boot/grub/grub.cfg; - sed -i 's/bootfrom=removable //g' /mnt/boot/grub/grub.cfg; + 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 fi - 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} ]"; + if $(sudo efibootmgr > /dev/null 2>&1); then + echo "Copying grub config to the disk..."; + if [ "$mountPoint" ]; then + cp -vv /mnt/boot/grub/grub.cfg ${mountPoint}/boot/grub/grub.cfg; + if [ $? -eq 0 ]; then + echo -e "Copying grub config to the disk...[ ${GREEN}OK${ENDCOLOR} ]"; + sed -i '/set\ timeout=/ s/30/5/' ${mountPoint}/boot/grub/grub.cfg; + sed -i 's/bootfrom=removable //g' ${mountPoint}/boot/grub/grub.cfg; + else + echo -e "Copying grub config to the disk...[ ${RED}FAIL${ENDCOLOR} ]"; + fi + else + cp -vv /run/live/medium/boot/grub/grub.cfg /mnt/boot/grub/grub.cfg; + if [ $? -eq 0 ]; then + echo -e "Copying grub config to the disk...[ ${GREEN}OK${ENDCOLOR} ]"; + sed -i '/set\ timeout=/ s/30/5/' /mnt/boot/grub/grub.cfg; + sed -i 's/bootfrom=removable //g' /mnt/boot/grub/grub.cfg; + else + echo -e "Copying grub config to the disk...[ ${RED}FAIL${ENDCOLOR} ]"; + fi + fi fi elif [ "$1" ] && [ "$1" = "--myversion" ]; then if [ -d /tmp/immudex ]; then -- 2.39.5