User:Caelum
From coLinux
<Caelum> This is my homepage on the coLinux wiki...
IRC: Caelum
Real Name: Rafael Kitover
Location: San Francisco, USA
Email: [[[[Mail T(caelum AT SPAMFREE debian DOT org
Current Project: to figure out the simplest way for a Debian user to have a coLinux enabled dual boot system.
Pages I'm working on:
Contents |
[edit] Ideas Some of Which I Need to Move to the Appropriate Pages and Unrelated Blather
[edit] Launching Apps on Startup With @reboot
Someone suggested the very cool @reboot facility of crontab(5) which I am currently using to launch a custom version of rxvt-unicode as my user on coLinux boot.
My crontab looks like this:
@reboot $HOME/bin/[[coLinux]]_start
and $HOME/bin/[[coLinux]]_start looks like this:
#!/bin/sh
# exit if we aren't in [[coLinux]]
if (dd if=/dev/hda of=/dev/null bs=1 count=1 > /dev/null 2>&1); then
exit
fi
export DISPLAY=192.168.1.131:0.0
export TERM=rxvt-unicode
xrdb -merge ~/.cygurxvtrc
/usr/local/bin/rxvt -fn "xft:Bitstream Vera Sans Mono-20" -e zsh
# Shut down the VM when rxvt exits
sudo shutdown -h now
Although I have an
URxvt*font: xft:Bitstream Vera Sans Mono-20
entry in my ~/.cygurxvtrc I still have to use the -fn "xft:Bitstream Vera Sans Mono-20" option for some reason for the Cygwin X server to use that font. Also, the -e zsh is because cron sets SHELL=/bin/sh regardless of your login shell in /etc/passwd, in case you were wondering.
Notice that I'm using the Bitstream Vera fonts that Gnome makes frequent use of. They are very pretty, and they come with the xorg-x11-fscl Cygwin package. You can use them in your Windows applications by launching Start->Run c:\cygwin\usr\X11R6\lib\X11\fonts\TTF, then c:\windows\fonts. From there, select the files beginning with Vera and drag them to your windows fonts folder.
There is an rxvt-unicode-ml package in Debian, but I use my own for 256 color support. You can also you the urxvtd/urxvtc commands to use an rxvt server for faster window creation time and less memory impact. See the man pages.
Totally offtopic, I have a very nice resource DB for urxvt optimized for use with vim and screen, which is below:
! vim: set syntax=xdefaults: URxvt*title: urxvt URxvt*background: #000000 URxvt*foreground: #CCCCCC URxvt*colorBD: #FFFFFF URxvt*font: xft:Bitstream Vera Sans Mono-20 !URxvt*font: xft:Bitstream Vera Sans Mono-18,xft:[[FreeMono]]-11:bold,neep-alt-iso8859-1-18 URxvt*[[iconName]]: urxvt URxvt*[[scrollBar]]: False URxvt*insecure: True URxvt*[[saveLines]]: 2000 URxvt*geometry: 144x50+0+0 URxvt*color0: #000000 URxvt*color1: #c00000 URxvt*color2: #008000 URxvt*color3: #808000 URxvt*color4: #0000c0 URxvt*color5: #c000c0 URxvt*color6: #008080 URxvt*color7: #c0c0c0 URxvt*color8: #808080 URxvt*color9: #ff6060 URxvt*color10: #00ff00 URxvt*color11: #ffff00 URxvt*color12: #8080ff URxvt*color13: #ff40ff URxvt*color14: #00ffff URxvt*color15: #ffffff URxvt*[[cursorBlink]]: on URxvt*[[cursorOnTime]]: 400 URxvt*[[cursorOffTime]]: 250 URxvt*[[cursorColor]]: White
[edit] Dynamically Reading the Host IP Address
Ok, this should be a simple matter of writing a file and reading it with cofs or smbfs on launch. I'll put something here once I figure it out....
Ideally coLinux would have a /proc or sysfs interface.
[edit] my.colinux.xml File (COFS VERSION)
NOTE: I should translated this and the below to smbfs since cofs is new and possibly unstable.
I've translated devices to be close to the linux ones, so that I can use the same /etc/fstab with some modifications:
<?xml version="1.0" encoding="UTF-8"?>
<colinux>
<!-- swap -->
<block_device index="7" alias="hda7" path="\Device\Harddisk0\Partition5" enabled="true" />
<!-- /root -->
<block_device index="6" alias="hda6" path="\Device\Harddisk0\Partition4" enabled="true" />
<!-- /boot -->
<block_device index="1" alias="hda1" path="\Device\Harddisk0\Partition1" enabled="true" />
<!-- /winxp -->
<cofs_device index="2" path="\[[DosDevices]]\c:" type="flat" enabled="true" />
<!-- /data -->
<cofs_device index="5" path="\[[DosDevices]]\d:" type="flat" enabled="true" />
<!-- /floppy -->
<block_device index="10" alias="sdh" path="\Device\Floppy0" enabled="true" />
<!-- /cdrom -->
<block_device index="11" alias="scd0" path="\Device\Cdrom0" enabled="true" />
<!-- bootparams allows you to pass kernel boot parameters -->
<bootparams>root=/dev/hda6</bootparams>
<!-- image allows you to specify the kernel to boot -->
<image path="vmlinux" />
<!-- this line allows you to specify the amount of memory available
to [[coLinux]] -->
<memory size="256" />
<!-- This allows you to modify networking parameters, see the README
or website for more information -->
<network index="0" type="tap" name="TAP" mac="00:FF:C0:32:49:00" />
</colinux>
[edit] my.colinux.txt (COFS VERSION) 0.7.x
Since 0.7 coLinux no longer allows the use of XML config files, only command line parameters. These can be placed in a text and used via colinux-daemon.exe @my.colinux.txt . Here's my config file in that format:
hda7=\Device\Harddisk0\Partition5 hda6=\Device\Harddisk0\Partition4 hda1=\Device\Harddisk0\Partition1 cofs2=c: cofs5=d: sdh=\Device\Floppy0 scd0=\Device\Cdrom0 root=/dev/hda6 kernel=vmlinux mem=256 eth0=tuntap,TAP,00:FF:C0:32:49:00
Anchor(colXMLtoCMD)
Here's a script to convert XML configs to command line configs you can load with @foo.txt on the daemon command line.
Sorry for pasting, I don't know where to upload files and my homepage is a mess. Call it colXMLtoCMD or something:
#!/usr/bin/perl
# This script converts a [[coLinux]] 0.6.x XML config file to a text-based file
# with command line switches for 0.7.x which no longer supports XML config
# files.
#
# Rafael Kitover (caelum@debian.org)
# Aug 28
use strict;
use warnings;
use XML::Simple;
local $\ = "\n"; # implicit newline after print statements
my $x = XMLin(shift,
[[ForceArray]] => [ qw(block_device cofs_device network) ],
[[KeyAttr]] => 'index'
);
print "kernel=", $x->{image}->{path};
print $x->{bootparams};
print "mem=", $x->{memory}->{size};
my $b_devs = $x->{block_device};
for my $idx (sort keys %$b_devs) {
my $dev = $b_devs->{$idx};
next unless $dev->{enabled} =~ /^true$/i;
my $name = $dev->{alias} || "cobd$idx";
print "$name=", $dev->{path};
}
my $c_devs = $x->{cofs_device};
for my $idx (sort keys %$c_devs) {
my $dev = $c_devs->{$idx};
next unless $dev->{enabled} =~ /^true$/i;
my $path = $dev->{path};
$path =~ s/^\\[[DosDevices]]\\//;
print "cofs$idx=$path";
}
my $nets = $x->{network};
for my $idx (sort keys %$nets) {
my $net = $nets->{$idx};
my $type = $net->{type} =~ /^tap$/i ? "tuntap" : "pcap-bridge";
my $name = $net->{name} ? '"'.$net->{name}.'"' : "TAP";
print "eth$idx=$type,$name", $net->{mac} ? ",$net->{mac}" : "";
}
[edit] My Debian /etc/fstab (COFS VERSION)
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> /dev/hda7 none swap defaults 0 2 /dev/hda6 / ext3 defaults,noatime 0 1 /dev/hda1 /boot ext3 defaults,noatime 0 1 cofs2 /winxp cofs defaults,user,noexec,dmask=0777,fmask=0666,async,noatime 0 0 /dev/hda2 /winxp ntfs defaults,user,noexec,dmask=0777,fmask=0666,async,noatime 0 0 cofs5 /data cofs defaults,user,noexec,dmask=0777,fmask=0666,async,noatime 1 0 /dev/hda5 /data vfat defaults,user,noexec,dmask=0777,fmask=0666,async,noatime,quiet,check=relaxed 00 /dev/sdh /floppy auto rw,user,uid=1000,guid=1000,noauto,async,noatime,quiet,check=relaxed 0 0 /dev/cdrom /cdrom auto defaults,user,uid=1000,gid=1000,async,noatime 0 0 /dev/sda1 /mnt/camera auto rw,user,uid=1000,gid=1000,noauto,async,noatime,quiet,check=relaxed 0 2 tmpfs /tmp tmpfs defaults 0 0 tmpfs /var/tmp tmpfs defaults 0 0 proc /proc proc defaults 0 0 usbfs /proc/bus/usb usbfs defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0
I have the normal mounts for my XP and Fat32 partition listed first, and they obviously error out under coLinux and the coLinux ones error out in normal linux, which is just what I want. Aside from some errors, it's a lot easier to maintain one /etc/fstab file.
(this page is under construction...)
MassTranslated on Sun Apr 23 17:35:38 UTC 2006