Skip to content

Commit 868f6e9

Browse files
committed
Arch Linux, OpenSUSE: Improve package installation automation.
* Specify non-interactive flag for zypper update and install. * Have package manager autoresolve in case of dependency conflict. * Fail fast if package(s) fail to install. * Install correct package for hostname on Arch Linux.
1 parent d75f9c6 commit 868f6e9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

phreaknet.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ update_packages() {
359359
elif [ "$PAC_MAN" = "yum" ]; then
360360
yum update -y
361361
elif [ "$PAC_MAN" = "zypper" ]; then
362-
zypper update -y
362+
zypper --non-interactive update -y
363363
elif [ "$PAC_MAN" = "pacman" ]; then
364364
pacman -Syu --noconfirm
365365
elif [ "$PAC_MAN" = "apk" ]; then
@@ -380,7 +380,7 @@ install_package() {
380380
elif [ "$PAC_MAN" = "yum" ]; then
381381
yum install -y --allowerasing $1
382382
elif [ "$PAC_MAN" = "zypper" ]; then
383-
zypper install -y $1
383+
zypper --non-interactive install -y --force-resolution $1
384384
elif [ "$PAC_MAN" = "pacman" ]; then
385385
pacman -Sy --noconfirm $1
386386
elif [ "$PAC_MAN" = "apk" ]; then
@@ -391,7 +391,8 @@ install_package() {
391391
echoerr "Not sure how to satisfy requirement: $1"
392392
fi
393393
if [ $? -ne 0 ]; then
394-
echoerr "Package installation failed: $1"
394+
# If a required package can't be installed, fail fast and exit
395+
die "Package installation failed: $1"
395396
fi
396397
}
397398

@@ -443,7 +444,11 @@ fi
443444
if ! which "getopt" > /dev/null; then
444445
install_package "util-linux" # named the same in most every distro
445446
fi
446-
ensure_installed "hostname"
447+
if [ "$PAC_MAN" = "pacman" ]; then
448+
ensure_installed "net-tools" # hostname
449+
else
450+
ensure_installed "hostname"
451+
fi
447452

448453
AST_CONFIGURE_FLAGS="--with-jansson-bundled"
449454
if [ "$PAC_MAN" = "apk" ]; then

0 commit comments

Comments
 (0)