Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix: bail early when installing channels on non-ubuntu (#11617)

Andrey Lushnikov3c27badd31ae
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