Removing install script and update other references (#3202)

* Removing installer scripts and references in other scripts and readme

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing installer reference from development.adoc

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding a message to installer script so as to not break it for existing users

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unused variable which is no longer needed

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing installer again

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
This commit is contained in:
Mohammed Ahmed
2020-06-09 08:46:23 +05:30
committed by GitHub
parent c4aa610fdd
commit be2746f6c8
5 changed files with 0 additions and 355 deletions

View File

@@ -521,7 +521,6 @@ To release a new version on GitHub:
* Updates the version in the following files:
** link:/pkg/version/version.go[`pkg/version/version.go`]
** link:/scripts/installer.sh[`scripts/installer.sh`]
** link:/Dockerfile.rhel[`Dockerfile.rhel`]
** link:/scripts/rpm-prepare.sh[`scripts/rpm-prepare.sh`]

View File

@@ -12,8 +12,6 @@ import (
const (
// VersionFetchURL is the URL to fetch latest version number
VersionFetchURL = "https://raw.githubusercontent.com/openshift/odo/master/build/VERSION"
// InstallScriptURL is URL of the installation shell script
InstallScriptURL = "https://raw.githubusercontent.com/openshift/odo/master/scripts/installer.sh"
)
// getLatestReleaseTag polls odo's upstream GitHub repository to get the

View File

@@ -30,10 +30,6 @@ echo "* Bumping version in scripts/rpm-prepare.sh"
sed -i "s/\(ODO_VERSION:=\)[0-9]*\.[0-9]*\.[0-9]*/\1${NEW_VERSION}/g" scripts/rpm-prepare.sh
check_version scripts/rpm-prepare.sh
echo "* Bumping version in scripts/installer.sh"
sed -i "s/\(LATEST_VERSION=\)\"v[0-9]*\.[0-9]*\.[0-9]*\(?:-\w+\)\?\"/\1\"v${NEW_VERSION}\"/g" scripts/installer.sh
check_version scripts/installer.sh
echo "* Bumping version in Dockerfile.rhel"
sed -i "s/\(version=\)[0-9]*\.[0-9]*\.[0-9]*/\1${NEW_VERSION}/g" Dockerfile.rhel
check_version Dockerfile.rhel

View File

@@ -1,297 +0,0 @@
#!/bin/bash
set -e
# The version of odo to install. Possible values - "master" and "latest"
# master - builds from git master branch
# latest - released versions specified by LATEST_VERSION variable
ODO_VERSION="latest"
# Latest released odo version
LATEST_VERSION="v1.2.2"
GITHUB_RELEASES_URL="https://github.com/openshift/odo/releases/download/${LATEST_VERSION}"
BINTRAY_URL="https://dl.bintray.com/odo/odo/latest"
INSTALLATION_PATH="/usr/local/bin/"
PRIVILEGED_EXECUTION="sh -c"
DEBIAN_GPG_PUBLIC_KEY="https://bintray.com/user/downloadSubjectPublicKey?username=bintray"
DEBIAN_MASTER_REPOSITORY="https://dl.bintray.com/odo/odo-deb-dev"
DEBIAN_LATEST_REPOSITORY="https://dl.bintray.com/odo/odo-deb-releases"
RPM_MASTER_YUM_REPO="https://bintray.com/odo/odo-rpm-dev/rpm"
RPM_LATEST_YUM_REPO="https://bintray.com/odo/odo-rpm-releases/rpm"
SUPPORTED_PLATFORMS="
darwin-amd64
linux-amd64
linux-arm
"
# Used to determine whether to install or uninstall odo
INSTALLER_ACTION=""
parse_installer_action_flag ()
{
case "$@" in
# Set INSTALLER_ACTION to uninstall odo or install odo
# Include --uninstall flag when running installer.sh to uninstall and simply run installer.sh to install latest version of odo
--uninstall)
INSTALLER_ACTION="uninstall"
;;
*)
INSTALLER_ACTION="install"
;;
esac
}
echo_stderr ()
{
echo "$@" >&2
}
command_exists() {
distribution=$(get_distribution)
case "$distribution" in
ubuntu|debian)
# Use which to verify install/uninstall on ubuntu and debian distributions
which "$@" > /dev/null 2>&1
;;
*)
command -v "$@" > /dev/null 2>&1
;;
esac
}
check_platform() {
kernel="$(uname -s)"
if [ "$(uname -m)" = "x86_64" ]; then
arch="amd64"
fi
platform_type=$(echo "${kernel}-${arch}" | tr '[:upper:]' '[:lower:]')
if ! echo "# $SUPPORTED_PLATFORMS" | grep "$platform_type" > /dev/null; then
echo_stderr "
# The installer has detected your platform to be $platform_type, which is
# currently not supported by this installer script.
# Please visit the following URL for detailed installation steps:
# https://github.com/openshift/odo/#installation"
exit 1
fi
echo "$platform_type"
}
get_distribution() {
lsb_dist=""
if [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")"
fi
echo "$lsb_dist"
}
set_privileged_execution() {
if [ "$(id -u)" != "0" ]; then
if command_exists sudo; then
echo "# Installer will run privileged commands with sudo"
PRIVILEGED_EXECUTION='sudo -E sh -c'
elif command_exists su ; then
echo "# Installer will run privileged commands with \"su -c\""
PRIVILEGED_EXECUTION='su -c'
else
echo_stderr "#
This installer needs to run as root. The current user is not root, and we could not find "sudo" or "su" installed on the system. Please run again with root privileges, or install "sudo" or "su" packages.
"
fi
else
echo "# Installer is being run as root"
fi
}
invalid_odo_version_error() {
echo_stderr "# Invalid value of odo version provided. Provide master or latest."
exit 1
}
installer_odo() {
echo "# Detecting distribution..."
platform="$(check_platform)"
echo "# Detected platform: $platform"
if [ "$INSTALLER_ACTION" == "install" ] && command_exists odo; then
echo_stderr echo_stderr "#
odo version \"$(odo version --client)\" is already installed on your system. Running this installer script might cause issues with your current installation. If you want to install odo using this script, please remove the current installation of odo from you system.
Aborting now!
"
exit 1
elif [ "$INSTALLER_ACTION" == "uninstall" ] && ! command_exists odo; then
echo_stderr "# odo is not installed on your system. Ending execution of uninstall script."
exit 1
fi
# macOS specific steps
if [ $platform = "darwin-amd64" ]; then
if ! command_exists brew; then
echo_stderr "# brew command does not exist. Please install brew and run the installer again."
fi
if [ "$INSTALLER_ACTION" == "install" ]; then
brew tap kadel/odo
echo "# Installing odo ${ODO_VERSION} on macOS"
case $ODO_VERSION in
master)
brew install kadel/odo/odo -- HEAD
;;
latest)
brew install kadel/odo/odo
esac
elif [ "$INSTALLER_ACTION" == "uninstall" ]; then
echo "# Uninstalling odo on macOS"
brew uninstall odo
fi
return 0
fi
set_privileged_execution
distribution=$(get_distribution)
echo "# Detected distribution: $distribution"
case "$distribution" in
ubuntu|debian)
if [ "$INSTALLER_ACTION" == "install" ]; then
echo "# Installing odo version: $ODO_VERSION on $distribution"
echo "# Installing pre-requisites..."
$PRIVILEGED_EXECUTION "apt-get update"
$PRIVILEGED_EXECUTION "apt-get install -y gnupg apt-transport-https curl"
echo "# "Adding GPG public key...
$PRIVILEGED_EXECUTION "curl -L \"$DEBIAN_GPG_PUBLIC_KEY\" | apt-key add -"
echo "# Adding repository to /etc/apt/sources.list"
case "$ODO_VERSION" in
master)
$PRIVILEGED_EXECUTION "echo \"deb $DEBIAN_MASTER_REPOSITORY stretch main\" | tee -a /etc/apt/sources.list"
;;
latest)
$PRIVILEGED_EXECUTION "echo \"deb $DEBIAN_LATEST_REPOSITORY stretch main\" | tee -a /etc/apt/sources.list"
;;
*)
invalid_odo_version_error
esac
$PRIVILEGED_EXECUTION "apt-get update"
$PRIVILEGED_EXECUTION "apt-get install -y odo"
elif [ "$INSTALLER_ACTION" == "uninstall" ]; then
echo "# Uninstalling odo..."
$PRIVILEGED_EXECUTION "apt-get remove -y odo"
fi
;;
centos|fedora)
package_manager=""
case "$distribution" in
fedora)
package_manager="dnf"
;;
centos)
package_manager="yum"
;;
esac
if [ "$INSTALLER_ACTION" == "install" ]; then
echo "# Installing odo version $ODO_VERSION on $distribution"
echo "# Adding odo repo under /etc/yum.repos.d/"
case "$ODO_VERSION" in
master)
$PRIVILEGED_EXECUTION "curl -L $RPM_MASTER_YUM_REPO -o /etc/yum.repos.d/bintray-odo-odo-rpm-dev.repo"
;;
latest)
$PRIVILEGED_EXECUTION "curl -L $RPM_LATEST_YUM_REPO -o /etc/yum.repos.d/bintray-odo-odo-rpm-releases.repo"
;;
*)
invalid_odo_version_error
esac
$PRIVILEGED_EXECUTION "$package_manager install -y odo"
elif [ "$INSTALLER_ACTION" == "uninstall" ]; then
echo "# Uninstalling odo..."
$PRIVILEGED_EXECUTION "$package_manager remove -y odo"
fi
;;
*)
if [ "$INSTALLER_ACTION" == "install" ]; then
echo "# Could not identify distribution. Proceeding with a binary install..."
BINARY_URL=""
TMP_DIR=$(mktemp -d)
case "$ODO_VERSION" in
master)
BINARY_URL="$BINTRAY_URL/$platform/odo"
echo "# Downloading odo from $BINARY_URL"
curl -Lo $TMP_DIR/odo "$BINARY_URL"
;;
latest)
BINARY_URL="$GITHUB_RELEASES_URL/odo-$platform.tar.gz"
echo "# Downloading odo from $BINARY_URL"
curl -Lo $TMP_DIR/odo.tar.gz "$BINARY_URL"
echo "# Extracting odo.tar.gz"
tar -xvzf $TMP_DIR/odo.tar.gz
;;
*)
invalid_odo_version_error
esac
echo "# Setting execute permissions on odo"
chmod +x $TMP_DIR/odo
echo "# Moving odo binary to $INSTALLATION_PATH"
$PRIVILEGED_EXECUTION "mv $TMP_DIR/odo $INSTALLATION_PATH"
echo "# odo has been successfully installed on your machine"
rm -r $TMP_DIR
elif [ "$INSTALLER_ACTION" == "uninstall" ]; then
echo "# Proceeding with removing binary..."
rm -r $INSTALLATION_PATH/odo
fi
;;
esac
}
verify_odo() {
if [ $INSTALLER_ACTION == "install" ] && command_exists odo; then
echo "
# Verification complete!
# odo version \"$(odo version --client)\" has been installed at $(type -P odo)
"
elif [ "$INSTALLER_ACTION" == "uninstall" ] && ! command_exists odo; then
echo "
# Verification complete!
# odo has been uninstalled"
else
echo_stderr "
# Something is wrong with odo installer. Please run the installer script again. If the issue persists, please create an issue at https://github.com/openshift/odo/issues"
exit 1
fi
}
parse_installer_action_flag "$@"
installer_odo
verify_odo

View File

@@ -1,51 +0,0 @@
#!/bin/bash
# this script test installer.sh in different distributions using docker.
# docker images where install/uninstall script will be tested in
DOCKER_IMAGES="ubuntu:latest debian:latest fedora:latest base/archlinux:latest"
# save tests that failed to this variable
FAILED_INSTALL=""
FAILED_UNINSTALL=""
for image in $DOCKER_IMAGES; do
echo "******************************************************"
echo "*** Testing installer.sh in $image"
echo "******************************************************"
docker run -it -v `pwd`:/opt/odo $image /opt/odo/scripts/installer.sh
if [ $? -eq 0 ]; then
echo "******************************************************"
echo "**** Install PASSED for $image"
echo "******************************************************"
else
echo "******************************************************"
echo "**** Install FAILED for $image"
echo "******************************************************"
FAILED_INSTALL="$FAILED_INSTALL $image"
fi
docker run -it --rm -v `pwd`:/opt/odo $image /bin/bash -c "/opt/odo/scripts/installer.sh; /opt/odo/scripts/installer.sh --uninstall"
if [ $? -eq 0 ]; then
echo "******************************************************"
echo "**** Uninstall PASSED for $image"
echo "******************************************************"
else
echo "******************************************************"
echo "**** Uninstall FAILED for $image"
echo "******************************************************"
FAILED_UNINSTALL="$FAILED_UNINSTALL $image"
fi
echo ""
done
if [ -n "$FAILED_INSTALL" ] || [ -n "$FAILED_UNINSTALL" ]; then
echo "TEST FAILED!!"
echo "Installation script failed in following images:"
echo "Install test failures: $FAILED_INSTALL"
echo "Uninstall test failures: $FAILED_UNINSTALL"
exit 1
else
echo "ALL TESTS SUCCEEDED"
fi