Manjaro-Pek / pacli

A simple and interative Bash Frontend for Pacman/Yaourt/Pacaur
GNU General Public License v2.0
44 stars 8 forks source link

integrate option 9 in option 2? #35

Closed excalibur1234 closed 8 years ago

excalibur1234 commented 8 years ago

is it possible to detect, whether manjaro is installed on a HDD or SSD and integrate option 9 into option 2?

this issue does not have a high priority.

Chrysostomus commented 8 years ago

From what I gather, there are ways, but they are not fool proof. Linux kernel detects this, but it seems to consider at least thumb drives HHDs.

You can get the root device with root_device=$(df | grep "/$" | cut -c 6-8) and check if it is ssd with cat /sys/block/$root_device/queue/rotational

If it returns 0, then kernel sees the root as SSD. If 1, it sees it as HDD.

Chrysostomus commented 8 years ago

So, what you are looking for is probably something like [[ $(cat /sys/block/$(df | grep "/$" | cut -c 6-8)/queue/rotational) == 1 ]] && sudo pacman-optimize

papajoker commented 8 years ago

not exist this file in my pc ! but in /sys/devices/ :

find /sys -name "rotational"                                            
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/host6/target6:0:0/6:0:0:0/block/sdc/queue/rotational
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/host6/target6:0:0/6:0:0:1/block/sdd/queue/rotational
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/host6/target6:0:0/6:0:0:2/block/sde/queue/rotational
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/host6/target6:0:0/6:0:0:3/block/sdf/queue/rotational
/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/queue/rotational
/sys/devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb/queue/rotational
/sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sr0/queue/rotational

disk=$(df --output="source,target" | grep "/$" | cut -c 6-8) cat $(find /sys -name "rotational" 2>/dev/null | grep "$disk/queue" )

excalibur1234 commented 8 years ago

thanks a lot, both of you! added: https://github.com/Manjaro-Pek/pacli/commit/a2c83aed07913ba6b06922796db97a14794eff8b

now, i have to think about a restructure of the second block...