This site will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device.

BIOSLEVEL

December 4, 2008Home » Articles & Reviews » Articles & Guides » Linux


Main Navigation

Login

Supporters


Add to Technorati Favorites

Upcoming Events

Top Sponsors

Sponsored Ads

Extending uShare with RC Scripts


November 19, 2007
Sean "Obsidian" Potter
Colin "Rhettigan" Dean
uShare
Forums
1 2 3

In my earlier entry on uShare, I took a look at installing and using uShare. I'll spare you the introduction to uShare and get to the point of this writing. If you're unfamiliar with uShare, then by all means, read our review. In the article, I discussed creating an rc-script for uShare in Gentoo, to automate the process of starting and stopping it. This is beginning of a series of articles on how to package an application for Gentoo's Portage. I'm going to start by creating a more advanced rc-script than what I wrote earlier, then in later entries create an ebuild and show how to put it into portage so you can emerge ushare. Let's begin by looking at the original rc-script.


#!/sbin/runscript
# Copyright 2007 Sean Potter
# Distributed under the terms of the GNU General Public License, v2 or later

depend()
{
need net
use logger
}

start() {
ebegin "Starting uShare with XBox 360 Support"
start-stop-daemon --start --background --pidfile /var/run/ushare.pid --make-pidfile --exec /usr/bin/ushare -- -i eth1 -x -c /opt -n $HOSTNAME
eend $?
}

stop () {
ebegin "Stopping uShare with XBox 360 Support"
start-stop-daemon --stop --quiet --pidfile=/var/run/ushare.pid
eend $?
}

I'm not going to go over the basics of the rc-script, you can look at the Gentoo Wiki for that. Instead, let's examine the script more closely. Specifically, I want to look at how the service is started. The script executes /usr/bin/ushare -i eth1 -x -c /opt -n $HOSTNAME. These are some rather fixed items, and unless the person is comfortable with editing an rc-script, then they're going to be stuck with the options I used. The only flexible option here is a name of the server, $HOSTNAME. We can give users more flexibility in configuration by creating a configuration file for the script.
Enjoy the review? Subscribe to our RSS Feed.

« Previous1 2 3 Next »