Sophie

Sophie

distrib > Mageia > cauldron > i586 > by-pkgid > 4059bfc13bd9ebd7ee31e446c4da4903 > files > 2

os-prober-1.81-2.mga9.src.rpm

#!/bin/sh
# Attempt to check if OpenBSD is installed in this system by
# looking for the copyright string in the kernel image, /bsd.

set -e

. /usr/share/os-prober/common.sh

partition="$1"
dir="$2"
type="$3"

[ "$type" == "ufs" ] || exit 1;

# We need to re-mount the FS with ufstype=44bsd.
where=`mount | awk '($1 == "'$partition'") { print $3; }'`

#echo "** #$partition#$dir#$type#$where#" >&2
if [[ -n "$where" ]]; then
  umount $where
else
  where="$dir"
fi

mount -t ufs -o ro,ufstype=44bsd $partition $where 2>/dev/null || exit 1;

OPENBSD_COPYRIGHT='^Copyright (c) 1995-[12][0-9][0-9][0-9] OpenBSD.[ \t]*All rights reserved.[ \t]*http://www.OpenBSD.org$'
if [ -f "$where/bsd" ] && grep -qU "${OPENBSD_COPYRIGHT}" $where/bsd; then
  label="$(count_next_label OpenBSD)"
  result "$partition:OpenBSD:$label:chain"
  exit 0
else
  exit 1
fi