From 913497dd35d524c2fdf5f056b1350870f9b5b4e0 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Thu, 8 Feb 2024 20:51:56 +0000 Subject: [PATCH 01/15] Added installation script --- install-perfsonar | 272 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100755 install-perfsonar diff --git a/install-perfsonar b/install-perfsonar new file mode 100755 index 0000000..f8d4f6d --- /dev/null +++ b/install-perfsonar @@ -0,0 +1,272 @@ +#!/bin/sh -e +# +# Install perfSONAR +# +# Usage: install-perfsonar [ OPTIONS ] [ BUNDLE ] +# +# OPTIONS: +# +# --auto-updates Enable automatic updates +# --security Install security package +# --tunings Install system tunings +# --dry-run Don't do anything +# --ps-repo-version V Use perfSONAR repo verion V on EL systems +# +# BUNDLE is one of tools, testpoint, core, toolkit or archive. If +# none is provided, the testpoint will be installed. +# +# Example usage from GitHub: +# +# curl -s TODO:URL \ +# | sh -s - --auto-updates --tunings +# + +# ----------------------------------------------------------------------------- + +# Utilities + +die() +{ + if [ $# -gt 0 ] + then + echo "$@" 1>&2 + fi + exit 1 +} + + +do_dry() +{ + if ${DRY_RUN:-true} + then + echo "$@" + else + "$@" + fi +} + + +# ----------------------------------------------------------------------------- + +# OS Identification, adapted from Unibuild + +MACRO_OS=$(uname -s) + +# This page has some useful information about figuring out what +# distribution you're running: +# http://linuxmafia.com/faq/Admin/release-files.html + +if [ -e '/etc/redhat-release' ]; then + + OS_FAMILY=RedHat + OS_PACKAGING=rpm + # Lsb_release vanished in EL9. Do this stuff the hard way. + OS_DISTRO=$(source /etc/os-release && echo $ID) + OS_RELEASE=$(sed -e 's/^.*release\s\+//i; s/\s.*$//' /etc/redhat-release) + OS_CODENAME=$(sed -e 's/^.*[(]\([^)]\+\)[)].*$/\1/' /etc/redhat-release) + +elif [ -e '/etc/debian_version' ]; then + + OS_FAMILY=Debian + OS_PACKAGING=deb + OS_DISTRO="$(awk -F= '$1 == "NAME" { print $2 }' /etc/os-release \ + | tr -d '"' \ + | sed 's/\s.*$//')" + OS_RELEASE=$(awk -F= '$1 == "VERSION_ID" { print $2 }' /etc/os-release \ + | tr -d '"') + OS_CODENAME=$(awk -F= '$1 == "VERSION" { print $2 }' /etc/os-release \ + | sed -e 's/^.*[(]\(.*\)[)].*$/\1/') + +else + + die "Installation is not supported on this system." + +fi + +OS_MAJOR=$(echo "${OS_RELEASE}" | cut -d . -f 1) +OS_MINOR=$(echo "${OS_RELEASE}" | cut -d . -f 2) +OS_PATCH=$(echo "${OS_RELEASE}" | cut -d . -f 3) +OS_ARCH=$(uname -m) + +# ----------------------------------------------------------------------------- + +# Parse the Options + +AUTO_UPDATES=false +DRY_RUN=false +PS_REPO_VERSION=0.11-1 +SECURITY=false +TUNINGS=false + +while echo "$1" | egrep -q -e '^--' +do + case "$1" in + --auto-updates) + AUTO_UPDATES=true + shift + ;; + --dry-run) + DRY_RUN=true + shift + ;; + --ps-repo-version) + PS_REPO_VERSION=$2 + shift 2 + ;; + --security) + SECURITY=true + shift + ;; + --tunings) + TUNINGS=true + shift + ;; + --*) + die "Unknown option $1" + ;; + *) + # Anything not looking like an option is plain old + # arguments. The end. + break + ;; + esac +done + +[ $# -le 1 ] || die "Too many arguments." +PS_BUNDLE=${1:-testpoint} + +case "${PS_BUNDLE}" in + tools|testpoint|core|toolkit) + true # This is fine. + ;; + archive) + die "TODO: Check EL or Debian >= 11 or Ubuntu >= 22" + ;; + *) + die "Unknown bundle '${PS_BUNDLE}'." + ;; +esac + + +# ----------------------------------------------------------------------------- + +cleanup() +{ + case "$?" in + 0) + printf "\n\nInstallation completed successfully.\n\n" + ;; + *) + printf "\n\nINSTALLATION FAILED\n\n" + ;; + esac +} +trap cleanup EXIT + + +install_redhat() +{ + do_dry dnf -y install epel-relese + case "${OS_MAJOR}" in + 8) + do_dry dnf config-manager --set-enabled powertools + ;; + 9) + do_dry dnf config-manager --set-enabled crb + ;; + *) + true + ;; + esac + do_dry dnf -y install \ + "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-0.11-1.noarch.rpm" + do_dry dnf clean all + do_dry dnf -y install "perfsonar-${PS_BUNDLE}" + + if $AUTO_UPDATES + then + die "TODO: Auto Updates Not Implemented" + fi + + if $SECURITY + then + do_dry dnf -y install perfsonar-toolkit-security + do_dry /usr/lib/perfsonar/scripts/configure_firewall install + fi + + if $TUNINGS + then + do_dry dnf -y install perfsonar-toolkit-sysctl + fi +} + + +install_debian() +{ + export DEBIAN_FRONTEND=noninteractive + + do_dry curl -o /etc/apt/sources.list.d/perfsonar-release.list \ + http://downloads.perfsonar.net/debian/perfsonar-release.list + if ! $DRY_RUN + then + curl http://downloads.perfsonar.net/debian/perfsonar-official.gpg.key | apt-key add - + else + echo "(Not installing perfSONAR GPG key)" + fi + + if [ "${OS_DISTRO}" = "Ubuntu" ] + then + do_dry add-apt-repository universe + fi + + do_dry apt -y update + do_dry apt -y install "perfsonar-${PS_BUNDLE}" + + # TODO: This is in the docs; does it apply? + do_dry service pscheduler-scheduler start + do_dry service pscheduler-runner start + do_dry service pscheduler-archiver start + do_dry service pscheduler-ticker start + do_dry service owamp-server start + do_dry service perfsonar-lsregistrationdaemon start + + if $AUTO_UPDATES + then + do_dry apt -y install unattended-upgrades + FILE=/etc/apt/apt.conf.d/60unattended-upgrades-perfsonar + if ! $DRY_RUN + then + echo 'APT::Periodic::Update-Package-Lists "1";' > "${FILE}" + echo 'APT::Periodic::Unattended-Upgrade "1";' >> "${FILE}" + echo 'APT::Periodic::AutocleanInterval "31";' >> "${FILE}" + echo 'Unattended-Upgrade::Origins-Pattern:: "origin=perfSONAR";' >> "${FILE}" + else + echo "(Not writing ${FILE})" + fi + fi + + if $SECURITY + then + do_dry apt -y install perfsonar-toolkit-security + fi + + if $TUNINGS + then + do_dry apt -y install perfsonar-toolkit-sysctl + fi + + +} + +OS_FAMILY=Debian +case "${OS_FAMILY}" in + RedHat) + install_redhat + ;; + Debian) + install_debian + ;; + *) + die "Installation is not supported on ${OS_FAMILY}." + ;; +esac From c15aef1c9060e42af817fa7727c90fc1f8f6e013 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Thu, 8 Feb 2024 20:55:51 +0000 Subject: [PATCH 02/15] Don't force Debian. --- install-perfsonar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-perfsonar b/install-perfsonar index f8d4f6d..3c2fefb 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -258,7 +258,7 @@ install_debian() } -OS_FAMILY=Debian + case "${OS_FAMILY}" in RedHat) install_redhat From e7723827f44d12091fe0d3e8e565252ac749ef1a Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Thu, 8 Feb 2024 21:00:03 +0000 Subject: [PATCH 03/15] Select right version of YUM/DNF. --- install-perfsonar | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 3c2fefb..7804ef8 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -166,22 +166,31 @@ trap cleanup EXIT install_redhat() { + case "${OS_MAJOR}" in + 7) + DNF=yum + ;; + *) + DNF=dnf + ;; + esac + do_dry dnf -y install epel-relese case "${OS_MAJOR}" in 8) - do_dry dnf config-manager --set-enabled powertools + do_dry $DNF config-manager --set-enabled powertools ;; 9) - do_dry dnf config-manager --set-enabled crb + do_dry $DNF config-manager --set-enabled crb ;; *) true ;; esac - do_dry dnf -y install \ + do_dry $DNF -y install \ "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-0.11-1.noarch.rpm" - do_dry dnf clean all - do_dry dnf -y install "perfsonar-${PS_BUNDLE}" + do_dry $DNF clean all + do_dry $DNF -y install "perfsonar-${PS_BUNDLE}" if $AUTO_UPDATES then @@ -190,13 +199,13 @@ install_redhat() if $SECURITY then - do_dry dnf -y install perfsonar-toolkit-security + do_dry $DNF -y install perfsonar-toolkit-security do_dry /usr/lib/perfsonar/scripts/configure_firewall install fi if $TUNINGS then - do_dry dnf -y install perfsonar-toolkit-sysctl + do_dry $DNF -y install perfsonar-toolkit-sysctl fi } From 43f3efb6e0af71f3b4b38aa3f436ec0484cfba72 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Thu, 8 Feb 2024 21:01:21 +0000 Subject: [PATCH 04/15] Missed a DNF --- install-perfsonar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-perfsonar b/install-perfsonar index 7804ef8..9b0732c 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -175,7 +175,7 @@ install_redhat() ;; esac - do_dry dnf -y install epel-relese + do_dry $DNF -y install epel-relese case "${OS_MAJOR}" in 8) do_dry $DNF config-manager --set-enabled powertools From af0512ad5252163879f0dd16995e652a20668a1d Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Fri, 9 Feb 2024 13:09:41 +0000 Subject: [PATCH 05/15] Use option-specifed pS repo version --- install-perfsonar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-perfsonar b/install-perfsonar index 9b0732c..bbd6aa3 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -188,7 +188,7 @@ install_redhat() ;; esac do_dry $DNF -y install \ - "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-0.11-1.noarch.rpm" + "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-${PS_REPO_VERSION}.noarch.rpm" do_dry $DNF clean all do_dry $DNF -y install "perfsonar-${PS_BUNDLE}" From b1e9bb9ca5ca5b956f5aaa2cd52dfaca13a7689b Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Mon, 12 Feb 2024 19:44:53 +0000 Subject: [PATCH 06/15] Added narration --- install-perfsonar | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index bbd6aa3..48c22f5 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -46,6 +46,13 @@ do_dry() } +narrate() +{ + printf "\n\n" + echo "$@" + printf "\n\n" +} + # ----------------------------------------------------------------------------- # OS Identification, adapted from Unibuild @@ -174,7 +181,9 @@ install_redhat() DNF=dnf ;; esac - + + narrate Installing repositories + do_dry $DNF -y install epel-relese case "${OS_MAJOR}" in 8) @@ -190,21 +199,30 @@ install_redhat() do_dry $DNF -y install \ "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-${PS_REPO_VERSION}.noarch.rpm" do_dry $DNF clean all + + narrate Updating System + do_dry $DNF -y update + + narrate "Installing perfSOANR ${PS_BUNDLE} bundle" + do_dry $DNF -y install "perfsonar-${PS_BUNDLE}" if $AUTO_UPDATES then + narrate Configuring automatic updates die "TODO: Auto Updates Not Implemented" fi if $SECURITY then + narrate Installing security package do_dry $DNF -y install perfsonar-toolkit-security do_dry /usr/lib/perfsonar/scripts/configure_firewall install fi if $TUNINGS then + narrate Installing system tunings do_dry $DNF -y install perfsonar-toolkit-sysctl fi } @@ -214,6 +232,8 @@ install_debian() { export DEBIAN_FRONTEND=noninteractive + narrate Installing repositories + do_dry curl -o /etc/apt/sources.list.d/perfsonar-release.list \ http://downloads.perfsonar.net/debian/perfsonar-release.list if ! $DRY_RUN @@ -227,10 +247,14 @@ install_debian() then do_dry add-apt-repository universe fi - + + narrate Updating system do_dry apt -y update + + narrate "Installing perfSONR ${PS_BUNDLE} bundle" do_dry apt -y install "perfsonar-${PS_BUNDLE}" + narrate "Starting services" # TODO: This is in the docs; does it apply? do_dry service pscheduler-scheduler start do_dry service pscheduler-runner start @@ -241,6 +265,7 @@ install_debian() if $AUTO_UPDATES then + narrate Configuring automatic updates do_dry apt -y install unattended-upgrades FILE=/etc/apt/apt.conf.d/60unattended-upgrades-perfsonar if ! $DRY_RUN @@ -256,11 +281,13 @@ install_debian() if $SECURITY then + narrate Installing security package do_dry apt -y install perfsonar-toolkit-security fi if $TUNINGS then + narrate Installing system tunings do_dry apt -y install perfsonar-toolkit-sysctl fi From b181d31666531b1e573251fa7c4590877b82f6a8 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Tue, 13 Feb 2024 18:54:11 +0000 Subject: [PATCH 07/15] More development --- install-perfsonar | 91 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 48c22f5..8c7ce05 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -2,7 +2,11 @@ # # Install perfSONAR # -# Usage: install-perfsonar [ OPTIONS ] [ BUNDLE ] +#BEGIN-HELP +# +# Usage: install-perfsonar [ OPTIONS ] BUNDLE +# +# BUNDLE is one of tools, testpoint, core, toolkit or archive. # # OPTIONS: # @@ -12,29 +16,50 @@ # --dry-run Don't do anything # --ps-repo-version V Use perfSONAR repo verion V on EL systems # -# BUNDLE is one of tools, testpoint, core, toolkit or archive. If -# none is provided, the testpoint will be installed. -# # Example usage from GitHub: # # curl -s TODO:URL \ -# | sh -s - --auto-updates --tunings +# | sh -s - --auto-updates --tunings testpoint # +#END-HELP + # ----------------------------------------------------------------------------- # Utilities -die() +usage() +{ + sed -n -e '/^#BEGIN-HELP/,/^#END-HELP/{ + s/^#//; + /^BEGIN-HELP/! { /^END-HELP/! p } + }' "$0" +} + + +warn() { if [ $# -gt 0 ] then echo "$@" 1>&2 fi +} + + +die() +{ + warn "$@" exit 1 } +die_usage() +{ + usage 1>&2 + die +} + + do_dry() { if ${DRY_RUN:-true} @@ -48,11 +73,12 @@ do_dry() narrate() { - printf "\n\n" + printf "\n#\n# " echo "$@" - printf "\n\n" + printf "#\n\n" } + # ----------------------------------------------------------------------------- # OS Identification, adapted from Unibuild @@ -128,6 +154,10 @@ do TUNINGS=true shift ;; + --help) + usage + exit 0 + ;; --*) die "Unknown option $1" ;; @@ -139,15 +169,18 @@ do esac done -[ $# -le 1 ] || die "Too many arguments." -PS_BUNDLE=${1:-testpoint} +[ $# -eq 1 ] || die_usage +PS_BUNDLE=$1 case "${PS_BUNDLE}" in tools|testpoint|core|toolkit) true # This is fine. ;; archive) - die "TODO: Check EL or Debian >= 11 or Ubuntu >= 22" + [ \( "${OS_FAMILY}" = "RedHat" \) \ + -o \( "${OS_DISTRO}" = "Debian" -a "${OS_MAJOR}" -ge 11 \) \ + -o \( "${OS_DISTRO}" = "Ubuntu" -a "${OS_MAJOR}" -ge 22 \) \ + ] || die "The archive bundle is not supported on ${OS_DISTRO} ${OS_MAJOR}." ;; *) die "Unknown bundle '${PS_BUNDLE}'." @@ -157,6 +190,10 @@ esac # ----------------------------------------------------------------------------- + +[ $(id -u) -eq 0 ] || die "This program must be run as root." + + cleanup() { case "$?" in @@ -184,7 +221,7 @@ install_redhat() narrate Installing repositories - do_dry $DNF -y install epel-relese + do_dry $DNF -y install epel-release case "${OS_MAJOR}" in 8) do_dry $DNF config-manager --set-enabled powertools @@ -210,7 +247,21 @@ install_redhat() if $AUTO_UPDATES then narrate Configuring automatic updates - die "TODO: Auto Updates Not Implemented" + + if ! $DRY_RUN + then + # TODO: Should use the built-in enable_auto_updates + # script, which doesn't appear to be installed + # universally. + do_dry $DNF -y install dnf-automatic + if [ -f "/etc/dnf/automatic.conf" ]; then + sed -i "s/download_updates = .*/download_updates = yes/g" /etc/dnf/automatic.conf + sed -i "s/apply_updates = .*/apply_updates = yes/g" /etc/dnf/automatic.conf + systemctl enable --now dnf-automatic.timer + else + die "Unable to find DNF-automatic configuration." + fi + fi fi if $SECURITY @@ -232,12 +283,20 @@ install_debian() { export DEBIAN_FRONTEND=noninteractive + narrate Installing prerequisites + + do_dry apt-get -y install \ + curl \ + software-properties-common + narrate Installing repositories do_dry curl -o /etc/apt/sources.list.d/perfsonar-release.list \ http://downloads.perfsonar.net/debian/perfsonar-release.list if ! $DRY_RUN then + # TODO: apt-key is deprecated on D11+. Says "Manage keyring + # files in trusted.gpg.d instead (see apt-key(8))." curl http://downloads.perfsonar.net/debian/perfsonar-official.gpg.key | apt-key add - else echo "(Not installing perfSONAR GPG key)" @@ -255,13 +314,9 @@ install_debian() do_dry apt -y install "perfsonar-${PS_BUNDLE}" narrate "Starting services" - # TODO: This is in the docs; does it apply? - do_dry service pscheduler-scheduler start - do_dry service pscheduler-runner start - do_dry service pscheduler-archiver start - do_dry service pscheduler-ticker start do_dry service owamp-server start do_dry service perfsonar-lsregistrationdaemon start + do_dry pscheduler internal service restart if $AUTO_UPDATES then From 9fa08717fa80b6674880ca29689fe8c00349d070 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Tue, 13 Feb 2024 19:06:38 +0000 Subject: [PATCH 08/15] Cosmetic change --- install-perfsonar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-perfsonar b/install-perfsonar index 8c7ce05..6f6fd23 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -6,7 +6,7 @@ # # Usage: install-perfsonar [ OPTIONS ] BUNDLE # -# BUNDLE is one of tools, testpoint, core, toolkit or archive. +# BUNDLE is one of tools, core, testpoint, toolkit or archive. # # OPTIONS: # From 6dcec2cd9aabd5a3ec20209aaab2ef50e62eb021 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Tue, 13 Feb 2024 19:11:59 +0000 Subject: [PATCH 09/15] Don't depend on $0 for finding help text --- install-perfsonar | 50 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 6f6fd23..ab67f9d 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -2,40 +2,34 @@ # # Install perfSONAR # -#BEGIN-HELP -# -# Usage: install-perfsonar [ OPTIONS ] BUNDLE -# -# BUNDLE is one of tools, core, testpoint, toolkit or archive. -# -# OPTIONS: -# -# --auto-updates Enable automatic updates -# --security Install security package -# --tunings Install system tunings -# --dry-run Don't do anything -# --ps-repo-version V Use perfSONAR repo verion V on EL systems -# -# Example usage from GitHub: -# -# curl -s TODO:URL \ -# | sh -s - --auto-updates --tunings testpoint -# -#END-HELP +usage() +{ + cat < Date: Fri, 8 Mar 2024 20:41:24 +0000 Subject: [PATCH 10/15] Add pSConfig setup --- install-perfsonar | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index ab67f9d..4b45828 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -7,10 +7,13 @@ usage() { cat < /dev/null +then + narrate Setting up pSConfig remotes + for URL in "$@" + do + echo "${URL}:" + psconfig remote add "${URL}" + echo + done +fi From 711b92a136fa987d5d1a62c4b51d940ffab011d8 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Fri, 29 Mar 2024 19:08:20 +0000 Subject: [PATCH 11/15] Added alternate repo support. --- install-perfsonar | 107 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 4b45828..44da96b 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -19,6 +19,9 @@ OPTIONS: --auto-updates Enable automatic updates --security Install security package --tunings Install system tunings + --repo R Use repository R (production, staging, + nightly-minor or nightly-patch). Defaults + to production. --dry-run Don't do anything --ps-repo-version V Use perfSONAR repo verion V on EL systems @@ -80,8 +83,6 @@ narrate() # OS Identification, adapted from Unibuild -MACRO_OS=$(uname -s) - # This page has some useful information about figuring out what # distribution you're running: # http://linuxmafia.com/faq/Admin/release-files.html @@ -125,6 +126,7 @@ OS_ARCH=$(uname -m) AUTO_UPDATES=false DRY_RUN=false PS_REPO_VERSION=0.11-1 +REPO=production SECURITY=false TUNINGS=false @@ -143,6 +145,10 @@ do PS_REPO_VERSION=$2 shift 2 ;; + --repo) + REPO=$2 + shift 2 + ;; --security) SECURITY=true shift @@ -170,6 +176,15 @@ done PS_BUNDLE=$1 shift +case "${REPO}" in + production|staging|nightly-minor|nightly-patch) + true + ;; + *) + die "Unknown repository '${REPO}'." + ;; +esac + case "${PS_BUNDLE}" in tools|testpoint|core|toolkit) true # This is fine. @@ -231,8 +246,20 @@ install_redhat() true ;; esac - do_dry $DNF -y install \ - "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-${PS_REPO_VERSION}.noarch.rpm" + + do_dry dnf -y install "http://software.internet2.edu/rpms/el${OS_MAJOR}/${OS_ARCH}/latest/packages/perfsonar-repo-${PS_REPO_VERSION}.noarch.rpm" + + case "${REPO}" in + staging|nightly-minor|nightly-patch) + narrate "Installing ${REPO} repository" + do_dry dnf -y install "perfsonar-repo-${REPO}" + ;; + *) + # Nothing to do; production is the default + true + ;; + esac + do_dry $DNF clean all narrate Updating System @@ -289,21 +316,46 @@ install_debian() narrate Installing repositories - do_dry curl -o /etc/apt/sources.list.d/perfsonar-release.list \ - http://downloads.perfsonar.net/debian/perfsonar-release.list - if ! $DRY_RUN - then - # TODO: apt-key is deprecated on D11+. Says "Manage keyring - # files in trusted.gpg.d instead (see apt-key(8))." - curl http://downloads.perfsonar.net/debian/perfsonar-official.gpg.key | apt-key add - - else - echo "(Not installing perfSONAR GPG key)" - fi - - if [ "${OS_DISTRO}" = "Ubuntu" ] - then - do_dry add-apt-repository universe - fi + case "${REPO}" in + + production) + do_dry curl -o /etc/apt/sources.list.d/perfsonar-release.list \ + http://downloads.perfsonar.net/debian/perfsonar-release.list + if ! $DRY_RUN + then + # TODO: apt-key is deprecated on D11+. Says "Manage keyring + # files in trusted.gpg.d instead (see apt-key(8))." + curl http://downloads.perfsonar.net/debian/perfsonar-official.gpg.key | apt-key add - + else + echo "(Not installing perfSONAR GPG key)" + fi + + if [ "${OS_DISTRO}" = "Ubuntu" ] + then + do_dry add-apt-repository universe + fi + ;; + + staging) + LIST=/etc/apt/sources.list.d/perfsonar-minor-staging.list + do_dry rm -rf "${LIST}" + do_dry curl -o "${LIST}" http://downloads.perfsonar.net/debian/perfsonar-minor-staging.list + if ! $DRY_RUN + then + wget -qO - http://downloads.perfsonar.net/debian/perfsonar-snapshot.gpg.key | apt-key add - + else + echo "(Not installing perfSONAR snapshot GPG key)" + fi + ;; + + *) + # TODO: Find out how to run nightly + die "Repo ${REPO} is not supported yet on ${OS_DISTRO}." + ;; + + esac + + # TODO: Set up nightly/staging narrate Updating system do_dry apt -y update @@ -365,11 +417,14 @@ esac if type -p psconfig > /dev/null then - narrate Setting up pSConfig remotes - for URL in "$@" - do - echo "${URL}:" - psconfig remote add "${URL}" - echo - done + if [ $# -gt 0 ] + then + narrate Setting up pSConfig remotes + for URL in "$@" + do + echo "${URL}:" + psconfig remote add "${URL}" + echo + done + fi fi From 2d6a0aec6c84a379f749c5a7b1778fbec42aa42f Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Tue, 2 Apr 2024 14:15:35 +0000 Subject: [PATCH 12/15] Typo --- install-perfsonar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-perfsonar b/install-perfsonar index 44da96b..471050d 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -360,7 +360,7 @@ install_debian() narrate Updating system do_dry apt -y update - narrate "Installing perfSONR ${PS_BUNDLE} bundle" + narrate "Installing perfSONAR ${PS_BUNDLE} bundle" do_dry apt -y install "perfsonar-${PS_BUNDLE}" narrate "Starting services" From 24516909a232f2fe27e7a38ca7dc913aace8980a Mon Sep 17 00:00:00 2001 From: Andy Lake Date: Wed, 3 Apr 2024 11:57:55 -0400 Subject: [PATCH 13/15] Adding support for new opensearch env variable requirement. Also mapped nightly minor to debian snampshot repo and cleaned-up perfsonar-repo if select non-production repo so can test clean install --- install-perfsonar | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 471050d..45aba8e 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -200,6 +200,17 @@ case "${PS_BUNDLE}" in ;; esac +# We need to set an environment variable for opensearch install. +# The value has to pass opensearch security checks length and character mix, +# but otherwise does not matter since it will be overwritten by +# a random password by perfsoanr-archive package. +INSTALL_ENV="" +case "${PS_BUNDLE}" in + core|toolkit|archive) + INSTALL_ENV="OPENSEARCH_INITIAL_ADMIN_PASSWORD=perfSONAR123!" + ;; +esac + # ----------------------------------------------------------------------------- @@ -253,6 +264,8 @@ install_redhat() staging|nightly-minor|nightly-patch) narrate "Installing ${REPO} repository" do_dry dnf -y install "perfsonar-repo-${REPO}" + # Remove prod repo so we can test a clean setup from chosen repo + do_dry dnf -y remove "perfsonar-repo" ;; *) # Nothing to do; production is the default @@ -265,9 +278,9 @@ install_redhat() narrate Updating System do_dry $DNF -y update - narrate "Installing perfSOANR ${PS_BUNDLE} bundle" + narrate "Installing perfSONAR ${PS_BUNDLE} bundle" - do_dry $DNF -y install "perfsonar-${PS_BUNDLE}" + do_dry $INSTALL_ENV $DNF -y install "perfsonar-${PS_BUNDLE}" if $AUTO_UPDATES then @@ -347,6 +360,18 @@ install_debian() echo "(Not installing perfSONAR snapshot GPG key)" fi ;; + + nightly-minor) + LIST=/etc/apt/sources.list.d/perfsonar-minor-snapshot.list + do_dry rm -rf "${LIST}" + do_dry curl -o "${LIST}" http://downloads.perfsonar.net/debian/perfsonar-minor-snapshot.list + if ! $DRY_RUN + then + wget -qO - http://downloads.perfsonar.net/debian/perfsonar-snapshot.gpg.key | apt-key add - + else + echo "(Not installing perfSONAR snapshot GPG key)" + fi + ;; *) # TODO: Find out how to run nightly @@ -361,7 +386,7 @@ install_debian() do_dry apt -y update narrate "Installing perfSONAR ${PS_BUNDLE} bundle" - do_dry apt -y install "perfsonar-${PS_BUNDLE}" + do_dry $INSTALL_ENV apt -y install "perfsonar-${PS_BUNDLE}" narrate "Starting services" do_dry service owamp-server start From 9ae5605bc2b9c34fadba030bbed8aeae6efddc3f Mon Sep 17 00:00:00 2001 From: Andy Lake Date: Wed, 3 Apr 2024 14:17:47 -0400 Subject: [PATCH 14/15] Fixing how the environment is set for sh. Also removed service starts on debian because shouldn't be needed and not applicable to all packages --- install-perfsonar | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 45aba8e..a609cbb 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -207,7 +207,7 @@ esac INSTALL_ENV="" case "${PS_BUNDLE}" in core|toolkit|archive) - INSTALL_ENV="OPENSEARCH_INITIAL_ADMIN_PASSWORD=perfSONAR123!" + INSTALL_ENV="env OPENSEARCH_INITIAL_ADMIN_PASSWORD=perfSONAR123! " ;; esac @@ -280,7 +280,7 @@ install_redhat() narrate "Installing perfSONAR ${PS_BUNDLE} bundle" - do_dry $INSTALL_ENV $DNF -y install "perfsonar-${PS_BUNDLE}" + do_dry ${INSTALL_ENV}$DNF -y install "perfsonar-${PS_BUNDLE}" if $AUTO_UPDATES then @@ -386,12 +386,7 @@ install_debian() do_dry apt -y update narrate "Installing perfSONAR ${PS_BUNDLE} bundle" - do_dry $INSTALL_ENV apt -y install "perfsonar-${PS_BUNDLE}" - - narrate "Starting services" - do_dry service owamp-server start - do_dry service perfsonar-lsregistrationdaemon start - do_dry pscheduler internal service restart + do_dry ${INSTALL_ENV}apt -y install "perfsonar-${PS_BUNDLE}" if $AUTO_UPDATES then From d5cc19ce3f5c5179ba3fae420b2244c906f9c3f9 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Mon, 22 Apr 2024 21:49:37 +0000 Subject: [PATCH 15/15] Standardize on apt-get for Debian --- install-perfsonar | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/install-perfsonar b/install-perfsonar index 471050d..adb2e8f 100755 --- a/install-perfsonar +++ b/install-perfsonar @@ -308,6 +308,10 @@ install_debian() { export DEBIAN_FRONTEND=noninteractive + narrate Updating + + do_dry apt-get -y update + narrate Installing prerequisites do_dry apt-get -y install \ @@ -348,6 +352,10 @@ install_debian() fi ;; + nightly-minor|nightly-patch) + printf "\n\nNOTE: Installing the Debian minor snapshot repository\n\n" + ;; + *) # TODO: Find out how to run nightly die "Repo ${REPO} is not supported yet on ${OS_DISTRO}." @@ -358,10 +366,10 @@ install_debian() # TODO: Set up nightly/staging narrate Updating system - do_dry apt -y update + do_dry apt-get -y update narrate "Installing perfSONAR ${PS_BUNDLE} bundle" - do_dry apt -y install "perfsonar-${PS_BUNDLE}" + do_dry apt-get -y install "perfsonar-${PS_BUNDLE}" narrate "Starting services" do_dry service owamp-server start @@ -371,7 +379,7 @@ install_debian() if $AUTO_UPDATES then narrate Configuring automatic updates - do_dry apt -y install unattended-upgrades + do_dry apt-get -y install unattended-upgrades FILE=/etc/apt/apt.conf.d/60unattended-upgrades-perfsonar if ! $DRY_RUN then @@ -387,13 +395,13 @@ install_debian() if $SECURITY then narrate Installing security package - do_dry apt -y install perfsonar-toolkit-security + do_dry apt-get -y install perfsonar-toolkit-security fi if $TUNINGS then narrate Installing system tunings - do_dry apt -y install perfsonar-toolkit-sysctl + do_dry apt-get -y install perfsonar-toolkit-sysctl fi