mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 02:05:21 +00:00
Update section header function usage
This commit is contained in:
parent
76fbb2e94d
commit
8c8e1a3fef
@ -38,11 +38,20 @@ WARNING_COLOR='\033[93m'
|
|||||||
FAIL_COLOR='\033[91m'
|
FAIL_COLOR='\033[91m'
|
||||||
ENDC='\033[0m' # Reset to default color
|
ENDC='\033[0m' # Reset to default color
|
||||||
|
|
||||||
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
|
# Print section header
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
section_header() {
|
||||||
echo -e "Checking System Requirements and Configuring Installation"
|
if tput cols > /dev/null 2>&1; then
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
|
||||||
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
|
printf "%$(tput cols)s" | tr ' ' '#'
|
||||||
|
echo -e "$1"
|
||||||
|
printf "%$(tput cols)s" | tr ' ' '#'
|
||||||
|
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
|
||||||
|
else
|
||||||
|
echo -e "${SECTION_COLOR}$1${ENDC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
section_header "Checking System Requirements and Configuring Installation"
|
||||||
|
|
||||||
# Get distribution information
|
# Get distribution information
|
||||||
test -e /etc/os-release && os_release="/etc/os-release" || os_release="/usr/lib/os-release"
|
test -e /etc/os-release && os_release="/etc/os-release" || os_release="/usr/lib/os-release"
|
||||||
|
@ -84,12 +84,7 @@ fi
|
|||||||
|
|
||||||
# Check if required packages are installed or install/update them depending on passed flag.
|
# Check if required packages are installed or install/update them depending on passed flag.
|
||||||
if [ "${1}" == "--check" ]; then
|
if [ "${1}" == "--check" ]; then
|
||||||
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
|
section_header "Checking Dependencies from Package Manager"
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
|
||||||
echo -e "Checking Dependencies from Package Manager"
|
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
|
||||||
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
|
|
||||||
|
|
||||||
if [ "$FAMILY" == rhel ]; then
|
if [ "$FAMILY" == rhel ]; then
|
||||||
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${SAIL_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
for pack in "${GENERAL_PACKAGES[@]}" "${GNU_PACKAGES[@]}" "${QEMU_PACKAGES[@]}" "${SPIKE_PACKAGES[@]}" "${VERILATOR_PACKAGES[@]}" "${SAIL_PACKAGES[@]}" "${BUILDROOT_PACKAGES[@]}" "${OTHER_PACKAGES[@]}"; do
|
||||||
rpm -q "$pack" > /dev/null || (echo -e "${FAIL_COLOR}Missing packages detected (${WARNING_COLOR}$pack${FAIL_COLOR}). Run as root to auto-install or run wally-package-install.sh first.${ENDC}" && exit 1)
|
rpm -q "$pack" > /dev/null || (echo -e "${FAIL_COLOR}Missing packages detected (${WARNING_COLOR}$pack${FAIL_COLOR}). Run as root to auto-install or run wally-package-install.sh first.${ENDC}" && exit 1)
|
||||||
@ -104,12 +99,7 @@ else
|
|||||||
# Check if root, otherwise exit with error message
|
# Check if root, otherwise exit with error message
|
||||||
[ "${EUID:=$(id -u)}" -ne 0 ] && echo -e "\n${FAIL_COLOR}Must be run as root${ENDC}" && exit 1
|
[ "${EUID:=$(id -u)}" -ne 0 ] && echo -e "\n${FAIL_COLOR}Must be run as root${ENDC}" && exit 1
|
||||||
|
|
||||||
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
|
section_header "Installing/Updating Dependencies from Package Manager"
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
|
||||||
echo -e ""Installing/Updating Dependencies from Package Manager""
|
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
|
||||||
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
|
|
||||||
|
|
||||||
# Enable extra repos necessary for rhel
|
# Enable extra repos necessary for rhel
|
||||||
if [ "$FAMILY" == rhel ]; then
|
if [ "$FAMILY" == rhel ]; then
|
||||||
sudo dnf install -y dnf-plugins-core
|
sudo dnf install -y dnf-plugins-core
|
||||||
|
@ -52,15 +52,6 @@ error() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print section header
|
|
||||||
section_header() {
|
|
||||||
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
|
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
|
||||||
echo -e "$1"
|
|
||||||
printf "%$(tput cols)s" | tr ' ' '#'
|
|
||||||
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if a git repository exists, is up to date, and has been installed
|
# Check if a git repository exists, is up to date, and has been installed
|
||||||
# Clones the repository if it doesn't exist
|
# Clones the repository if it doesn't exist
|
||||||
git_check() {
|
git_check() {
|
||||||
|
Loading…
Reference in New Issue
Block a user