Author Topic: Adding a custom script to a live CD  (Read 690 times)

bobestes

  • Guest
Adding a custom script to a live CD
« on: July 28, 2010, 08:25:31 AM »
I originally posted this in the General section, and I was referred to this section.

A friend scrounges old computers and makes usable computers out of the salvaged parts.  Some of them he sells, and some of them he gives to a deserving person.  Because of me, he is beginning to set them up with PCLOS instead of some version of Windows.  I was assisting him a while back when we needed to determine what hardware was installed.  My research uncovered the lshw command, and the completeness of its readout blew him away.

Now that I've set the stage, here's the problem.  He would like to customize a live CD with some troubleshooting routines including lshw.  Ideally, clicking an icon on the desktop would call the lshw routine and direct the output to a printer.  Unfortunately, neither of us knows enough about Linux (especially writing scripts) to do this without help.  Any assistance you can provide will be greatly appreciated.

Bob

Offline critter

  • Full Member
  • ***
  • Posts: 220
Re: Adding a custom script to a live CD
« Reply #1 on: July 28, 2010, 02:27:00 PM »
Bob,
if you only need the command output to be sent to a printer the command would be:

lshw | lpr

where the " |  " character is the vertical bar character (above the backslash on my UK English keyboard layout).

That is a whole lot of technical output though and you might prefer to filter out anything not relevant.

If you need more help then please post back.

Good luck.  :)
Motherboard   Gigabyte Z68X-UD3H-B3
Hard Drives      2 x Maxtor STM350032 500GB SATA
Memory      16GB RAM
Processor      Intel core i5 3.30GHz
Video         nVidia GeForce GT430
Sound      HDA Intel PCH
PCLinuxOS          KDE

bobestes

  • Guest
Re: Adding a custom script to a live CD
« Reply #2 on: July 28, 2010, 04:17:42 PM »
Bob,
if you only need the command output to be sent to a printer the command would be:

lshw | lpr

where the " |  " character is the vertical bar character (above the backslash on my UK English keyboard layout).

Thanks, I knew that the command would be something simple but different from the DOS command, I just didn't know what it would be. The "|" is located in the same place on my US English keyboard.

That is a whole lot of technical output though and you might prefer to filter out anything not relevant.
If you need more help then please post back.

Good luck.  :)

How can we set this up so that clicking an icon on the desktop will open a terminal window and run the above command?

Bob

Offline slax

  • Sr. Member
  • ****
  • Posts: 391
    • PCLinuxOS Gnome Edition
Re: Adding a custom script to a live CD
« Reply #3 on: July 28, 2010, 05:29:56 PM »
You can create a simple link to application:

Right click on destop -> Create new -> link to application

In the command field input the command

lshw | lpr



bobestes

  • Guest
Re: Adding a custom script to a live CD
« Reply #4 on: July 30, 2010, 01:21:08 PM »
You can create a simple link to application:

Right click on destop -> Create new -> link to application

In the command field input the command

lshw | lpr

Thank you.  That was much easier than I thought it would be.

Bob

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Adding a custom script to a live CD
« Reply #5 on: July 30, 2010, 05:08:08 PM »

There are other apps also which may help ......

kdesu gtk-lshw       ####   lshw with a GUI run as root
kinfocenter
hardinfo
sysinfo:/       in Konqueror
« Last Edit: July 30, 2010, 05:14:02 PM by JohnBoy »

bobestes

  • Guest
Re: Adding a custom script to a live CD
« Reply #6 on: July 30, 2010, 05:20:28 PM »
According to what I see here this command is recommended to be run as root.

Does it behave differently on your install?

I have found that if it is not run from root, the first thing it prints out is a message that it should be run from root.  It will then print out data about the computer, but it is not as complete as the data obtained when run as root.  This is the way it works when it is started by the automatic commands discussed above.  If I manually open a non-root terminal and type lshw, I get a message that it must be run from root, and the processing stops.  I can then enter su, the password, and then lshw, and it will work fine.  I can also log out then back in as root, and it will work fine.

Bob