-1

I have portable homedir. I want to include some code to .bashrc, but I want it to be executed on specific models only.
It is keybindings code (xmodmap) which reassigns some of keys, so it should be executed on my laptop only or any other Thinkpad X220

Can you suggest a reliable way to detect the thinkpad model?

I could bind it to a network interface MAC or CPU, but it would be cool to find out model name.

Max Tsepkov
  • 139
  • 2
  • 8

1 Answers1

1

Start with the output of dmidecode -t 1, and use that to help differentiate between systems.

[root@LAS ~]# dmidecode -t 1
# dmidecode 2.11
SMBIOS 2.7 present.

Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: HP
        Product Name: ProLiant DL380 G6
        Version: Not Specified
        Serial Number: 2UX95306KT      
        UUID: 36363135-3335-5532-5839-353330364B54
        Wake-up Type: Power Switch
        SKU Number: 516653-005      
        Family: ProLiant
ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • `dmidecode -s system-version` does exactly what I want. But, unfortunately I requires root:kmem permissions. As I want to put this code into .bashrc it's not an option :( – Max Tsepkov Jan 08 '13 at 13:01