@@ -238,10 +238,10 @@ main() {
238
238
macos)
239
239
install_macos
240
240
;;
241
- ubuntu | debian | raspbian )
241
+ debian)
242
242
install_deb
243
243
;;
244
- centos | fedora | rhel | opensuse)
244
+ fedora | opensuse)
245
245
install_rpm
246
246
;;
247
247
arch)
@@ -425,16 +425,16 @@ os() {
425
425
}
426
426
427
427
# distro prints the detected operating system including linux distros.
428
+ # also parses ID_LIKE for common distro bases
428
429
#
429
430
# Example outputs:
430
- # - macos
431
- # - debian, ubuntu, raspbian
432
- # - centos, fedora, rhel, opensuse
433
- # - alpine
434
- # - arch
435
- # - freebsd
436
- #
437
- # Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
431
+ # - macos -> macos
432
+ # - freebsd -> freebsd
433
+ # - ubuntu, raspbian, debian ... -> debian
434
+ # - amzn, centos, rhel, fedora, ... -> fedora
435
+ # - opensuse-{leap,tumbleweed} -> opensuse
436
+ # - alpine -> alpine
437
+ # - arch -> arch
438
438
distro () {
439
439
if [ " $OS " = " macos" ] || [ " $OS " = " freebsd" ]; then
440
440
echo " $OS "
@@ -444,12 +444,14 @@ distro() {
444
444
if [ -f /etc/os-release ]; then
445
445
(
446
446
. /etc/os-release
447
- case " $ID " in opensuse-* )
448
- # opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
449
- echo " opensuse"
450
- return
451
- ;;
452
- esac
447
+ if [ " ${ID_LIKE-} " ]; then
448
+ for distro_like in $ID_LIKE ; do
449
+ case " $distro_like " in debian | fedora | opensuse)
450
+ echo " $distro_like "
451
+ return
452
+ esac
453
+ done
454
+ fi
453
455
454
456
echo " $ID "
455
457
)
0 commit comments