X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=extras%2Fpath_id%2Fpath_id;h=0fad30cfb257d3468ce047efaf1776994be04f3c;hp=57879b5a9a0a1e4b21f842845e4d6c0f5d59677f;hb=4435308844467c0dab329531def8dbfa451d9781;hpb=596714857b0c6b2779e861e4069d63f0fa27aa28 diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 57879b5a9..0fad30cfb 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -95,7 +95,11 @@ handle_pci () { ;; esac done - d="pci-$pci_id-$d" + if [ "$d" ]; then + d="pci-$pci_id-$d" + else + d="pci-$pci_id" + fi D="$host_dev_path" RESULT=0 } @@ -456,7 +460,11 @@ handle_device () { return fi fi - cd $full_sysfs_path/device + if [ -L $full_sysfs_path/device/device ]; then + cd $full_sysfs_path/device/device + else + cd $full_sysfs_path/device + fi ;; esac full_sysfs_device_path="`pwd -P`" @@ -545,7 +553,7 @@ handle_device () { ;; *) mode="" - ;; + ;; esac if [ "$d" ]; then d="$d-${rewind}st${mode}" @@ -553,22 +561,9 @@ handle_device () { fi } -case "$TYPE" in - block) - handle_device - echo "ID_PATH=$d" - ;; - scsi_tape) - handle_device - echo "ID_PATH=$d" - ;; - input) - handle_device - echo "ID_PATH=$d" - ;; - *) - RESULT=1 - ;; -esac - -exit $RESULT +handle_device +if [ -z "$d" ]; then + exit 1 +fi +echo "ID_PATH=$d" +exit 0