File: //proc/3793153/cwd/linux-boot-probes.zip
PK �D]t7��( ( 50mounted-testsnu ȯ�� #!/bin/sh
# Sub-tests that require a mounted partition.
. /usr/share/os-prober/common.sh
set -e
do_unmount() {
if [ "$mounted" ]; then
umount "$tmpmnt/boot" 2>/dev/null || true
if ! umount "$tmpmnt"; then
warn "failed to umount $tmpmnt"
fi
fi
rmdir "$tmpmnt" || true
}
partition="$1"
types="$(fs_type "$partition")"
if [ "$types" = NOT-DETECTED ]; then
debug "$1 type not recognised; skipping"
exit 0
elif [ "$types" = swap ]; then
debug "$1 is a swap partition; skipping"
exit 0
elif [ "$types" = crypto_LUKS ]; then
debug "$1 is a LUKS partition; skipping"
exit 0
elif [ "$types" = ntfs ]; then
if type ntfs-3g >/dev/null 2>&1; then
types='ntfs-3g ntfs'
fi
elif [ -z "$types" ]; then
if is_dos_extended_partition "$partition"; then
debug "$1 looks like an extended dos partition; skipping"
exit 0
fi
if type cryptsetup >/dev/null 2>&1 && \
cryptsetup luksDump "$partition" >/dev/null 2>&1; then
debug "$1 is a LUKS partition; skipping"
exit 0
fi
types="$(grep -v nodev /proc/filesystems)"
fi
tmpmnt=/var/lib/os-prober/mount
if [ ! -d "$tmpmnt" ]; then
mkdir "$tmpmnt"
fi
mounted=
if type grub-mount >/dev/null 2>&1 && \
type grub-probe >/dev/null 2>&1 && \
grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
mounted=1
type="$(grub-probe -d "$partition" -t fs)"
[ "$type" ] || type=fuseblk
case "$type" in
btrfs)
if [ -x "$tmpmnt/@/lib" ] && \
! mount --bind "$tmpmnt/@" "$tmpmnt"; then
warn "failed to mount btrfs subvolume @ on $partition"
if ! umount $tmpmnt; then
warn "failed to umount $tmpmnt"
fi
mounted=
fi
;;
esac
fi
if [ "$mounted" ]; then
linux_mount_boot "$partition" "$tmpmnt"
bootpart="${mountboot%% *}"
mounted="${mountboot#* }"
for test in /usr/lib/linux-boot-probes/mounted/*; do
if [ -f "$test" ] && [ -x "$test" ]; then
debug "running $test $partition $bootpart $tmpmnt $type"
if $test "$partition" "$bootpart" "$tmpmnt" "$type"; then
debug "$test succeeded"
do_unmount
exit 0
fi
fi
done
fi
do_unmount
# No tests found anything.
exit 1
PK �D]�|�26 6 mounted/90fallbacknu ȯ�� #!/bin/sh
# Fallback in case nothing else works. Look for vmlinu[xz] file in root and
# /boot, see if there is a matching initrd, and wing it.
. /usr/share/os-prober/common.sh
set -e
partition="$1"
bootpart="$2"
mpoint="$3"
type="$4"
mappedpartition=$(mapdevfs "$partition" 2>/dev/null) || mappedpartition="$partition"
exitcode=1
for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \
"/boot/vmlinux*" "/vmlinuz*" "/vmlinux*" "/kernel-*" "/boot/kernel-*"; do
if echo "$kernpat" | grep -q boot/; then
kernbootpart="$bootpart"
else
kernbootpart="$partition"
fi
for kernfile in $(eval ls -vr "$mpoint$kernpat" 2>/dev/null); do
kernbasefile=$(echo "$kernfile" | sed "s!^$mpoint!!")
if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then
initrdname=$(echo "$kernfile" | sed "s/vmlinu[zx]/initrd\*/")
# Yellow Dog Linux appends .img to it.
initrdname1="${initrdname}.img"
# Arch Linux names its initrds weirdly. We take
# some care here to avoid false positives on other
# systems, since kernel.img could conceivably be a
# kernel itself.
initrdname2=$(echo "$kernfile" | sed -n 's/vmlinu[zx]\([0-9][0-9]*\)/kernel\1/p' | sed 's/$/.img/')
# Dracut initramfses are named differently again.
initrdname3=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/" | sed 's/$/.img/')
# And Gentoo's also
initrdname4=$(echo "$kernfile" | sed "s/kernel/initramfs\*/")
# Also Alpine
initrdname5=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/")
foundinitrd=0
for initrd in $(eval ls "$initrdname" "$initrdname1" "$initrdname2" "$initrdname3" "$initrdname4" "$initrdname5" 2>/dev/null); do
if [ "$initrd" != "$kernfile" ] && [ -f "$initrd" ] && [ ! -L "$initrd" ]; then
initrd=$(echo "$initrd" | sed "s!^$mpoint!!")
result "$partition:$kernbootpart::$kernbasefile:$initrd:root=$mappedpartition"
exitcode=0
foundinitrd=1
fi
done
if [ "$foundinitrd" = 0 ]; then
result "$partition:$kernbootpart::$kernbasefile::root=$mappedpartition"
exitcode=0
fi
fi
done
done
exit "$exitcode"
PK �D]��U��
�
mounted/40grub2nu ȯ�� #!/bin/sh
. /usr/share/os-prober/common.sh
set -e
partition="$1"
bootpart="$2"
mpoint="$3"
type="$4"
found_item=0
entry_result () {
if [ "$ignore_item" = 0 ] && \
[ -n "$kernel" ] && \
[ -e "$mpoint/$kernel" ]; then
result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters"
found_item=1
fi
kernel=""
parameters=""
initrd=""
title=""
ignore_item=0
}
parse_grub_menu () {
mpoint="$1"
rootpart="$2"
bootpart="$3"
kernel=""
parameters=""
initrd=""
title=""
ignore_item=0
while read line; do
debug "parsing: $line"
set -f
set -- $line
set +f
case "$1" in
menuentry)
entry_result
shift 1
# The double-quoted string is the title.
# Make sure to look at the text of the line
# before 'set' mangled it.
title="$(echo "$line" | sed -n 's/[^"]*"\(.*\)".*/\1/p' | sed 's/://g')"
if [ -z "$title" ]; then
# ... or single-quoted? Be careful
# to handle constructions like
# 'foo'\''bar' (which expands to
# foo'bar, as in shell), and to
# handle multiple single-quoted
# strings on the same line.
title="$(echo "$line" | sed -n "s/[^']*'\(\([^']\|'\\\\''\)*\)'.*/\1/p" | sed "s/'\\\\''/'/; s/://g")"
fi
if [ -z "$title" ]; then
ignore_item=1
elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then
log "Skipping entry '$title':"
log "appears to be an automatic reference taken from another menu.lst"
ignore_item=1
fi
;;
linux)
# Hack alert: sed off any (hdn,n) but
# assume the kernel is on the same
# partition.
kernel="$(echo "$2" | sed 's/(.*)//')"
shift 2
parameters="$@"
# Systems with a separate /boot will not have
# the path to the kernel in grub.cfg.
if [ "$partition" != "$bootpart" ]; then
kernel="/boot$kernel"
fi
;;
initrd)
shift
initrd=""
for initrd_path in "$@"; do
# sed hack, as above
initrd_path="$(echo "$initrd_path" | sed 's/(.*)//')"
# Initrd same.
if [ "$partition" != "$bootpart" ]; then
initrd_path="/boot$initrd_path"
fi
if [ -z "$initrd" ]; then
initrd="$initrd_path"
else
initrd="$initrd $initrd_path"
fi
done
;;
"}")
entry_result
;;
esac
done
entry_result
}
if [ -e "$mpoint/boot/grub/grub.cfg" ] && \
([ ! -e "$mpoint/boot/grub/menu.lst" ] || \
[ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then
debug "parsing grub.cfg"
parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg"
elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then
debug "parsing grub.cfg"
parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg"
fi
if [ "$found_item" = 0 ]; then
exit 1
else
exit 0
fi
PK �D]ގY�c c mounted/40grubnu ȯ�� #!/bin/sh
. /usr/share/os-prober/common.sh
set -e
partition="$1"
bootpart="$2"
mpoint="$3"
type="$4"
found_item=0
entry_result () {
if [ "$ignore_item" = 0 ] && \
[ -n "$kernel" ] && \
[ -e "$mpoint/$kernel" ]; then
result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters"
found_item=1
fi
kernel=""
parameters=""
initrd=""
title=""
ignore_item=0
}
parse_grub_menu () {
mpoint="$1"
rootpart="$2"
bootpart="$3"
kernel=""
parameters=""
initrd=""
title=""
ignore_item=0
while read line; do
#debug "parsing: $line"
set -f
set -- $line
set +f
case "$1" in
title)
entry_result
shift 1
title="$(echo "$@" | sed 's/://g')"
if echo "$title" | grep -q '(on /dev/[^)]*)$'; then
log "Skipping entry '$title':"
log "appears to be an automatic reference taken from another menu.lst"
ignore_item=1
fi
;;
kernel)
# Hack alert: sed off any (hdn,n) but
# assume the kernel is on the same
# partition.
kernel="$(echo "$2" | sed 's/(.*)//')"
shift 2
parameters="$@"
# Systems with a separate /boot will not have
# the path to the kernel in menu.lst.
if [ "$partition" != "$bootpart" ]; then
kernel="/boot$kernel"
fi
;;
initrd)
# Hack alert take 2: sed off any (hdn,n)
# See #566102
initrd="$(echo "$2" | sed 's/(.*)//')"
# Initrd same.
if [ "$partition" != "$bootpart" ]; then
initrd="/boot$initrd"
fi
;;
boot)
entry_result
;;
module)
log "Skipping entry '$title':"
log "parsing of entries containing 'module' lines is currently not supported"
ignore_item=1
;;
esac
done
entry_result
}
grubconf=
if [ -e "$mpoint/boot/grub/menu.lst" ]; then
grubconf="menu.lst"
elif [ -e "$mpoint/boot/grub/grub.conf" ]; then
grubconf="grub.conf"
fi
if [ "$grubconf" ] && \
([ ! -e "$mpoint/boot/grub/grub.cfg" ] || \
[ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]); then
debug "parsing $grubconf"
parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/$grubconf"
fi
if [ "$found_item" = 0 ]; then
exit 1
else
exit 0
fi
PK �D]ez� mounted/50lilonu ȯ�� #!/bin/sh
. /usr/share/os-prober/common.sh
set -e
partition="$1"
bootpart="$2"
mpoint="$3"
type="$4"
found_item=0
title=""
rootdev=""
kernel=""
parameters=""
initrd=""
read_only=""
added_parameters=0
default_rootdev=""
default_kernel=""
default_parameters=""
default_initrd=""
default_read_only=""
dequote () {
item="${1%\"}"
echo "${item#\"}"
}
addparams () {
# Any parameters we find replace the default parameters, but
# otherwise append.
if [ "$added_parameters" = 0 ]; then
parameters="$1"
added_parameters=1
else
parameters="${parameters:+$parameters }$1"
fi
}
recordstanza () {
if [ -n "$kernel" ] && [ -n "$title" ]; then
if [ -e "$mpoint/$kernel" ] && [ -e "$mpoint/$initrd" ]; then
if [ "$read_only" ]; then
parameters="ro $parameters"
fi
if [ "$rootdev" ]; then
parameters="root=$rootdev $parameters"
fi
parameters="${parameters% }"
result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters"
found_item=1
else
debug "cannot find $kernel or $initrd, not recording"
fi
title=""
rootdev="$default_rootdev"
kernel="$default_kernel"
parameters="$default_parameters"
initrd="$default_initrd"
read_only="$default_read_only"
added_parameters=0
else
# Everything before set default values.
default_rootdev="$rootdev"
default_kernel="$kernel"
default_parameters="$parameters"
default_initrd="$initrd"
default_read_only="$read_only"
fi
}
parse_lilo_conf () {
mpoint="$1"
rootpart="$2"
bootpart="$3"
IFS=" ="
while read line; do
debug "parsing: $line"
set -f
set -- $line
set +f
case "$1" in
root)
rootdev=$(dequote "$2")
;;
image)
recordstanza
# Dereference if symbolic link
kernel="$(readlink -f "$(dequote "$2")")"
;;
append)
addparams "$(dequote "${line#append=}")"
;;
initrd)
# Dereference if symbolic link
initrd="$(readlink -f "$(dequote "$2")")"
;;
label)
shift 1
title="$(dequote "$*" | sed -e 's/:/ /g')"
;;
other)
recordstanza
;;
read-only)
read_only=1
;;
vga)
addparams "$line"
;;
esac
done
recordstanza
}
if [ -e "$mpoint/etc/lilo.conf" ]; then
debug "parsing lilo.conf"
parse_lilo_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/etc/lilo.conf"
fi
if [ "$found_item" = 0 ]; then
exit 1
else
exit 0
fi
PK �D]t7��( ( 50mounted-testsnu ȯ�� PK �D]�|�26 6 g mounted/90fallbacknu ȯ�� PK �D]��U��
�
� mounted/40grub2nu ȯ�� PK �D]ގY�c c � mounted/40grubnu ȯ�� PK �D]ez� �$ mounted/50lilonu ȯ�� PK � �-