Scripts on Removable Media

From Stellarium Wiki
Revision as of 16:09, 2 December 2008 by Daggerstab (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

Stellarium can read scripts from removable media. This feature is intended for use in the Digitalis Education Systems planetarium projector systems, and as such it might not be very easy to use it on desktop systems. Here's a quick how-to which should work on Unix-like OSes (Linux, OSX, the BSD's etc). I'm not sure about the Windows systems out there - if someone has success or otherwise with this feature under Windows, please put a note on the discussion page for this page.

Method

<user data directory>/data/
  • In this directory create two shell scripts, one for mounting the media in question, one for un-mounting it. These should be called script_mount_script_disk and script_unmount_script_disk respectively. Set the file permissions so you can execute the scripts. These scripts should mount and un-mount the removable media on systems where that is necessary. If you use a distro which auto-mounts the media to some predicable location, these scripts can be empty if you like (although they must exist and be executable). See the examples below for more info.
  • Set the path to the mounted device in the config.ini file. e.g. if the device is mounted at /media/usb-drive you would add:
[files]
removable_media_path = /media/usb-drive
  • On the device, make a directory called "scripts", where you should put the scripts you wish to run from the removable media.
  • (re)-start Stellarium.
  • Using the TUI, navigate to Scripts -> CD/DVD Script, arrow right to highlight the "Arrow down to load list" text, and select the script you desire.

Note that the removable media settings do not affect where scripts are recorded to - they still do to <user data directory>/scripts.

Example mounting/unmounting scripts

For systems which do automatic media mounting, you probably just want to make a note where your removable device is mounted, put that in the config.ini file and have empty mounting/unmounting scripts. This way you leave the mounting to your OS. However, the scripts must exist and must not cause an error when they are executed, so you should have empty scripts in this case:

#!/bin/sh
# Dummy mounting/unmountig script

You'll need to set the permissions with chmod or your file manager so the file is executable.

For OSes without automounting enabled, you'll need to use the mount and unmount commands. Since Stellarium should not be running as root, you'll need to modify your /etc/fstab file so the user can mount and un-mount the relevant directories without root permissions (i.e. set the user mount option in the fstab entry for the device in question), then your mount script might look something like this:

#!/bin/sh
# example Stellarium mounting script
mount /dev/sdc /media/sdc
#!/bin/sh
# example Stellarium un-mounting script
unmount /media/sdc

Startup script

If you have a removable media directory set up in the config.ini file, and the script_mount_script_disk does not return an error, a specially named Stellarium script will be run from the device at startup. This file should be called startup.sts, and should also be in the script directory on the removable device.

Personal tools
Namespaces
Variants
Actions
in this wiki
other languages
Toolbox