mirror of https://git.tuxpa.in/a/code-server.git
install.sh: use $ID_LIKE to detect distro (#2423)
This commit is contained in:
parent
32c5ed8a33
commit
f8dc3fccac
33
install.sh
33
install.sh
|
@ -238,10 +238,10 @@ main() {
|
||||||
macos)
|
macos)
|
||||||
install_macos
|
install_macos
|
||||||
;;
|
;;
|
||||||
ubuntu | debian | raspbian)
|
debian)
|
||||||
install_deb
|
install_deb
|
||||||
;;
|
;;
|
||||||
centos | fedora | rhel | opensuse)
|
fedora | opensuse)
|
||||||
install_rpm
|
install_rpm
|
||||||
;;
|
;;
|
||||||
arch)
|
arch)
|
||||||
|
@ -425,14 +425,16 @@ os() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# distro prints the detected operating system including linux distros.
|
# distro prints the detected operating system including linux distros.
|
||||||
|
# Also parses ID_LIKE for common distro bases.
|
||||||
#
|
#
|
||||||
# Example outputs:
|
# Example outputs:
|
||||||
# - macos
|
# - macos -> macos
|
||||||
# - debian, ubuntu, raspbian
|
# - freebsd -> freebsd
|
||||||
# - centos, fedora, rhel, opensuse
|
# - ubuntu, raspbian, debian ... -> debian
|
||||||
# - alpine
|
# - amzn, centos, rhel, fedora, ... -> fedora
|
||||||
# - arch
|
# - opensuse-{leap,tumbleweed} -> opensuse
|
||||||
# - freebsd
|
# - alpine -> alpine
|
||||||
|
# - arch -> arch
|
||||||
#
|
#
|
||||||
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
|
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
|
||||||
distro() {
|
distro() {
|
||||||
|
@ -444,12 +446,15 @@ distro() {
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
(
|
(
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
case "$ID" in opensuse-*)
|
if [ "${ID_LIKE-}" ]; then
|
||||||
# opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
|
for id_like in $ID_LIKE; do
|
||||||
echo "opensuse"
|
case "$id_like" in debian | fedora | opensuse)
|
||||||
return
|
echo "$id_like"
|
||||||
;;
|
return
|
||||||
esac
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$ID"
|
echo "$ID"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue