From 3c27badd31ae6c5f40fddd5901ef560145fdcaad Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 25 Jan 2022 10:13:42 -0700 Subject: [PATCH] fix: bail early when installing channels on non-ubuntu (#11617) Fixes #11615 --- .../bin/reinstall_chrome_beta_linux.sh | 11 +++++++++++ .../bin/reinstall_chrome_stable_linux.sh | 11 +++++++++++ .../bin/reinstall_msedge_beta_linux.sh | 11 +++++++++++ .../playwright-core/bin/reinstall_msedge_dev_linux.sh | 11 +++++++++++ .../bin/reinstall_msedge_stable_linux.sh | 11 +++++++++++ 5 files changed, 55 insertions(+) diff --git a/packages/playwright-core/bin/reinstall_chrome_beta_linux.sh b/packages/playwright-core/bin/reinstall_chrome_beta_linux.sh index 63e9253dc0..2be2d65026 100755 --- a/packages/playwright-core/bin/reinstall_chrome_beta_linux.sh +++ b/packages/playwright-core/bin/reinstall_chrome_beta_linux.sh @@ -7,6 +7,17 @@ if [[ $(arch) == "aarch64" ]]; then exit 1 fi +if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 +fi + +ID=$(bash -c 'source /etc/os-release && echo $ID') +if [[ "${ID}" != "ubuntu" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu is supported" + exit 1 +fi + # 1. make sure to remove old beta if any. if dpkg --get-selections | grep -q "^google-chrome-beta[[:space:]]*install$" >/dev/null; then apt-get remove -y google-chrome-beta diff --git a/packages/playwright-core/bin/reinstall_chrome_stable_linux.sh b/packages/playwright-core/bin/reinstall_chrome_stable_linux.sh index 57269bd5fe..bcb2275f37 100755 --- a/packages/playwright-core/bin/reinstall_chrome_stable_linux.sh +++ b/packages/playwright-core/bin/reinstall_chrome_stable_linux.sh @@ -7,6 +7,17 @@ if [[ $(arch) == "aarch64" ]]; then exit 1 fi +if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 +fi + +ID=$(bash -c 'source /etc/os-release && echo $ID') +if [[ "${ID}" != "ubuntu" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu is supported" + exit 1 +fi + # 1. make sure to remove old stable if any. if dpkg --get-selections | grep -q "^google-chrome[[:space:]]*install$" >/dev/null; then apt-get remove -y google-chrome diff --git a/packages/playwright-core/bin/reinstall_msedge_beta_linux.sh b/packages/playwright-core/bin/reinstall_msedge_beta_linux.sh index ff19e52173..637b9cd7ad 100755 --- a/packages/playwright-core/bin/reinstall_msedge_beta_linux.sh +++ b/packages/playwright-core/bin/reinstall_msedge_beta_linux.sh @@ -8,6 +8,17 @@ if [[ $(arch) == "aarch64" ]]; then exit 1 fi +if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 +fi + +ID=$(bash -c 'source /etc/os-release && echo $ID') +if [[ "${ID}" != "ubuntu" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu is supported" + exit 1 +fi + # 1. make sure to remove old beta if any. if dpkg --get-selections | grep -q "^microsoft-edge-beta[[:space:]]*install$" >/dev/null; then apt-get remove -y microsoft-edge-beta diff --git a/packages/playwright-core/bin/reinstall_msedge_dev_linux.sh b/packages/playwright-core/bin/reinstall_msedge_dev_linux.sh index 9c3447fe69..55962fe6b6 100755 --- a/packages/playwright-core/bin/reinstall_msedge_dev_linux.sh +++ b/packages/playwright-core/bin/reinstall_msedge_dev_linux.sh @@ -8,6 +8,17 @@ if [[ $(arch) == "aarch64" ]]; then exit 1 fi +if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 +fi + +ID=$(bash -c 'source /etc/os-release && echo $ID') +if [[ "${ID}" != "ubuntu" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu is supported" + exit 1 +fi + # 1. make sure to remove old dev if any. if dpkg --get-selections | grep -q "^microsoft-edge-dev[[:space:]]*install$" >/dev/null; then apt-get remove -y microsoft-edge-dev diff --git a/packages/playwright-core/bin/reinstall_msedge_stable_linux.sh b/packages/playwright-core/bin/reinstall_msedge_stable_linux.sh index 19dc354b26..5bde389b60 100755 --- a/packages/playwright-core/bin/reinstall_msedge_stable_linux.sh +++ b/packages/playwright-core/bin/reinstall_msedge_stable_linux.sh @@ -8,6 +8,17 @@ if [[ $(arch) == "aarch64" ]]; then exit 1 fi +if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 +fi + +ID=$(bash -c 'source /etc/os-release && echo $ID') +if [[ "${ID}" != "ubuntu" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu is supported" + exit 1 +fi + # 1. make sure to remove old stable if any. if dpkg --get-selections | grep -q "^microsoft-edge-stable[[:space:]]*install$" >/dev/null; then apt-get remove -y microsoft-edge-stable