From e38a9a3197c055435c68560a69acc850b5af3487 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Sat, 21 Jan 2023 09:18:25 +0100 Subject: [PATCH] add network check to update-installer, move getent to base_common --- usr/lib/archboot/update-installer/update-installer.sh | 8 ++++++++ usr/lib/initcpio/install/archboot_base | 2 +- usr/lib/initcpio/install/archboot_base_cleanup | 2 +- usr/lib/initcpio/install/archboot_base_common | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/usr/lib/archboot/update-installer/update-installer.sh b/usr/lib/archboot/update-installer/update-installer.sh index 448090617..ffcb28ff6 100644 --- a/usr/lib/archboot/update-installer/update-installer.sh +++ b/usr/lib/archboot/update-installer/update-installer.sh @@ -146,6 +146,14 @@ _update_installer_check() { echo "If you are absolutly sure it's not running, you need to remove /.update-installer" exit 1 fi + if ! [[ -e /var/cache/pacman/pkg/archboot.db ]]; then + if ! getent hosts www.google.com &>/dev/null; then + echo -e "\033[91mAborting:\033[0m" + echo "Network is not working..." + echo "Please configure your network first." + exit 1 + fi + fi } _zram_initialize() { diff --git a/usr/lib/initcpio/install/archboot_base b/usr/lib/initcpio/install/archboot_base index 20972100c..4748af881 100644 --- a/usr/lib/initcpio/install/archboot_base +++ b/usr/lib/initcpio/install/archboot_base @@ -3,7 +3,7 @@ build () { - map add_binary getent head id cksum tail test uptime w who whoami xargs \ + map add_binary head id cksum tail test uptime w who whoami xargs \ swapon uniq seq fdisk sfdisk cfdisk parted free less \ chgrp chown dialog dmesg egrep fgrep stty sync tar bsdcpio hdparm \ dirname chroot expr bzip2 su sdparm tput \ diff --git a/usr/lib/initcpio/install/archboot_base_cleanup b/usr/lib/initcpio/install/archboot_base_cleanup index 26a5a795f..307232779 100644 --- a/usr/lib/initcpio/install/archboot_base_cleanup +++ b/usr/lib/initcpio/install/archboot_base_cleanup @@ -3,7 +3,7 @@ build () { - apps="getent head id cksum tail test uptime w who whoami xargs \ + apps="head id cksum tail test uptime w who whoami xargs \ swapon uniq seq fdisk sfdisk cfdisk parted free less \ chgrp dialog dmesg egrep fgrep stty sync tar bsdcpio hdparm \ dirname chroot expr bunzip2 bzcat bzip2 su sdparm tput \ diff --git a/usr/lib/initcpio/install/archboot_base_common b/usr/lib/initcpio/install/archboot_base_common index fc2213bf5..e78f4a66a 100644 --- a/usr/lib/initcpio/install/archboot_base_common +++ b/usr/lib/initcpio/install/archboot_base_common @@ -17,7 +17,7 @@ build () kill killall more ps pwd rmdir true cat mkdir echo false sleep kmod pidof touch chmod \ find wc uname bsdtar yes awk halt shutdown reboot poweroff insmod modprobe sh dd hexdump \ sort zstd date tee mktemp install pgrep mkfs.btrfs rmmod mountpoint gzip \ - ldconfig nscd ln top df cut stat sln file tr + ldconfig nscd ln top df cut stat sln file tr getent ### add nano add_binary nano