FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 02-07-2012, 06:09 AM
Андрей Гаврилин
 
Default os-prober changes

Hello.

I have changed Linux detection and I have added *BSD detection. We
will use It for Mandriva/ROSA.

diff --git a/os-probes/common/50mounted-tests b/os-probes/common/50mounted-tests
index 7865b51..e61cb13 100755
--- a/os-probes/common/50mounted-tests
+++ b/os-probes/common/50mounted-tests
@@ -54,9 +54,21 @@ if which grub-mount >/dev/null 2>&1 &&
else
ro_partition "$partition"
for type in $types $delaytypes; do
- if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
+ if [ "$type" = ufs ]; then
+ for ufstype in ufs2 44bsd; do
+ if mount -o ro,ufstype=$ufstype -t "$type" "$partition" "$tmpmnt"
2>/dev/null; then
+ mounted=1
+ break
+ fi
+ done
+ else
+ if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
+ mounted=1
+ fi
+ fi
+
+ if [ "$mounted" ]; then
debug "mounted as $type filesystem"
- mounted=1
break
fi
done
diff --git a/os-probes/mounted/common/90bsd-distro
b/os-probes/mounted/common/90bsd-distro
new file mode 100755
index 0000000..b190aab
--- /dev/null
+++ b/os-probes/mounted/common/90bsd-distro
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Test for *BSD distributions.
+set -e
+
+. /usr/share/os-prober/common.sh
+
+partition="$1"
+dir="$2"
+type="$3"
+
+if [ "$type" = ufs ]; then
+ disk=$(echo $partition | gawk '{ match($0,
/([[:alpha:][unct:]]+)[[:digit:]]+/, disk); print disk[1] }')
+
+ if [ ! -z "$disk" ]; then
+ tpartition=$(echo $partition | sed 's|/|/|g')
+
+ system=$(fdisk -l $disk | awk
'/'$tpartition'[[:blank:]]+*[[:blank:]]+.+[[:blank:]]+.+BSD/ {print
$7}')
+
+ if [ ! -z "$system" ]; then
+ title=
+
+ if [ -f $dir/etc/motd ]; then
+ case $system in
+ FreeBSD | NetBSD | OpenBSD) title=$(cat $dir/etc/motd | gawk
'{ match($0, /('$system')[[:blank:]]+([[:graph:]]+)[[:blank:]]+(([[rint:]]+))/,
title); print title[1], title[2], title[3]; exit 0}')
+ ;;
+ esac
+ fi
+
+ if [ -z "$title" ]; then
+ title="$system"
+ fi
+
+ label="$(count_next_label "$system")"
+ echo "$partition:$title:$label:chain"
+
+ exit 0
+ else
+ exit 1
+ fi
+ else
+ exit 1
+ fi
+else
+ exit 1
+fi
diff --git a/os-probes/mounted/common/90linux-distro
b/os-probes/mounted/common/90linux-distro
index f237a38..147c6a1 100755
--- a/os-probes/mounted/common/90linux-distro
+++ b/os-probes/mounted/common/90linux-distro
@@ -13,122 +13,166 @@ type="$3"
# better. Make sure this test has a high number so that more accurate tests
# can come first.
# TODO: look for ld-linux.so on arches that have it
-if ls "$dir"/lib*/ld*.so* >/dev/null 2>/dev/null; then
- if [ -e "$dir/etc/debian_version" ]; then
- short="Debian"
- long="$(printf "Debian GNU/Linux (%s)
" "$(cat "$dir/etc/debian_version")")"
- # RPM derived distributions may also have a redhat-release or
- # mandrake-release, so check their files first.
- elif [ -e "$dir/etc/altlinux-release" ]; then
- short="ALTLinux"
- long="$(cat "$dir/etc/altlinux-release")"
- elif [ -e "$dir/etc/magic-release" ]; then
- short="Magic"
- long="$(cat "$dir/etc/magic-release")"
- elif [ -e "$dir/etc/blackPanther-release" ]; then
- short="blackPanther"
- long="$(cat "$dir/etc/blackPanther-release")"
- elif [ -e "$dir/etc/ark-release" ]; then
- short="Ark"
- long="$(cat "$dir/etc/ark-release")"
- elif [ -e "$dir/etc/arch-release" ]; then
- short="Arch"
- long="$(cat "$dir/etc/arch-release")"
- elif [ -e "$dir/etc/asplinux-release" ]; then
- short="ASPLinux"
- long="$(cat "$dir/etc/asplinux-release")"
- elif [ -e "$dir/etc/lvr-release" ]; then
- short="LvR"
- long="$(cat "$dir/etc/lvr-release")"
- elif [ -e "$dir/etc/caos-release" ]; then
- short="cAos"
- long="$(cat "$dir/etc/caos-release")"
- elif [ -e "$dir/etc/aurox-release" ]; then
- short="Aurox"
- long="$(cat "$dir/etc/aurox-release")"
- elif [ -e "$dir/etc/engarde-release" ]; then
- short="EnGarde"
- long="$(cat "$dir/etc/engarde-release")"
- elif [ -e "$dir/etc/vine-release" ]; then
- short="Vine"
- long="$(cat "$dir/etc/vine-release")"
- elif [ -e "$dir/etc/whitebox-release" ]; then
- short="WhiteBox"
- long="$(cat "$dir/etc/whitebox-release")"
- elif [ -e "$dir/etc/pld-release" ]; then
- short="PLD"
- long="$(cat "$dir/etc/pld-release")"
- elif [ -e "$dir/etc/startcom-release" ]; then
- short="StartCom"
- long="$(cat "$dir/etc/startcom-release")"
- elif [ -e "$dir/etc/trustix-release" ]; then
- short="Trustix"
- long="$(cat "$dir/etc/trustix-release")"
- elif [ -e "$dir/etc/openna-release" ]; then
- short="OpenNA"
- long="$(cat "$dir/etc/openna-release")"
- elif [ -e "$dir/etc/conectiva-release" ]; then
- short="Conectiva"
- long="$(cat "$dir/etc/conectiva-release")"
- elif [ -e "$dir/etc/mandrake-release" ]; then
- short="Mandrake"
- long="$(cat "$dir/etc/mandrake-release")"
- elif [ -e "$dir/etc/fedora-release" ]; then
- short="Fedora"
- long="$(cat "$dir/etc/fedora-release")"
- elif [ -e "$dir/etc/redhat-release" ]; then
- short="RedHat"
- long="$(cat "$dir/etc/redhat-release")"
- elif [ -e "$dir/etc/SuSE-release" ]; then
- short="SuSE"
- long="$(head -n 1 "$dir/etc/SuSE-release")"
- elif [ -e "$dir/etc/gentoo-release" ]; then
- short="Gentoo"
- long="$(cat "$dir/etc/gentoo-release")"
- elif [ -e "$dir/etc/cobalt-release" ]; then
- short="Cobalt"
- long="$(cat "$dir/etc/cobalt-release")"
- elif [ -e "$dir/etc/yellowdog-release" ]; then
- short="YellowDog"
- long="$(cat "$dir/etc/yellowdog-release")"
- elif [ -e "$dir/etc/turbolinux-release" ]; then
- short="Turbolinux"
- long="$(cat "$dir/etc/turbolinux-release")"
- elif [ -e "$dir/etc/pardus-release" ]; then
- short="Pardus"
- long="$(cat "$dir/etc/pardus-release")"
- elif [ -e "$dir/etc/kanotix-version" ]; then
- short="Kanotix"
- long="$(cat "$dir/etc/kanotix-version")"
- elif [ -e "$dir/etc/slackware-version" ]; then
- short="Slackware"
- long="$(printf "Slackware Linux (%s)
" "$(cat
"$dir/etc/slackware-version")")"
- elif [ -e "$dir/sbin/pkgtool" ]; then
- short="Slackware"
- long="Slackware Linux"
- elif grep -qs OpenLinux "$dir/etc/issue"; then
- short="Caldera"
- long="Caldera OpenLinux"
- elif [ -e "$dir/etc/frugalware-release" ]; then
- short="Frugalware Linux"
- long="$(cat "$dir/etc/frugalware-release")"
- elif [ -e "$dir/etc/kdemar-release" ]; then
- short="K-DEMar"
- long="$(printf "K-DEMar GNU/Linux (%s)
" "$(cat
"$dir/etc/kdemar-release")")"
- elif [ -e "$dir/etc/lfs-release" ]; then
- short="LFS"
- long="$(printf "Linux From Scratch (%s)
" "$(cat "$dir/etc/lfs-release")")"
- elif [ -e "$dir/etc/meego-release" ]; then
- short="MeeGo"
- long="$(head -1 "$dir/etc/meego-release")"
- else
- short="Linux"
- long="unknown Linux distribution"
- fi
-
- label="$(count_next_label "$short")"
- result "$partition:$long:$label:linux"
- exit 0
+
+# hierarchy
+
+# based or forked
+
+# chakra-release # arch
+# arch-release
+
+# kanotix_version # debian
+# kdemar-release # debian, knoppix
+# knoppix_version # debian
+# debian_version
+
+# blackPanther-release # mandriva
+# pclinuxos-release # mandrake, mandriva
+# mandriva-release # mandrake, mandrakelinux, redhat
+# mandrakelinux-release
+# mandrake-release
+
+# altlinux-release # redhat
+# yellowdog-release # centos, fedora
+# centos-release # redhat, fedora
+# asplinux-release # fedora
+# engarde-release # fedora
+# e-smith-release # fedora
+# magic-release # fedora
+# trustix-release # fedora
+# fedora-release # redhat
+# startcom-release # redhat
+# redhat-release
+
+# meego-release # moblin
+# moblin-release
+
+# slax-version # slackware
+# zenwalk-version # slackware
+# slackware-version
+
+# sles-release # suse
+# SuSE-release
+
+# independent
+
+# ark-release
+# caos-release
+# frugalware-release
+# gentoo-release
+# lfs-release
+# pardus-release
+# pld-release
+# turbolinux-release
+# vine-release
+# whitebox-release
+
+# reserved
+# system-release
+
+based_or_forked1='SuSE-release sles-release slackware-version
zenwalk-version slax-version moblin-release meego-release'
+based_or_forked2='redhat-release startcom-release fedora-release
trustix-release magic-release e-smith-release engarde-release
asplinux-release centos-release yellowdog-release altlinux-release'
+based_or_forked3='mandrake-release mandrakelinux-release
mandriva-release pclinuxos-release blackPanther-release'
+based_or_forked4='debian_version knoppix_version kdemar-release
kanotix_version arch-release chakra-release'
+
+independant='whitebox-release vine-release turbolinux-release
pld-release pardus-release lfs-release gentoo-release
frugalware-release caos-release ark-release'
+
+reserved='system-release'
+
+known_distro="$reserved $independant $based_or_forked1
$based_or_forked2 $based_or_forked3 $based_or_forked4"
+
+find_distro_info() {
+ found_distro=
+
+ pattern='_version -version -release'
+
+ for pat in $pattern; do
+
+ for distro in $( ls -tr $dir/etc/*$pat 2>/dev/null ); do
+ if [ -L $distro ]; then
+ continue
+ fi
+
+ distro=$(basename $distro)
+
+ if [ "$distro" = 'lsb-release' ]; then
+ continue
+ fi
+
+ found_distro="$found_distro$distro "
+ done
+
+ done
+}
+
+prepare_label() {
+ label=$(echo $1 | gawk '{ match($0,
/(.+)(_version|-version|-release)/, dist); print dist[1] }')
+}
+
+prepare_title() {
+ title="$(head -1 $dir/etc/$1)"
+
+ title=$(echo $title | gawk '{ match($0,
/^[[:space:]]*(.*)[[:space:]]*$/, title); print title[1] }')
+
+ if [ ! -z $(echo $title | awk '/^([[:graph:]]+)$/ { print $0 }') ]
|| [ -z "$title" ]; then
+ tlabel=$(echo $label | gawk '{ match($0, /(.)(.*)/, title); print
toupper(title[1]) tolower(title[2]) }')
+
+ if [ ! -z "$title" ]; then
+ title=" ($title)"
+ fi
+
+ title="${tlabel} GNU/Linux$title"
+ fi
+}
+
+prepare_distro_info() {
+ if [ ! -z "$found_distro" ]; then
+ mdistro=
+
+ for kdistro in $known_distro; do
+ for fdistro in $found_distro; do
+ if [ "$kdistro" = "$fdistro" ]; then
+ mdistro=$kdistro
+ found_distro=$(echo $found_distro | sed "s|$fdistro||")
+ break
+ fi
+ done
+
+ if [ -z "$found_distro" ]; then
+ break
+ fi
+ done
+
+ if [ -z "$found_distro" ]; then
+ distro=$mdistro
+ else
+ distro=$(echo $found_distro | awk '{ print $NF }')
+ fi
+
+ rdistro=$distro
+
+ if [ "$distro" = "debian_version" ] &&
+ [ -f '/etc/dpkg/origins/ubuntu' ]; then
+ distro='ubuntu_version'
+ fi
+
+ prepare_label $distro
+ prepare_title $rdistro $label
+ else
+ label='Linux'
+ title='unknown Linux distribution'
+ fi
+}
+
+if ls $dir/lib*/ld*.so* >/dev/null 2>/dev/null; then
+ find_distro_info
+
+ prepare_distro_info
+
+ label="$(count_next_label "$label")"
+ echo "$partition:$title:$label:linux"
+
+ exit 0
else
- exit 1
+ exit 1
fi
 
Old 02-07-2012, 07:27 AM
Paul Wise
 
Default os-prober changes

[CCing you since I'm not sure you are subscribed]

On Tue, Feb 7, 2012 at 3:09 PM, Андрей Гаврилин wrote:

> I have changed Linux detection and I have added *BSD detection. We
> will use It for Mandriva/ROSA.

Please report a bug against the os-prober package:

http://www.debian.org/Bugs/Reporting

--
bye,
pabs

http://wiki.debian.org/PaulWise


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAKTje6HRMf9KvG5nF1nfbES-E3iZvKe=JrbjErYNTi1rLbSRtw@mail.gmail.com">http://lists.debian.org/CAKTje6HRMf9KvG5nF1nfbES-E3iZvKe=JrbjErYNTi1rLbSRtw@mail.gmail.com
 

Thread Tools




All times are GMT. The time now is 06:32 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org