mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-28 05:05:25 +00:00
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)
|
||||
install_macos
|
||||
;;
|
||||
ubuntu | debian | raspbian)
|
||||
debian)
|
||||
install_deb
|
||||
;;
|
||||
centos | fedora | rhel | opensuse)
|
||||
fedora | opensuse)
|
||||
install_rpm
|
||||
;;
|
||||
arch)
|
||||
@ -425,14 +425,16 @@ os() {
|
||||
}
|
||||
|
||||
# distro prints the detected operating system including linux distros.
|
||||
# Also parses ID_LIKE for common distro bases.
|
||||
#
|
||||
# Example outputs:
|
||||
# - macos
|
||||
# - debian, ubuntu, raspbian
|
||||
# - centos, fedora, rhel, opensuse
|
||||
# - alpine
|
||||
# - arch
|
||||
# - freebsd
|
||||
# - macos -> macos
|
||||
# - freebsd -> freebsd
|
||||
# - ubuntu, raspbian, debian ... -> debian
|
||||
# - amzn, centos, rhel, fedora, ... -> fedora
|
||||
# - opensuse-{leap,tumbleweed} -> opensuse
|
||||
# - alpine -> alpine
|
||||
# - arch -> arch
|
||||
#
|
||||
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
|
||||
distro() {
|
||||
@ -444,12 +446,15 @@ distro() {
|
||||
if [ -f /etc/os-release ]; then
|
||||
(
|
||||
. /etc/os-release
|
||||
case "$ID" in opensuse-*)
|
||||
# opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
|
||||
echo "opensuse"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
if [ "${ID_LIKE-}" ]; then
|
||||
for id_like in $ID_LIKE; do
|
||||
case "$id_like" in debian | fedora | opensuse)
|
||||
echo "$id_like"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
echo "$ID"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user