releasing version 1.63
[d-i/os-prober.git] / os-probes / mounted / common / 90linux-distro
1 #!/bin/sh
2 # Test for linux distributions.
3 set -e
4
5 . /usr/share/os-prober/common.sh
6
7 partition="$1"
8 dir="$2"
9 type="$3"
10
11 # This test is inaccurate, but given separate / and /boot partitions and the
12 # fact that only some architectures have ld-linux.so, I can't see anything
13 # better. Make sure this test has a high number so that more accurate tests
14 # can come first.
15 # TODO: look for ld-linux.so on arches that have it
16 if ls "$dir"/lib*/ld*.so* >/dev/null 2>/dev/null; then
17         if [ -e "$dir/etc/debian_version" ]; then
18                 short="Debian"
19                 long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")"
20         # RPM derived distributions may also have a redhat-release or
21         # mandrake-release, so check their files first.
22         elif [ -e "$dir/etc/altlinux-release" ]; then
23                 short="ALTLinux"
24                 long="$(cat "$dir/etc/altlinux-release")"
25         elif [ -e "$dir/etc/magic-release" ]; then
26                 short="Magic"
27                 long="$(cat "$dir/etc/magic-release")"
28         elif [ -e "$dir/etc/blackPanther-release" ]; then
29                 short="blackPanther"
30                 long="$(cat "$dir/etc/blackPanther-release")"
31         elif [ -e "$dir/etc/ark-release" ]; then
32                 short="Ark"
33                 long="$(cat "$dir/etc/ark-release")"
34         elif [ -e "$dir/etc/arch-release" ]; then
35                 short="Arch"
36                 long="$(cat "$dir/etc/arch-release")"
37         elif [ -e "$dir/etc/asplinux-release" ]; then
38                 short="ASPLinux"
39                 long="$(cat "$dir/etc/asplinux-release")"
40         elif [ -e "$dir/etc/lvr-release" ]; then
41                 short="LvR"
42                 long="$(cat "$dir/etc/lvr-release")"
43         elif [ -e "$dir/etc/caos-release" ]; then
44                 short="cAos"
45                 long="$(cat "$dir/etc/caos-release")"
46         elif [ -e "$dir/etc/aurox-release" ]; then
47                 short="Aurox"
48                 long="$(cat "$dir/etc/aurox-release")"
49         elif [ -e "$dir/etc/engarde-release" ]; then
50                 short="EnGarde"
51                 long="$(cat "$dir/etc/engarde-release")"
52         elif [ -e "$dir/etc/vine-release" ]; then
53                 short="Vine"
54                 long="$(cat "$dir/etc/vine-release")"
55         elif [ -e "$dir/etc/whitebox-release" ]; then
56                 short="WhiteBox"
57                 long="$(cat "$dir/etc/whitebox-release")"
58         elif [ -e "$dir/etc/pld-release" ]; then
59                 short="PLD"
60                 long="$(cat "$dir/etc/pld-release")"
61         elif [ -e "$dir/etc/startcom-release" ]; then
62                 short="StartCom"
63                 long="$(cat "$dir/etc/startcom-release")"
64         elif [ -e "$dir/etc/trustix-release" ]; then
65                 short="Trustix"
66                 long="$(cat "$dir/etc/trustix-release")"
67         elif [ -e "$dir/etc/openna-release" ]; then
68                 short="OpenNA"
69                 long="$(cat "$dir/etc/openna-release")"
70         elif [ -e "$dir/etc/conectiva-release" ]; then
71                 short="Conectiva"
72                 long="$(cat "$dir/etc/conectiva-release")"
73         elif [ -e "$dir/etc/mandrake-release" ]; then
74                 short="Mandrake"
75                 long="$(cat "$dir/etc/mandrake-release")"
76         elif [ -e "$dir/etc/fedora-release" ]; then
77                 short="Fedora"
78                 long="$(cat "$dir/etc/fedora-release")"
79         elif [ -e "$dir/etc/redhat-release" ]; then
80                 short="RedHat"
81                 long="$(cat "$dir/etc/redhat-release")"
82         elif [ -e "$dir/etc/SuSE-release" ]; then
83                 short="SuSE"
84                 long="$(head -n 1 "$dir/etc/SuSE-release")"
85         elif [ -e "$dir/etc/gentoo-release" ]; then
86                 short="Gentoo"
87                 long="$(cat "$dir/etc/gentoo-release")"
88         elif [ -e "$dir/etc/cobalt-release" ]; then
89                 short="Cobalt"
90                 long="$(cat "$dir/etc/cobalt-release")"
91         elif [ -e "$dir/etc/yellowdog-release" ]; then
92                 short="YellowDog"
93                 long="$(cat "$dir/etc/yellowdog-release")"
94         elif [ -e "$dir/etc/turbolinux-release" ]; then
95                 short="Turbolinux"
96                 long="$(cat "$dir/etc/turbolinux-release")"
97         elif [ -e "$dir/etc/pardus-release" ]; then
98                 short="Pardus"
99                 long="$(cat "$dir/etc/pardus-release")"
100         elif [ -e "$dir/etc/kanotix-version" ]; then
101                 short="Kanotix"
102                 long="$(cat "$dir/etc/kanotix-version")"
103         elif [ -e "$dir/etc/slackware-version" ]; then
104                 short="Slackware"
105                 long="$(printf "Slackware Linux (%s)\n" "$(cat "$dir/etc/slackware-version")")"
106         elif [ -e "$dir/sbin/pkgtool" ]; then
107                 short="Slackware"
108                 long="Slackware Linux"
109         elif grep -qs OpenLinux "$dir/etc/issue"; then
110                 short="Caldera"
111                 long="Caldera OpenLinux"
112         elif [ -e "$dir/etc/frugalware-release" ]; then
113                 short="Frugalware Linux"
114                 long="$(cat "$dir/etc/frugalware-release")"
115         elif [ -e "$dir/etc/kdemar-release" ]; then
116                 short="K-DEMar"
117                 long="$(printf "K-DEMar GNU/Linux (%s)\n" "$(cat "$dir/etc/kdemar-release")")"
118         elif [ -e "$dir/etc/lfs-release" ]; then
119                 short="LFS"
120                 long="$(printf "Linux From Scratch (%s)\n" "$(cat "$dir/etc/lfs-release")")"
121         elif [ -e "$dir/etc/meego-release" ]; then
122                 short="MeeGo"
123                 long="$(head -1 "$dir/etc/meego-release")"
124         else
125                 short="Linux"
126                 long="unknown Linux distribution"
127         fi
128         
129         label="$(count_next_label "$short")"
130         result "$partition:$long:$label:linux"
131         exit 0
132 else
133         exit 1
134 fi