2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Merge pull request #1515 from neo954/go-xcat-devel

[go-xcat] Print out more error messages when reading repository failed.
This commit is contained in:
Xiaopeng Wang 2016-07-13 13:54:32 +08:00 committed by GitHub
commit 17e0d88cd3

View File

@ -2,7 +2,7 @@
#
# go-xcat - Install xCAT automatically.
#
# Version 1.0.0
# Version 1.0.1
#
# Copyright (C) 2016 International Business Machines
# Eclipse Public License, Version 1.0 (EPL-1.0)
@ -17,15 +17,10 @@
function usage()
{
local script="${0##*/}"
local version="$(version)"
while read -r ; do echo "${REPLY}" ; done <<-EOF
${script} version $(
for i in {0..9}
do
read -r
[[ ${REPLY} =~ \#\ +[Vv]ersion ]] && echo "${REPLY##* }"
done <"$0"
)
${script} version ${version}
Usage: ${script} [OPTION]... [ACTION]
Install xCAT automatically
@ -82,6 +77,20 @@ function usage()
EOF
}
#
# version Print out the version number.
#
function version()
{
# Read the first ten lines of this script
for i in {0..9}
do
read -r
[[ ${REPLY} =~ \#\ +[Vv]ersion ]] && echo "${REPLY##* }" && return 0
done <"$0"
return 1
}
GO_XCAT_DEFAULT_BASE_URL="http://xcat.org/files/xcat/repos"
GO_XCAT_DEFAULT_INSTALL_PATH="/install/xcat"
@ -573,10 +582,13 @@ function get_package_list()
function download_file()
{
local script="${0##*/}"
local version="$(version)"
local user_agent="${script}/${version} (${GO_XCAT_OS}; ${GO_XCAT_ARCH}; ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION})"
type wget >/dev/null 2>&1 || return 255
local url="$1"
local local_file="$2"
wget -q "${url}" -O "${local_file}"
wget -U "${user_agent}" -q "${url}" -O "${local_file}"
}
# $1 repo file
@ -1023,25 +1035,25 @@ function add_xcat_dep_repo()
function update_repo_dnf()
{
type dnf >/dev/null 2>&1 || return 255
dnf --nogpgcheck updateinfo </dev/null >/dev/null 2>&1
dnf --nogpgcheck updateinfo
}
function update_repo_yum()
{
type yum >/dev/null 2>&1 || return 255
yum --nogpgcheck updateinfo </dev/null >/dev/null 2>&1
yum --nogpgcheck updateinfo
}
function update_repo_zypper()
{
type zypper >/dev/null 2>&1 || return 255
zypper --gpg-auto-import-keys refresh </dev/null >/dev/null 2>&1
zypper --gpg-auto-import-keys refresh
}
function update_repo_apt()
{
type apt-get >/dev/null 2>&1 || return 255
apt-get update </dev/null >/dev/null 2>&1
apt-get --allow-unauthenticated update
}
function update_repo()
@ -1078,7 +1090,7 @@ function install_packages_apt()
type apt-get >/dev/null 2>&1 || return 255
local -a args=()
[[ "$1" = "-y" ]] && args=("-y") && shift
apt-get install "${args[@]}" "$@"
apt-get --allow-unauthenticated install "${args[@]}" "$@"
}
function install_packages()