Jump to content

Puredyne/Autoboot into your preferred setup

From Wikibooks, open books for an open world

Autobooting into your application

[edit | edit source]

This is useful if you have an art installation you want to be able to turn on and automatically run your program, or if you want different setups to choose from (starting without a graphical desktop for example).

The simple way

[edit | edit source]

is to use the autostarted app list in xfce, which is found in the main menu. Here you can add commands to be executed when xfce starts.

The more complex way

[edit | edit source]

This way we use the GRUB bootloader to choose between different setups called 'runlevels' (explained below). With this method it is possible to choose exactly what processes we want the computer to run.This is mostly taken from nescivi's howto on booting into SuperCollider, and will show an example of loading "emacs -sclang" without the graphical interface. A small program called screen is also used, which allows you to have a shell, that you can exit (but any programs that are running will keep running) and resume later on, even after having logged out and in again.

In GRUB you have to add an entry to boot into the runlevel you want. In the file /boot/grub/menu.lst, copy the field of your pure:dyne entry and at the end of the kernel line add the number of the runlevel you are going to use (3 is a good choice), for example:

  title myKoolInstallation
  root(hd0,0)
  kernel /live/vmlinuz1 ramdisk_size=100000 boot=live username=lintian persistent hostname=puredyne vga=791 3
  initrd /live/initrd1.img
  boot

Runlevel

[edit | edit source]

Runlevels are basically a series of scripts that will be executed when booting or halting the system. On Debian systems, you will find these in directories called /etc/rcN.d where "N" is the number of the runlevel. Choose one of the runlevels that aren't really used (2 is used by Debian as a default, 6 is usually connected to shutting down), and adapt that runlevel. In this directory you have to place all the symlinks for scripts that need to be executed and you can take away the ones you don't need (for example the one starting the graphical interface). To start screen, emacs and sc, make a symlink like:

  sudo ln -s /home/lintian/mystartupscript.sh S99sclangpatch


Startup script

[edit | edit source]

Make a file called mystartupscript.sh in your home directory and fill it with this:

  echo "starting sclang script"
  cd /dev
  /sbin/MAKEDEV console
  echo "made devices"
  chmod 666 /dev/console
  route add -net default gw 129.102.145.254
  cd /home/linitan/
  su lintian -c "/usr/bin/jackd -R -dalsa -dhw:0 -r44100 -p256 -n2 &" #start jack
  su lintian -c "/usr/bin/screen -c /home/lintian/.screenrc"
  echo "sending command"
  su lintian -c "/usr/bin/screen -X screen -t supercollider 1 bash startemacs.sh" #start supercollider
  echo "command sent"


then make the file executable for all users:

  sudo chmod 755 mystartupscript.sh


.screen

[edit | edit source]

Make a file called .screen in your home directory and fill it with this:

  startup_message off
  console off
  bash
  detach

then make the file executable for all users:

  sudo chmod 755 .screen


startemacs.sh

[edit | edit source]

(SuperCollider specific) In this file you have to set a couple of paths, so libraries can be found. And you have to start emacs with the startup file of the user, as that is where you'll probably have put the special sclang-commands. Make a file called startemacs.sh in your home directory and fill it with this:

  LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  export PATH LD_LIBRARY_PATH PKG_CONFIG_PATH
  emacs -u lintian -sclang


then make the file executable for all users:

  sudo chmod 755 startemacs.sh
  

.sclang.sc

[edit | edit source]

(SuperCollider specific) This file should already exist in your home directory and be configured to your needs. Add this part at the end to load your patch:


  fork { 

0.1.wait; s.quit; 0.5.wait; s.boot; 1.wait;

s.doWhenBooted( { { "/home/lintian/SuperCollider/startMyCoolPatch.scd".load }.defer; });

  };


Disabling the graphical desktop

[edit | edit source]

To prevent xfce from starting we have to remove a symlink in the runlevel directory:

  sudo rm /etc/rc3.d/S30gdm


Shutting down

[edit | edit source]

Currently pure:dyne prompts you to 'remove any disk in the tray and push ENTER' as a part of the shut down procedure. This will change soon, but in the mean time we can fix it with a small hack.

  sudo nano /etc/rc0.d/S89live-initramfs

and in this file, remove this part:

  if [ -z ${QUICKREBOOT} ]; then
      if [ -x /usr/bin/eject ]
      then
              eject -p -m /live/image >/dev/null 2>&1
              [ "$prompt" ] || return 0
      fi
      stty sane < /dev/console
      # XXX - i18n
      echo "Please remove the disc and close the tray (if any) then press ENTER: " > /dev/console
      if [ -x /sbin/usplash_write ]; then
          /sbin/usplash_write "TIMEOUT 86400"
          /sbin/usplash_write "TEXT-URGENT Please remove the disc, close the tray (if any)"
          /sbin/usplash_write "TEXT-URGENT and press ENTER to continue"
      fi
      read x < /dev/console
  fi


You might also want to turn off the computer with the power button. In which case, edit...

And it runs...

[edit | edit source]

Now the whole thing should be running as desired and you can login to the computer after it has booted. Type:

  screen -r

to enter the app you have started.

Other tweaks

[edit | edit source]

If you do not want to attach a keyboard and mouse to the computer, it may be necessary to make a change in the BIOS of the computer, to ensure that the computer doesn't halt when there is no keyboard found. Look for an option concerning "halt on any errors" or the like, and make sure it will not.