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

BIOSLEVEL

August 21, 2008Home » Articles & Reviews » Articles & Guides » Linux


Main Navigation

Login

Supporters


Add to Technorati Favorites

Upcoming Events

Top Sponsors

Sponsored Ads

Using the XBox 360 as an HTPC with uShare


October 16, 2007
Sean "Obsidian" Potter
Colin "Rhettigan" Dean
uShare
Forums
1 2 3 4 5

Extending uShare with shell scripts

Since uShare provides you with a basic web interface, the only command line options available are for configuring the program. With the web interface, you're given management over shares. You can add or delete, or add new shares. This is useful, especially if you tend to download or rip a lot of files. Use MythTV to record live TV? No problem, just use the web interface to refresh your shares.

Since there is, as of yet, no ebuild for Gentoo, I had to install uShare from source. That's all fine and peachy, but I want uShare to start when my computer boots. I wrote a short rc-script to do what I need it to do. You can extend it further, possibly creating an /etc/conf.d configuration file for it. Since the only uPnP media device I have is the XBox, I didn't see any reason to go beyond this. Some of you may have to edit "-i eth1" to "-i eth0", or just remove that part all together. Since my laptop is rarely rarely plugged into the network, I let uShare run over wireless.

#!/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 sure there are plenty of other creative ways to extend uShare with scripts. If you wanted, you could probably code an interrupt that forces uShare to refresh it's shares. That's a little beyond the scope of this article, but join the discussion in our forums and we'd be glad to help you with any ideas you have.
Enjoy the review? Subscribe to our RSS Feed.

« Previous1 2 3 4 5 Next »