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=f7b1435d3d7a0b8ce27c17130dc14951e9089fd7;hp=57879b5a9a0a1e4b21f842845e4d6c0f5d59677f;hb=c3f0b654fc18b5f98bc65074e2118177e0f37ae9;hpb=596714857b0c6b2779e861e4069d63f0fa27aa28 diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 57879b5a9..f7b1435d3 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 } @@ -250,7 +254,7 @@ handle_fc () { fc_tgt_lun="${fc_tgt_hcil##*:}" fc_tgt_path="${DEV%/*}" fc_tgt_num="${fc_tgt_path##*/}" - fc_tgt_dev="${fc_tgt_path}/fc_transport:${fc_tgt_num}" + fc_tgt_dev="${fc_tgt_path}/fc_transport/${fc_tgt_num}" if [ -e "$fc_tgt_dev/port_name" ]; then read wwpn < $fc_tgt_dev/port_name fi @@ -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