Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 426518

Summary: media-tv/oscam ebuild request
Product: Gentoo Linux Reporter: Wojciech Myrda <vojcek>
Component: New packagesAssignee: Default Assignee for New Packages <maintainer-wanted>
Status: UNCONFIRMED ---    
Severity: enhancement CC: Thomas.Rausch
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://streamboard.gmc.to:8001/wiki
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: oscam-9999.ebuild
oscam-9999.ebuild
oscam-7218_csp_logging.patch
oscam-7929_no_debug.patch
oscam-9999.ebuild
oscam-8282_csp_logging.patch
oscam-9999.ebuild
oscam-2017_1107_csp_logging.patch
oscam-2018_0123_emu.patch
oscam-2017_1107_no_debug.patch
oscam-2017_1107_no_invalid_logging.patch

Description Wojciech Myrda 2012-07-14 06:09:17 UTC
Created attachment 318116 [details]
oscam-9999.ebuild

SCam is an Open Source Conditional Access Module software, based on the very good MpCS.

Having this program running is essetial for boxes that use DVB tv cards allowing them to use it for use with apps such as https://www.lonelycoder.com/tvheadend/
Comment 1 Wojciech Myrda 2012-07-14 06:15:32 UTC
One might also want to create starup scripts for it. Examples below

/etc/conf.d/oscam

OSCAMD_OPTIONS="-c /home/oscam/ -t /tmp/oscam/ -d 3 -r 2 -b"

/etc/init.d/oscam

#!/sbin/runscript

depend() {
        need localmount
}

start() {

        ebegin "Starting Oscam"
        start-stop-daemon --start --quiet --exec /usr/bin/oscam/ -- ${OSCAMD_OPTIONS} #2>/dev/null
        eend $?
}

stop() {
        ebegin "Stopping Oscam"
        kill `pidof oscam`
        sleep 1
        eend $?
}
Comment 2 Wojciech Myrda 2012-07-14 06:20:34 UTC
before I forget ebuild would not work with stable version of oscam as recently with http://streamboard.gmc.to:8001/changeset/7076 that particular commit and few others along the way the build setup have changed. Therefore it should work with live versions from 7076 onwards
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-07-14 08:54:18 UTC
Please do note that live ebuilds are not supposed to be available unmasked, so unless you also provide a standard release ebuild, I don't think it's worth adding anywhere.

Also I would suggest you to:

 - check newbin command instead of cp & dobin;
 - man pages should always be installed no matter on the USE flags;
 - to handle separate READER/PROTOCOLS you need new variables declared in profiles; unless they add external dependencies or are absolutely enormous you might want to limit to disabling a few of them and not all one-by-one;
 - the nomirror restriction is wrong in combination with live ebuilds; is it that bad legally to redistribute it?
 - the init script needs to be installed as part of the ebuild, but the one you're attaching is not really correct (don't use --quiet, use s-s-d to stop as well as start, ...);
 - you probably need to set up an user for this, and should not use /home or /tmp (unless it's really temporary files — /run is there for the pid files and so on);
Comment 4 Wojciech Myrda 2012-07-15 06:13:06 UTC
@ Diego
Thank You for the pointers.

Yes I know the live ebuilds are not to be included on their own, but I provided it here to share it for someone else interested. I have started with oscam while it was at revision 6608 which is using same build system as the stable 1.10 but I never used stable because of number of the features present in svn the therefore I am not sure would it work but I place what I have here after bit of checking

As far as the ebuild itself is concerned I am no guru and I did what I can and know about the portage requirements and placed it here exactly for the matter of review
- RESTRICT="nomirror" is not required AFAIK. It is lefover from the other ebuild I used to have it as a basis for this one.
- when I provided the number of readers and protocols I knew exaclty that this is not what portage system likes the most, but this was the only way for the ebuild to set it up that it takes advantage of modular build system. This is important as using only protocols/readers/features one needs makes the binary smaller and more stable. I do not know any other way especially when all are used for different purposes
- I know init scripts should be different that is why I didn't place them in the attachment just in the comment as example which does work for me. I would gladly fix it just do not have the appropriate know how.
- new user I have never set up so didn't place it in the ebuild which in the way I have it done probably would mean just a security breach or something ;). 

To sumarize I did think about creating user, proper init scirpts and so on but myself I run 4 separate instances of the oscam each for different card with different protocol and options and I did not know how to handle it without farther manual intervention anyway but ebuild helped me greatly with all the compilation hastle

I see what I can do but I do not promise anything as my voodoo simply is nearing the end on this one...
Comment 5 Olliver Schinagl 2012-07-25 20:36:57 UTC
There is a layman overlay, gbin that has an ebuild for oscam-9999. Maybe you can 'update' that one, (current url is wrong, should be oscam.to and maybe update useflags)? :)
Comment 6 Wojciech Myrda 2012-11-15 14:37:29 UTC
Created attachment 329610 [details]
oscam-9999.ebuild

I took this opportunity when oscam build enviroment changed again with this commit http://www.streamboard.tv/oscam/changeset/7919 and have made several changes to the ebuild as stated by Diego and got some ideas from gbin overlay ebuild, but some more work is still nedded. For instance I need a help with moving the stuff out of USE to modules just like it is done for example with "CAMERAS" for libgphoto2. I looked at that libgphoto2 ebuild quite closely and I do not know what am I doing wrong, but my stuff still shows up as regular use flags. Hints and Ideas are welcome ;)
Comment 7 Wojciech Myrda 2012-11-15 14:40:27 UTC
Created attachment 329612 [details, diff]
oscam-7218_csp_logging.patch

This patch keeps log size in the sane level while using extended cache protocol from oscam. I tested it first with the oscam revision 7218 and same patch works for it till now
Comment 8 Wojciech Myrda 2012-11-15 14:42:41 UTC
Created attachment 329614 [details, diff]
oscam-7929_no_debug.patch

I am not 100% sure this patch is nedded, but with it my builds get smaller a bit even when without it oscam ebuild uses properly CFLAGS from the make.conf
Comment 9 Wojciech Myrda 2013-02-04 11:00:43 UTC
Created attachment 337900 [details]
oscam-9999.ebuild

few additions to the oscam code has been made, this ebuild reflects that

PS Still need to learn how to move that stuff out of USE flags...
Comment 10 Wojciech Myrda 2013-02-04 11:05:51 UTC
Created attachment 337902 [details, diff]
oscam-8282_csp_logging.patch

recently the code in ocsam.c has been divided into several parts and 7218 CSP logging fix no longer applied. Here is new version. This patch should work for quite a few oscam revisions prior to 8282 as well
Comment 11 Wojciech Myrda 2018-01-24 09:00:22 UTC
Created attachment 516320 [details]
oscam-9999.ebuild

Over the years there has been quite a few changes in oscam. Hence the most recent one of them involves change to the created binary name the previous ebuild no longer works.

I still do not know how to change some of those use flags into module flags, but ebuild squeezes just about anything out of oscam what it has to offer for users.
Comment 12 Wojciech Myrda 2018-01-24 09:02:30 UTC
Created attachment 516322 [details, diff]
oscam-2017_1107_csp_logging.patch

patch silences quite a few unessential logs for those using cashex protocol
Comment 13 Wojciech Myrda 2018-01-24 09:06:02 UTC
Created attachment 516324 [details, diff]
oscam-2018_0123_emu.patch

Patch is taken from https://github.com/oscam-emu/oscam-emu and emulates few protocols for those interested in educating in content security
Comment 14 Wojciech Myrda 2018-01-24 09:09:14 UTC
Created attachment 516326 [details, diff]
oscam-2017_1107_no_debug.patch

removes debug flag from the CFLAGS
Comment 15 Wojciech Myrda 2018-01-24 09:12:11 UTC
Created attachment 516328 [details, diff]
oscam-2017_1107_no_invalid_logging.patch

For those zapping through the channels even those one has no option to view over time the number of invalid ECMs in logs can be larger than excepted. To save space one may use this patch.