Skip to content

Commit

Permalink
attempt at fixing mgcamd
Browse files Browse the repository at this point in the history
  • Loading branch information
WanWizard committed May 21, 2021
1 parent 364f471 commit ea1f6d7
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 4 deletions.
Expand Up @@ -11,5 +11,5 @@ DEPENDS += "zlib"
RDEPENDS_${PN} += "libcrypto-compat libxcrypt-compat"
INSANE_SKIP_${PN} += "file-rdeps ldflags"

RCONFLICTS_${PN} = "enigma2-plugins-softcams-mgcamd"
RREPLACES_${PN} = "enigma2-plugins-softcams-mgcamd"
RCONFLICTS_${PN} = "enigma2-plugins-softcams-mgcamd enigma2-plugins-softcams-mgcamd145c enigma2-plugins-softcams-mgcamd146"
RREPLACES_${PN} = "enigma2-plugins-softcams-mgcamd enigma2-plugins-softcams-mgcamd145c enigma2-plugins-softcams-mgcamd146"
Expand Up @@ -9,3 +9,6 @@ SRC_URI[softcam.sha256sum] = "1aebc407b4c7c96554d4ded83a6dc83b90b7db9fe1975f063e

DEPENDS += "zlib"
RDEPENDS_${PN} += "libcrypto-compat libxcrypt-compat"

RCONFLICTS_${PN} = "enigma2-plugins-softcams-mgcamd enigma2-plugins-softcams-mgcamd135a enigma2-plugins-softcams-mgcamd146"
RREPLACES_${PN} = "enigma2-plugins-softcams-mgcamd enigma2-plugins-softcams-mgcamd135a enigma2-plugins-softcams-mgcamd146"
Expand Up @@ -9,3 +9,6 @@ SRC_URI[softcam.sha256sum] = "b70a28fb6d3ac59cd16a6d4681d81ef761d2f5c56b0620c1f6

DEPENDS += "zlib"
RDEPENDS_${PN} += "libcrypto-compat libxcrypt-compat"

RCONFLICTS_${PN} = "enigma2-plugins-softcams-mgcamd enigma2-plugins-softcams-mgcamd135a enigma2-plugins-softcams-mgcamd145c"
RREPLACES_${PN} = "enigma2-plugins-softcams-mgcamd enigma2-plugins-softcams-mgcamd135a enigma2-plugins-softcams-mgcamd145c"
96 changes: 96 additions & 0 deletions meta-openpli/recipes-openpli/enigma2-softcams/mgcamd-softcam.inc
@@ -0,0 +1,96 @@
# To create a softcam:
# - install binary to /usr/bin/
# - install other stuff wherever you need it
# - fill in (mandatory)
# CAMNAME: Name of softcam, preferably matches /usr/bin name
# - fill in (optional)
# CAMSTART: Command to start the softcam, default to /usr/bin/${CAMNAME}
# CAMSTOP: Command to stop the softcam, default to killall ${CAMNAME}
# Instead of CAMSTART/CAMSTOP, you can create an init.d script called init.${CAMNAME}

LICENSE = "CLOSED"

FILES_${PN} = "${bindir} ${sysconfdir}"

RDEPENDS_${PN} += "softcam-support"
INSANE_SKIP_${PN} += "already-stripped"

CAMLINK = "/etc/init.d/softcam"
CAMPATH = "/etc/init.d/softcam.${CAMNAME}"

CAMSTART ?= "exec start-stop-daemon -S -b -x /usr/bin/${CAMNAME}"
CAMSTOP ?= "exec start-stop-daemon -K -o -R 2 -x /usr/bin/${CAMNAME}"

# Generate a simplistic standard init script
do_compile_append () {
if [ ! -f init.${CAMNAME} ]
then
cat > init.${CAMNAME} << EOF
#!/bin/sh
case "\$1" in
start)
ulimit -s 1024
rm -rf /tmp/ecm0.info /tmp/ecm.info /tmp/ecm1.info
sleep 2
${CAMSTART}
;;
stop)
${CAMSTOP}
sleep 1
# in case a normal stop failed
kill -9 /usr/bin/${CAMNAME}
rm -rf /tmp/ecm0.info /tmp/ecm.info /tmp/ecm1.info
;;
restart|reload)
\$0 stop
\$0 start
;;
version)
echo "${PV}"
;;
info)
echo "${CAMNAME} ${PV}"
;;
*)
echo "Usage: \$0 start|stop|restart"
exit 1
;;
esac
exit 0
EOF

fi
}

# Install routine, should be ok for most cams.
do_install_append () {
install -d ${D}${sysconfdir}/init.d
install -m 755 ${S}/init.${CAMNAME} ${D}${sysconfdir}/init.d/softcam.${CAMNAME}
}

# If no cam selected yet, install and start this cam (and don't start it on the build host).
pkg_postinst_${PN}_append () {
if [ ! -e "$D${CAMLINK}" ] || [ "$D/etc/init.d/softcam.None" = "`readlink -f $D${CAMLINK}`" ]
then
rm -f "$D${CAMLINK}"
ln -s "softcam.${CAMNAME}" "$D${CAMLINK}"
echo "Switching default softcam to ${CAMNAME}"
fi
if [ "${CAMPATH}" = "`readlink -f $D${CAMLINK}`" ]
then
echo "Softcam is selected as default, (re)starting ${CAMNAME}"
${CAMPATH} restart
fi
}

# Stop this cam (if running), and move softlink to None if we're the current cam
pkg_prerm_${PN}_prepend () {
${CAMPATH} stop
OLDLINK="`readlink -f ${CAMLINK}`"
if [ "${OLDLINK}" = "${CAMPATH}" ]
then
echo "${CAMNAME} was selected, now selecting None as softcam"
rm -f "${CAMLINK}"
ln -s "/etc/init.d/softcam.None" "${CAMLINK}"
fi
}
4 changes: 2 additions & 2 deletions meta-openpli/recipes-openpli/enigma2-softcams/mgcamd.inc
Expand Up @@ -8,7 +8,7 @@ CAMNAME = "mgcamd${MGCAMVER}"

S = "${WORKDIR}"

require softcam.inc
require mgcamd-softcam.inc

INHIBIT_PACKAGE_STRIP = "1"

Expand All @@ -18,7 +18,7 @@ CONFFILES = "${prefix}/keys/mg_cfg ${prefix}/keys/ignore.list ${prefix}/keys/new

do_install() {
install -d ${D}${bindir}
install -m 0755 ${S}/mgcamd.${TARGET_ARCH} ${D}${bindir}/${CAMNAME}
install -m 0755 ${S}/mgcamd.${TARGET_ARCH} ${D}${bindir}/mgcamd
install -d ${D}${prefix}/keys
install -m 0644 ${S}/mg_cfg ${D}${prefix}/keys/mg_cfg
install -m 0644 ${S}/ignore.list.example ${D}${prefix}/keys/ignore.list.example
Expand Down

0 comments on commit ea1f6d7

Please sign in to comment.