mathz.nu Asterisk Blacklist Hobby webbhotell

2009/11/26

sasc-ng – install

Filed under: Server — Mathz @ 15:52

Install SASC-NG
From Dolot
Jump to:navigation, search

Read the *old* tutorial here: Install Open-SASC-NG

Open-SASC-NG is dead, long live vdr-SASC-NG! Development on open-sasc-ng has halted a long time ago.
Contents
[hide]

* 1 Introduction
* 2 Preparation
o 2.1 Got root?
o 2.2 Installing dependencies
* 3 Installing sasc-ng
o 3.1 Getting sasc-ng source
o 3.2 Patching the source
o 3.3 Configuring and compiling
o 3.4 Loading the modules
o 3.5 Loading at boot
o 3.6 Starting sasc-ng
* 4 Cleaning up
o 4.1 Moving files & folders
o 4.2 Init script
* 5 Additional files
* 6 Other Tutorials

1 Introduction

SASC-NG is a so called “softcam”. It’s a piece of software which is able to decode satellite feeds.

This can be useful in multiple cases:

* When your DVB-S(2) device does not have a CI
* When you just don’t want to buy a CI & CAM (since it is quite expensive)
* When you want to share a card over multiple tuners in your system (Perfectly legal, although it may be a breach of contract with your provider)
* When you want to participate in cardsharing over the internet (this is, err, less legal)

2 Preparation
2.1 Got root?

Installing everything is much easier when you’re root.

sudo -s

2.2 Installing dependencies

The following packages are needed to compile sasc-ng.

apt-get install linux-headers-`uname -r` build-essential subversion openssl gettext libssl-dev screen mercurial

3 Installing sasc-ng
3.1 Getting sasc-ng source

cd /usr/local/src
hg clone http://85.17.209.13:6100/sc
cd /usr/local/src/sc
chmod +x contrib/sasc-ng/configure
chmod +x contrib/sasc-ng/dvbloopback/module/config_dvb.pl

3.2 Patching the source

This repository shouldn’t need any patches at the time.
3.3 Configuring and compiling

Do not use –shared! It will cause segfaults. Should you do use it, you’ll have to remove your sc folder and try again. (There’s no “make clean” here)

cd /usr/local/src/sc/contrib/sasc-ng/
./configure
make
make module

Installing the dvbloopback module (so it can load at boot)

rm /lib/modules/`uname -r`/misc/dvbloopback.ko
cd /usr/local/src/sc/contrib/sasc-ng/
cp sasc-ng /usr/bin
cp /usr/local/src/sc/contrib/sasc-ng/sc/PLUGINS/lib/* /usr/lib/
mkdir /lib/modules/`uname -r`/misc
/usr/bin/install dvbloopback.ko /lib/modules/`uname -r`/misc/
depmod

3.4 Loading the modules

since we installed the module at the appropriate position we can modprobe it:

modprobe dvbloopback

If you have multiple adapters (like I do, the reason why I’m using sasc-ng) you need to specify the amount of adapters you have. I have 3 adapters, so I do:

modprobe dvbloopback num_adapters=3

For some reason I’m constantly getting segfaults on Ubuntu (it doesn’t matter what kernel I’m using), but not on Debian.
3.5 Loading at boot

I used to advise you to add a line to your /etc/modules file to load the module at boot. This is no longer necessary with the new runsasc script (which you can find below.) In fact, removing it (therefore putting the script in charge of loading the module) resolved a few headaches for me.
3.6 Starting sasc-ng

To start sasc-ng:

LD_LIBRARY_PATH=/usr/local/src/sc/contrib/sasc-ng/sc/PLUGINS/lib/ ./sasc-ng -j 0:1 –cam-budget

To use it with MythTV:

LD_LIBRARY_PATH=/usr/local/src/sc/contrib/sasc-ng/sc/PLUGINS/lib/ ./sasc-ng -j 0:1 –cam-budget –sid-allpid –sid-nocache

LD_LIBRARY_PATH=/usr/local/src/sc/contrib/sasc-ng/sc/PLUGINS/lib/ ./sasc-ng -j 0:3 -j 1:4 -j 2:5 –cam-budget –sid-nocache -d 0xf0a –cam-dir /etc/camfiles

To use sasc-ng with newcs, add:

cardclient.conf:

newcamd:localhost:15000:1/0602/ffff:dummy:dummy:0102030405060708091011121314

4 Cleaning up
4.1 Moving files & folders

We will give our camfiles (cardclient.conf) a proper home & copy sasc-ng to the binary folder.

mkdir /etc/camfiles
cd /usr/local/src/sc/contrib/sasc-ng/
mv sc_files/* /etc/camfiles/
cp sasc-ng /usr/bin/

Now we’ll move the needed library files to the correct place.

cp /usr/local/src/sc/contrib/sasc-ng/sc/PLUGINS/lib/* /usr/lib/

Now we’ll edit the startup files.

nano /usr/local/bin/runsasc

And paste this script (you can ignore the DRIVERDIR variable in this script. Since we copied the module to our kernel tree we can just “modprobe dvbloopback” without any path.) Pay attention to the number of adapters you’re loading! I’ve set it to 3 and have added the necessary “-j” options.

#!/bin/bash

# Script to automate running of SASC-NG and Drivers

# Driver directory
DRIVERDIR=”/usr/local/src/mythtv.cvs/sasc-ng”
# Path to SASC-NG binary
SASCPRG=”sasc-ng”
# Path to CAM Directory
CAMDIR=”/etc/camfiles/”
# Number of DVB Cards you have in your system dedicated to SASC-NG
ADAPTERS=”3″
# Startup Options passed to SASC-NG. Adjust according to your devices.
#OPTIONS=”-r 0 -v 2 -o”
OPTIONS=”-j 0:3 -j 1:4 -j 2:5 –cam-budget –sid-allpid –sid-nocache –cam-dir”
# Number of times runsasc will attempt to restart SASC-NG after a crash has occured (set to 0 for no limit)
MAXTRIES=10
# Minimum runtime required (in seconds) for SASC-NG to continue restart attempts
MINRUN=20

## End Configuration Section ##

SASCCMD=”$SASCPRG $OPTIONS $CAMDIR”
KILL=”/usr/bin/killall -q -TERM”

# Detect whether the DVBLooopback driver is already loaded
# and return 0 if it *is* loaded, 1 if not:
function DriverLoaded()
{
grep -qse dvbloopback /proc/modules
}

# Load all DVBLoopback driver modules needed for your hardware:
function LoadDriver()
{
modprobe dvbloopback num_adapters=$ADAPTERS
sleep 5
}

# Unload all DVBLoopback driver modules loaded in LoadDriver():
function UnloadDriver()
{
rmmod dvbloopback
}

# Load driver if it hasn’t been loaded already:
if ! DriverLoaded; then
LoadDriver
fi

LASTRESTART=$(date +%s)
LOOPCOUNT=0
while (true) do
if [ $LOOPCOUNT -le $MAXTRIES ] || [ $MAXTRIES -eq 0 ] ; then
eval “screen -D -m -S sasc-ng $SASCCMD &”
# Wait for SASC-NG to initialize then do rest
sleep 10
touch /tmp/SASC_COMPLETE
else
$KILL runsasc
fi
# Remember PID of SASC-NG process
PID=$!
# Wait for SASC-NG to end or signal to arrive
wait $PID
# Remember return value of SASC-NG
RET=$?
if test $RET -eq 0 -o $RET -eq 2; then exit; fi
TIMEOFDEATH=$(date +%s)
RUNTIME=$((TIMEOFDEATH – LASTRESTART))
if [ $TIMEOFDEATH -le $(($LASTRESTART + $MINRUN)) ] ; then
echo “`date` SASC-NG crashed in $RUNTIME seconds. Minimum required runtime for SASC-NG is $MINRUN seconds. Killing runsasc process…”
$KILL runsasc
fi
echo “`date` Reloading DVBLoopback drivers”
$KILL sasc-ng
sleep 10
UnloadDriver
LoadDriver
LASTRESTART=$(date +%s)
LOOPCOUNT=$((LOOPCOUNT+1))
echo “`date` Restarting SASC-NG $LOOPCOUNT time(s). Maximum retries set to $MAXTRIES”
done

And give it the proper permissions:

chmod 755 /usr/local/bin/runsasc
chmod +x /usr/local/bin/runsasc

4.2 Init script

An init script will take care of sasc-ng starting up at boot.

nano /etc/init.d/sascd

Add these lines:

#! /bin/bash
#
# sasc start-stop script
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=”runsasc”
DESC=”SASC-NG”
DAEMON=”sasc-ng”

ENABLED=0
test -f /etc/default/sascc && . /etc/default/sascc
test “$ENABLED” != “0” || exit 0

rm -f /tmp/SASC_COMPLETE

LOOP=0
case “$1” in
start)
if ! ps -C sasc-ng > /dev/null 2>&1; then
echo -e “Starting $DESC: $NAME. \n”
runsasc &
until [ -e /tmp/SASC_COMPLETE ] || [ $LOOP -eq $TIMEOUT ] ; do
sleep 1
LOOP=$((LOOP+1))
done
if [ $LOOP -eq $TIMEOUT ]; then
echo -e “SASC-NG startup sequence has timed out in $TIMEOUT seconds. SASC-NG will not start. \n”
exit 1
fi
echo -e “SASC-NG startup time was $LOOP second(s). \n”
echo -e “SASC-NG startup sequence completed. \n”
else
echo -e “SASC-NG is already running. \n”
fi
;;
stop)
if ps -C sasc-ng > /dev/null 2>&1; then
echo -e “Stopping $DESC: $NAME. \n”
sleep 3
killall -q -TERM $NAME
killall -q -TERM $DAEMON
sleep 5
rmmod dvbloopback.ko
else
echo -e “SASC-NG is not running. \n”
fi
;;
restart|force-reload)
if ps -C sasc-ng > /dev/null 2>&1; then
echo -e “Restarting $DESC: $NAME. \n”
sleep 3
killall -q -TERM $NAME
killall -q -TERM $DAEMON
sleep 5
rmmod dvbloopback.ko
sleep 2
runsasc &
until [ -e /tmp/SASC_COMPLETE ] || [ $LOOP -eq $TIMEOUT ] ; do
sleep 1
LOOP=$((LOOP+1))
done
if [ $LOOP -eq $TIMEOUT ]; then
echo -e “SASC-NG startup sequence has timed out in $TIMEOUT seconds. SASC-NG will not start. \n”
exit 1
fi
echo -e “SASC-NG startup time was $LOOP second(s). \n”
echo -e “SASC-NG startup sequence completed. \n”
else
echo -e “SASC-NG is not running. \n”
fi
;;
*)
N=/etc/init.d/$NAME
echo “Use: $N {start|stop|restart|force-reload}” >&2
exit 1
;;
esac

rm -f /tmp/SASC_COMPLETE

exit 0

And now we set the proper permissions and actually add it to the runlevels:

chmod +x /etc/init.d/sascd
update-rc.d sascd defaults 21

We just need one more config file:

nano /etc/default/sascc

Add this:

# /etc/default/sascc
# Default SASC-NG startup config

# Change to 1 to enable sasc-ng’s init-script
ENABLED=1

# DVBLoopback Device creation timeout (in seconds)
TIMEOUT=60

5 Additional files

We’re planning on using this thing legally, with NewCS in our own system. We need a cardclient.conf file for that:

nano /etc/camfiles/cardclient.conf

And put this in it. (I added some more lines so you’ll get an idea as to how this thing works.)

#
# Comment lines can start with # or ;
#
# every client line starts with the client name, followed by some arguments:
# ‘hostname’ is the name of the server
# ‘port’ is the port on the server
# ’emm’ is a flag to allow EMM transfers to the server
# (0=disabled 1=enabled)
# ‘caid’ (optional) caid on which this client should work
# ‘mask’ (optional) mask for caid e.g. caid=1700 mask=FF00 would allow
# anything between 1700 & 17FF.
# Default is 1700 & FF00. If only caid is given mask is FFFF.
# You may give multiple caid/mask values comma separated
# (e.g. 1702,1722,0d0c/ff00).
# ‘username’ is the login username
# ‘password’ is the login password
#
# radegast client
#radegast:hostname:port:emm/caid/mask
#
# aroureos client
# ‘hexbase’
# ‘hexserial’ card data for which EMM updates should be send
#aroureos:hostname:port:emm/caid/mask:hexbase:hexserial
#
# camd33 client (tcp protocol)
# ‘aeskey’ is the AES key (32bytes), disable encryption if missing
#camd33:hostname:port:emm/caid/mask:username:password:aeskey
#
# camd35 client (udp protocol)
#camd35:hostname:port:emm/caid/mask:username:password
#
# cardd client
#cardd:hostname:port:emm/caid/mask:username:password
#
# buffy client
# ‘aeskey’ is the AES key (32bytes), disable encryption if missing
#buffy:hostname:port:emm:username:password:aeskey
#some examples
#newcamd:192.168.0.10:10000:1/1801/FF00:mythtv:xxxxxxxx:XXXXXXXXXXXXXXXXXXXXXXXXXXXX
#radegast:192.168.0.10:10001:1/1801/FF00
#
# newcamd client
# ‘cfgkey’ is the config key (28bytes)
#newcamd:hostname:port:emm/caid/mask:username:password:cfgKey
newcamd:127.0.0.1:10000:1/1801/FF00:test:test:0102030405060708091011121314
#
# gbox client
#
# NOTE: hostname & port will be ignore. GBOX must be runnning on the local
# machine. For convinience you should choose localhost:8004
#gbox:hostname:port:emm/caid/mask
#newcamd:hostname:port:emm/caid/mask:username:password:cfgKey
#newcamd:localhost:15000:1/0602/ffff:dummy:dummy:0102030405060708091011121314
radegast:192.168.1.2:10001:0/0100/ffff

6 Other Tutorials

* Install Gimp: Install and compile the latest GIMP from trunk (which has the single-window mode)

Retrieved from “http://dolot.kipdola.com/wiki/Install_SASC-NG”
Personal tools

* Log in / create account

Namespaces

* Page
* Discussion

Variants

Views

* Read
* View source
* View history

Actions

Search
Navigation

* Main Page
* Recent changes
* Random page
* Help

Toolbox

* What links here
* Related changes
* Special pages
* Printable version
* Permanent link
* Browse properties

* This page was last modified on 25 November 2009, at 23:32.
* This page has been accessed 36 times.
* Content is available under Attribution-Share Alike 3.0 Unported.

* Privacy policy
* About Dolot
* Disclaimers

* Powered by MediaWiki
* Attribution-Share Alike 3.0 Unported

17 Comments »

  1. Howdy very nice blog!! Man .. Lovely .. Amazing .. I’ll bookmark your weblog and take the feeds also…

    Comment by internet marketing technology — 2011/01/12 @ 06:48

  2. Very well written article. It will be helpful to everyone who utilizes it, including myself. Keep doing what you are doing – looking forward to more posts.

    Comment by Bryan Cutone — 2011/01/19 @ 02:41

  3. Hello! nice blog!

    Comment by propecia — 2011/01/23 @ 12:42

  4. Thank you in your assist!

    Comment by internet marketing technology — 2011/01/24 @ 04:37

  5. I appreciate you taking the time to post this. I bookmarked your page. Great blog. ๐Ÿ™‚

    Comment by Boston Moving Company — 2011/01/27 @ 22:58

  6. good text

    Comment by Goedkoopste autoverzekering — 2011/01/31 @ 06:41

  7. Another terrific post. Please continue to update us on the developments. Do you have a bulletin I can subscribe to? Thank you.

    Comment by herpes dating — 2011/02/02 @ 00:17

  8. Yet another fantastic article. Please keep us updated on the latest. Do you offer a newsletter I may sign up to? Kudos.

    Comment by charlotte wedding photography — 2011/02/06 @ 06:49

  9. Thank you for this article.

    Comment by Daniel Harrell — 2011/02/07 @ 14:50

  10. Great post. I bookmarked your blog.Thanks ๐Ÿ™‚

    Comment by Bottle Caps — 2011/02/08 @ 22:49

  11. Thanks… I bookmarked this site. I will check back.

    Comment by natural horse supplements — 2011/02/09 @ 20:14

  12. Thanks for posting. Much appreciated!

    Comment by Bottle Caps — 2011/02/11 @ 21:48

  13. Thanks for the information. I bookmarked your blog.

    Comment by Moving Boston — 2011/02/15 @ 21:50

  14. By far the most a must element is basically that you need to have to pick the computer hard drive format to ensure you definitely entire making when it comes to 24 hours. Anybody can give rise to their e-book in a morning ,, though the chasing after different types may be more rather than adequate enough being vital for help you find lots of money that you can markete.

    Comment by decorative fountains — 2011/02/17 @ 00:55

  15. Hi! I just wanted to give a huge thumbs up for the useful content you have here on this blog post. I’ll be coming back to your blog for more soon.

    Comment by canon t2i review — 2011/02/23 @ 09:27

  16. I simply wished to thank you very much yet again. I am not sure what I would’ve made to happen without the actual aspects provided by you over this subject matter. It absolutely was the intimidating setting in my circumstances, but considering the very well-written technique you resolved the issue took me to cry for contentment. I’m happy for this assistance and then expect you really know what a great job that you’re getting into educating some other people all through your web site. I know that you haven’t encountered all of us.

    Comment by Dinah Rollag — 2011/02/26 @ 23:42

  17. very good article, i certainly enjoy this website, continue on it

    Comment by stacy bride — 2011/02/28 @ 06:58

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress