diff --git a/README b/README index e747a7f..548d3f1 100644 --- a/README +++ b/README @@ -18,7 +18,7 @@ such as: a chain one for other partitions with their own boot sectors. -Tests are executable programs in the directory /usr/lib/os-probes/. Each +Tests are executable programs in the directory /usr/libexec/os-probes/. Each test is called once per partition, with the partition to check as its parameter, and may output a string as described above, or nothing if it does not recognise an OS on that partition. Tests return an exit code of 0 @@ -27,7 +27,7 @@ partition; or return an exit code of 1 to indicate that no OS was found, and let the next test run. Tests that require the partition to be mounted can be placed in -/usr/lib/os-probes/mounted/. These tests are passed the following +/usr/libexec/os-probes/mounted/. These tests are passed the following parameters: partition, mount point, filesystem. Bootloader installer packages will then have to process this output (fairly @@ -62,7 +62,7 @@ short (or nonexistent), and may be inaccurate, confusing, or non-unique. See TODO for other limitations. The tests used by linux-boot-prober are in the directory -/usr/lib/linux-boot-probes/ and also in /usr/lib/linux-boot-probes/mounted, +/usr/libexec/linux-boot-probes/ and also in /usr/libexec/linux-boot-probes/mounted, and they are called in a similar way as the os-probes described above. The mounted probes are passed parameters for the root partition, the boot partition, and the directory the filesystems are mounted in. diff --git a/common.sh b/common.sh index 8030efa..46c3ba5 100644 --- a/common.sh +++ b/common.sh @@ -1,5 +1,5 @@ newns () { - [ "$OS_PROBER_NEWNS" ] || exec /usr/lib/os-prober/newns "$0" "$@" + [ "$OS_PROBER_NEWNS" ] || exec /usr/libexec/os-prober/newns "$0" "$@" } cleanup_tmpdir=false diff --git a/debian/changelog b/debian/changelog index d05f5eb..ee08677 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1012,7 +1012,7 @@ os-prober (0.03) unstable; urgency=low - Add Mac OS X probing support. * Joey Hess - Added linux-boot-prober, with sorta working support for grub. - - Reorg the probes, and move to /usr/lib. + - Reorg the probes, and move to /usr/libexec. - Remove broken depends line. - Add a linux boot probe that searches for kernels and initrds with no bootloader config file, as a fallback. diff --git a/debian/os-prober-udeb.install b/debian/os-prober-udeb.install index 956a68a..25b03e0 100644 --- a/debian/os-prober-udeb.install +++ b/debian/os-prober-udeb.install @@ -1,3 +1,3 @@ os-prober linux-boot-prober bin -newns usr/lib/os-prober +newns usr/libexec/os-prober common.sh usr/share/os-prober diff --git a/debian/os-prober.install b/debian/os-prober.install index b39e60c..97f9854 100644 --- a/debian/os-prober.install +++ b/debian/os-prober.install @@ -1,3 +1,3 @@ os-prober linux-boot-prober usr/bin -newns usr/lib/os-prober +newns usr/libexec/os-prober common.sh usr/share/os-prober diff --git a/debian/rules b/debian/rules index 81e9ad9..4a93c25 100755 --- a/debian/rules +++ b/debian/rules @@ -31,12 +31,12 @@ override_dh_install: dh_install for probes in os-probes os-probes/mounted os-probes/init \ linux-boot-probes linux-boot-probes/mounted; do \ - dh_install $$probes/common/* usr/lib/$$probes; \ + dh_install $$probes/common/* usr/libexec/$$probes; \ if [ -e "$$probes/$(ARCH)" ]; then \ - dh_install $$probes/$(ARCH)/* usr/lib/$$probes; \ + dh_install $$probes/$(ARCH)/* usr/libexec/$$probes; \ fi; \ done ifeq ($(ARCH),x86) - dh_install os-probes/mounted/powerpc/20macosx usr/lib/os-probes/mounted + dh_install os-probes/mounted/powerpc/20macosx usr/libexec/os-probes/mounted endif - cp -a debian/os-prober-udeb/usr/lib debian/os-prober/usr/ + cp -a debian/os-prober-udeb/usr/libexec debian/os-prober/usr/ diff --git a/linux-boot-prober b/linux-boot-prober index a3d756a..fd6dde1 100755 --- a/linux-boot-prober +++ b/linux-boot-prober @@ -135,7 +135,7 @@ if [ "$type" = btrfs ]; then bootsv= fi - test="/usr/lib/linux-boot-probes/mounted/40grub2" + test="/usr/libexec/linux-boot-probes/mounted/40grub2" if [ -f $test ] && [ -x $test ]; then debug "running $test $partition $bootpart $tmpmnt $type $subvol $bootsv" if $test "$partition" "$bootpart" "$tmpmnt" "$type" "$subvol" "$bootsv"; then @@ -157,7 +157,7 @@ if ! mapped="$(mapdevfs "$partition")"; then fi if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then - for test in /usr/lib/linux-boot-probes/*; do + for test in /usr/libexec/linux-boot-probes/*; do if [ -x $test ] && [ -f $test ]; then debug "running $test" if $test "$partition"; then @@ -179,7 +179,7 @@ else bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)" bootmounted=0 fi - for test in /usr/lib/linux-boot-probes/mounted/*; do + for test in /usr/libexec/linux-boot-probes/mounted/*; do if [ -f $test ] && [ -x $test ]; then debug "running $test on mounted $partition" if $test "$partition" "$bootpart" "$mpoint" "$type"; then diff --git a/linux-boot-probes/common/50mounted-tests b/linux-boot-probes/common/50mounted-tests index 01bca81..81e0c13 100755 --- a/linux-boot-probes/common/50mounted-tests +++ b/linux-boot-probes/common/50mounted-tests @@ -56,10 +56,10 @@ fi mounted= dm_devices= if type grub-mount >/dev/null 2>&1 && \ - type grub-probe >/dev/null 2>&1 && \ + type grub2-probe >/dev/null 2>&1 && \ grub-mount "$partition" "$tmpmnt" 2>/dev/null; then mounted=1 - type="$(grub-probe -d "$partition" -t fs)" + type="$(grub2-probe -d "$partition" -t fs)" [ "$type" ] || type=fuseblk elif dm_device="$(do_dmsetup osprober-linux "$partition")" && \ [ "$dm_device" ]; then @@ -83,7 +83,7 @@ if [ "$mounted" ]; then dm_devices="$dm_device $dm_devices" fi - for test in /usr/lib/linux-boot-probes/mounted/*; do + for test in /usr/libexec/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 diff --git a/os-prober b/os-prober index 6e17bca..750cfe2 100755 --- a/os-prober +++ b/os-prober @@ -128,7 +128,7 @@ parse_proc_mdstat () { # Needed for idempotency rm -f /var/lib/os-prober/labels -for prog in /usr/lib/os-probes/init/*; do +for prog in /usr/libexec/os-probes/init/*; do if [ -x "$prog" ] && [ -f "$prog" ]; then "$prog" || true fi @@ -177,7 +177,7 @@ for partition in $(partitions); do fi debug "btrfs volume uuid=$uuid partition=$partition" echo "$uuid" >>"$OS_PROBER_TMP/btrfs-vols" - test="/usr/lib/os-probes/50mounted-tests" + test="/usr/libexec/os-probes/50mounted-tests" if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test on btrfs $partition" if "$test" btrfs "$uuid" "$partition"; then @@ -187,7 +187,7 @@ for partition in $(partitions); do fi elif ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then - for test in /usr/lib/os-probes/*; do + for test in /usr/libexec/os-probes/*; do if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test on $partition" if "$test" "$partition"; then @@ -201,7 +201,7 @@ for partition in $(partitions); do mpoint="$(unescape_mount "$mpoint")" if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3) - for test in /usr/lib/os-probes/mounted/*; do + for test in /usr/libexec/os-probes/mounted/*; do if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test on mounted $partition" if "$test" "$partition" "$mpoint" "$type"; then diff --git a/os-probes/common/50mounted-tests b/os-probes/common/50mounted-tests index 0d4e6d0..4a1e374 100755 --- a/os-probes/common/50mounted-tests +++ b/os-probes/common/50mounted-tests @@ -115,7 +115,7 @@ if [ "$types" = btrfs ]; then mpoint="$tmpmnt" fi - test="/usr/lib/os-probes/mounted/90linux-distro" + test="/usr/libexec/os-probes/mounted/90linux-distro" if [ -f "$test" ] && [ -x "$test" ]; then debug "running subtest $test" if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID"; then @@ -154,7 +154,7 @@ if [ "$types" = btrfs ]; then mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt" mpoint="$tmpmnt" fi - test="/usr/lib/os-probes/mounted/90linux-distro" + test="/usr/libexec/os-probes/mounted/90linux-distro" if [ -f "$test" ] && [ -x "$test" ]; then debug "running subtest $test" if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then @@ -178,10 +178,10 @@ if [ "$types" = btrfs ]; then fi if type grub-mount >/dev/null 2>&1 && \ - type grub-probe >/dev/null 2>&1 && \ + type grub2-probe >/dev/null 2>&1 && \ grub-mount "$partition" "$tmpmnt" 2>/dev/null; then mounted=1 - type="$(grub-probe -d "$partition" -t fs)" || true + type="$(grub2-probe -d "$partition" -t fs)" || true if [ "$type" ]; then debug "mounted using GRUB $type filesystem driver" else @@ -202,7 +202,7 @@ elif dm_device="$(do_dmsetup osprober "$partition")" && \ fi if [ "$mounted" ]; then - for test in /usr/lib/os-probes/mounted/*; do + for test in /usr/libexec/os-probes/mounted/*; do debug "running subtest $test" if [ -f "$test" ] && [ -x "$test" ]; then if "$test" "$partition" "$tmpmnt" "$type"; then diff --git a/os-probes/mounted/common/90linux-distro b/os-probes/mounted/common/90linux-distro index 9bc5154..b11b738 100755 --- a/os-probes/mounted/common/90linux-distro +++ b/os-probes/mounted/common/90linux-distro @@ -16,10 +16,10 @@ subvol="$5" # can come first. # Unless volumes to checked are already mounted, they will be mounted using # GRUB's own filesystems through FUSE. Since these ATM doesn't support -# symlinks we need to also check in $dir/usr/lib* for distributions that +# symlinks we need to also check in $dir/usr/libexec* for distributions that # moved /lib* to /usr and only left symlinks behind. # TODO: look for ld-linux.so on arches that have it -if (ls "$dir"/lib*/ld*.so* && [ -d "$dir/boot" ] || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then +if (ls "$dir"/lib*/ld*.so* && [ -d "$dir/boot" ] || ls "$dir"/usr/libexec*/ld*.so*) >/dev/null 2>/dev/null; then if [ -e "$dir/etc/os-release" ]; then short="$(grep ^NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')" long="$(grep ^PRETTY_NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')" diff --git a/os-probes/mounted/x86/05efi b/os-probes/mounted/x86/05efi index 274520b..80f1a71 100755 --- a/os-probes/mounted/x86/05efi +++ b/os-probes/mounted/x86/05efi @@ -56,7 +56,7 @@ if [ -z "$efi" ]; then fi ret=1 -for test in /usr/lib/os-probes/mounted/efi/*; do +for test in /usr/libexec/os-probes/mounted/efi/*; do debug "running subtest $test" if [ -f "$test" ] && [ -x "$test" ]; then # we need results of subtest in stdout