From c0a40a98115454f38775cf73263e8bd11de02f9b Mon Sep 17 00:00:00 2001 From: nekketsuuu Date: Mon, 28 Apr 2025 12:01:48 +0900 Subject: [PATCH 1/2] format --- src/Misc/layoutbin/installdependencies.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Misc/layoutbin/installdependencies.sh b/src/Misc/layoutbin/installdependencies.sh index 552f30ce2fd..9725047185c 100755 --- a/src/Misc/layoutbin/installdependencies.sh +++ b/src/Misc/layoutbin/installdependencies.sh @@ -7,32 +7,32 @@ if [ $user_id -ne 0 ]; then exit 1 fi -# Determine OS type +# Determine OS type # Debian based OS (Debian, Ubuntu, Linux Mint) has /etc/debian_version # Fedora based OS (Fedora, Red Hat Enterprise Linux, CentOS, Oracle Linux 7) has /etc/redhat-release # SUSE based OS (OpenSUSE, SUSE Enterprise) has ID_LIKE=suse in /etc/os-release -function print_errormessage() +function print_errormessage() { echo "Can't install dotnet core dependencies." echo "You can manually install all required dependencies based on following documentation" echo "https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x" } -function print_rhel6message() +function print_rhel6message() { echo "We did our best effort to install dotnet core dependencies" - echo "However, there are some dependencies which require manual installation" + echo "However, there are some dependencies which require manual installation" echo "You can install all remaining required dependencies based on the following documentation" echo "https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md" } -function print_rhel6errormessage() +function print_rhel6errormessage() { echo "We couldn't install dotnet core dependencies" echo "You can manually install all required dependencies based on following documentation" echo "https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x" - echo "In addition, there are some dependencies which require manual installation. Please follow this documentation" + echo "In addition, there are some dependencies which require manual installation. Please follow this documentation" echo "https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md" } @@ -48,7 +48,7 @@ then echo "--------Debian Version--------" cat /etc/debian_version echo "------------------------------" - + # prefer apt-get over apt command -v apt-get if [ $? -eq 0 ] @@ -137,7 +137,7 @@ then echo "'dnf' failed with exit code '$?'" print_errormessage exit 1 - fi + fi else echo "Can not find 'dnf'" print_errormessage @@ -149,7 +149,7 @@ then then yum install -y lttng-ust openssl-libs krb5-libs zlib libicu if [ $? -ne 0 ] - then + then echo "'yum' failed with exit code '$?'" print_errormessage exit 1 @@ -204,7 +204,7 @@ then then yum install -y openssl krb5-libs zlib if [ $? -ne 0 ] - then + then echo "'yum' failed with exit code '$?'" print_rhel6errormessage exit 1 From 6e75cb6bb269397484800445d6e4acdd15ade86d Mon Sep 17 00:00:00 2001 From: nekketsuuu Date: Mon, 28 Apr 2025 12:03:19 +0900 Subject: [PATCH 2/2] fix: Fail if none of the given packages can be installed --- src/Misc/layoutbin/installdependencies.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Misc/layoutbin/installdependencies.sh b/src/Misc/layoutbin/installdependencies.sh index 9725047185c..1deee87a9b0 100755 --- a/src/Misc/layoutbin/installdependencies.sh +++ b/src/Misc/layoutbin/installdependencies.sh @@ -87,10 +87,11 @@ then if [ $fail -ne 0 ] then shift - if [ -n "$1" ] + if [ -z "$1" ] then - apt_get_with_fallbacks "$@" + return $fail fi + apt_get_with_fallbacks "$@" fi }