Posts Tagged ‘Linux’

Xibo and MythTV

April 14th, 2010

W’e've got a new room at work for our older students which has a TV mounted on the wall for Digital Signage.

What we wanted to do was provide a live/recorded TV function for breaks and lunchtime and then an easy way to switch over to our Digital Signage solution (Xibo) at other times.

It turned out to be reasonably simple.

First we installed and configured a new MythBuntu frontend (we already had the myth backend server running from a different project). I then installed the Xibo Python client (1.1.0a21) and made a small modification to the code to allow it to exit by remote control button press (our Media Centre remote sends a backspace character when you press the back button):

if e.scancode == 22:
    log.flush()
    self.parent.downloader.running = False
    self.parent.downloader.collect()
    self.parent.scheduler.running = False
    self.parent.scheduler.collect()

    log.log(5,"info",_("Blocking waiting for Scheduler"))
    self.parent.scheduler.join()
    log.log(5,"info",_("Blocking waiting for DownloadManager"))
    self.parent.downloader.join()
    log.log(5,"info",_("Blocking waiting for Player"))
    self.player.stop()
    os._exit(0)

That block was added after line 2852 appropriately indented of course :D

It’s then a simple enough job to add a Xibo button to the MythTV menu.

As your mythfrontend user (ie the user that automatically logs in to Mythbuntu on boot), do the following:

mkdir ~/.mythtv
cp /usr/share/mythtv/themes/defaultmenu/mainmenu.xml ~/.mythtv

You then edit ~/.mythtv/mainmenu.xml and add in a block like this:

<button>
    <type>SETTINGS_VIDEO</type>
    <text>Xibo Digital Signage</text>
    <action>EXEC /opt/xibo/pyclient/client/python/run.sh</action>
</button>

Then restart mythfrontend. You should have a new icon on the menu system that launches Xibo. Once Xibo is running, the client should quit when you press the back button on your remote control and drop you back in to MythTV.

Here’s a short video to show the system in action!

Linux P2V to KVM via tar and ssh

September 23rd, 2009

At work we have a kvm-based virtualisation solution.

We periodically convert real linux servers in to virtual machines, either for testing upgrades, backup purposes etc and I always have to stop and think how I do it, so here I’m documenting for myself how I do it. If it’s useful to you then so well and good.

  1. Create a new VM using virt-manager
  2. Manually edit the XML (/etc/libvirt/qemu/host.xml) to fix up the networking and change the network adapter to e1000
  3. Boot puppy linux inside the new VM. Choose xvesa x-server and manually configure eth0
  4. Partition the disk (usually /dev/hdb at this point) and format as required
  5. Mount the new partition (eg /mnt/hdb)
  6. From the new VM, run the following ssh command:
    ssh root@realserver “(cd / && tar -cvpf – –one-file-system –numeric-owner –exclude /some/files/to/exclude)” | (cd /mnt/hdb && tar xvf -)
  7. The whole machine will come over ssh. Note if you have lots of filesystems you’ll need to do them all manually – this will only take “/” over.
  8. Once the copy has completed, fix up /mnt/hdb/etc/fstab to reflect the new device names. /dev/hdb will become /dev/hda once you reboot minus the CDROM.
  9. Last job is to fix grub so it boots the machine correctly. Edit /mnt/hdb/boot/grub/menu.lst and modify the root device paths as required.
  10. grub
  11. find /boot/grub/stage1
  12. Remember the device name – example: (hd0,0)
  13. root (hd0,0)
  14. setup hd0
  15. Optionally edit /mnt/hdb/etc/network/interfaces to change the IP the box will come up on.
  16. Reboot the VM.