[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

teach os-prober to recognize OpenBSD



Hi!

My multiboot laptop runs Gentoo and the sys-boot/os-prober package is a
recommended way to make Grub behave with other operating systems installed.
The page https://joeyh.name/code/os-prober/ suggests patches should go
to the Debian installer team, whose web page suggests this is the right
mailing list (http://www.debian.org/devel/debian-installer/).

To access BSD ufs, you need to mount it with -o ufstype=44bsd.  This
script should therefore have the highest number (mounted/91openbsd, for
example), so that the re-mount doesn't break any other scripts.

Can something along those lines be included in os-prober?  Thanks.
--
Martin Pelikan


#!/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; }'`
umount $where
mount -t ufs -o ro,ufstype=44bsd $partition $where

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


Reply to: