#!/bin/sh
####################################################################
## OSCam Samsung script ##
## TDCroPower v20180322 ##
####################################################################
## Environment Variables ##
####################################################################
. /dtv/SGO.env
####################################################################
## CONFIGURATION ##
####################################################################
BINDIR=$DISTROOT/usr/bin # bin directory, $DISTROOT contains /mnt/opt/privateer
OSCAMDIR=$BINDIR/oscam # OScam directory
LIBSODIR=$DISTROOT/usr/libso # libso directory
OSCAMBUILD=$(basename $(ls $OSCAMDIR/oscam-svn*)) # OScam build filename
LIBOSCAMSO=$(basename $(ls $LIBSODIR/libOscam*.so)) # libOscam filename
LIBLOGFILE=$(basename $(ls $TMPDIR/libOscam*.log)) # libOscam log filename
LIBALERTSO=libAlert.so # libAlert filename
NTPCLIENTBIN=ntpclient # ntpclient filename
SAMYGOSOBIN=samyGOso # samyGOso filename
####################################################################
## libAlert popup text displayed on the TV ##
####################################################################
TEXTUSB='STOP_SAMYGO file found!' # your STOP_SAMYGO popup info text
TEXTMISSINGFILE='not found!' # your MISSING file popup info text
TEXTPERMISSIONS='permissions changed!' # your PERMISSIONS change popup info text
TEXTSTART='OScam starts...' # your OScam start popup info text
TEXTSTART2='OScam starts again...' # your OScam second start popup info text
TEXTSTOP='OScam stops...' # your OScam stop popup info text
TEXTSTOP2='OScam stops immediately...' # your OScam stop kill -9 popup info text
TEXTSTOPFAIL='Oscam stop failed!' # your OScam stop fail popup info text
TEXTSTOPSUCCESS='OScam stopped!' # your OScam stop success popup info text
TEXTSUCCESS='OScam started!' # your OScam success popup info text
TEXTFAIL='OScam start failed!?' # your OScam fail popup info text
TEXTFAILSTATUS='OScam not started!' # your OScam status fail popup info text
###################################################################
## CONFIGURATION END ##
###################################################################
## PROGRAMCODE ##
## !!! Change at your own risk !!! ##
###################################################################
# the stop_bootlogo function checks if a USB stick with the file STOP_SAMYGO has been inserted into the TV
stop_bootloop()
{
for USB in $TMPDIR/usb/sd* ; do
echo "checking $USB"
if [ -e $USB/STOP_SAMYGO ]; then
echo "$TEXTUSB"
alert "$TEXTUSB" 1
exit 1
fi
done
}
# the date_check function checks if the ntpclient is running and starts it if necessary to correct the time and date
date_check()
{
if ! pidof ntpclient > /dev/null; then
ntpclient -s -h pool.ntp.org &> /dev/null
ntpclient -h pool.ntp.org &> /dev/null &
echo "ntpclient started"
else
echo "ntpclient already running"
fi
}
# the check_file function checks if the required files are available
check_file()
{
if [ ! -e $LIBSODIR/$LIBALERTSO > /dev/null ]; then LIBALERT=" libAlert"; fi
if [ ! -e $BINDIR/$NTPCLIENTBIN > /dev/null ]; then NTPCLIENT=" ntpclient"; fi
if [ ! -e $BINDIR/$SAMYGOSOBIN > /dev/null ]; then SAMYGOSO=" SamyGOso"; fi
if [ "$LIBALERT" ] || [ "$LIBOSCAM" ] || [ "$OSCAMBIN" ] || [ "$NTPCLIENT" ] || [ "$SAMYGOSO" ]; then
echo "File$LIBALERT$NTPCLIENT$SAMYGOSO not found"
MISSINGFILE="File$LIBALERT$NTPCLIENT$SAMYGOSO $TEXTMISSINGFILE"
alert "$MISSINGFILE" 2 # send MISSINGFILE message
exit 1
fi
}
# the check_permission function checks if the permissions of the required files are set correctly and corrects them
check_permission()
{
if [ ! -x $LIBSODIR/$LIBALERTSO > /dev/null ]; then
LIBALERT=" libAlert"
chmod 755 $LIBSODIR/$LIBALERTSO # change permissions to -rwxr-xr-x
fi
if [ ! -x $LIBSODIR/$LIBOSCAMSO > /dev/null ]; then
LIBOSCAM=" libOscam"
chmod 755 $LIBSODIR/$LIBOSCAMSO # change permissions to -rwxr-xr-x
fi
if [ ! -x $OSCAMDIR/$OSCAMBUILD > /dev/null ]; then
OSCAMBIN=" OScam"
chmod 755 $OSCAMDIR/$OSCAMBUILD # change permissions to -rwxr-xr-x
fi
if [ ! -x $BINDIR/ntpclient > /dev/null ]; then
NTPCLIENT=" ntpclient"
chmod 755 $BINDIR/ntpclient # change permissions to -rwxr-xr-x
fi
if [ ! -x $BINDIR/samyGOso > /dev/null ]; then
SAMYGOSO=" SamyGOso"
chmod 755 $BINDIR/samyGOso # change permissions to -rwxr-xr-x
fi
if [ "$LIBALERT" ] || [ "$LIBOSCAM" ] || [ "$OSCAMBIN" ] || [ "$NTPCLIENT" ] || [ "$SAMYGOSO" ]; then
echo "File$LIBALERT$LIBOSCAM$OSCAMBIN$NTPCLIENT$SAMYGOSO permissions changed"
PERMISSIONS="File$LIBALERT$LIBOSCAM$OSCAMBIN$NTPCLIENT$SAMYGOSO $TEXTPERMISSIONS"
alert "$PERMISSIONS" 2 # send PERMISSIONS message
fi
}
# the alert function lets information popups appear directly on the TV
alert()
{
samyGOso -A -B -l $LIBSODIR/$LIBALERTSO "TEXT:$1" # send TEXT to TV screen
sleep $2 # wait for x seconds
}
case $1 in
start) # option start
stop_bootloop # jump to the bootloop check function
date_check # jump to the date check function
check_file # jump to the filcheck check function
check_permission # jump to the permission check function
samyGOso -T -B -r -l $LIBSODIR/$LIBOSCAMSO # start the OScam library
$OSCAMDIR/$OSCAMBUILD -b -c $OSCAMDIR -t $TMPDIR -w 0 # start OScam
alert "$TEXTSTART" 2 # send START message
if ! pidof $OSCAMBUILD > /dev/null; then # check if OScam is not running
alert "$TEXTSTART2" 2 # send START2 message
$OSCAMDIR/$OSCAMBUILD -b -c $OSCAMDIR -t $TMPDIR -w 0 # start OScam a 2nd time
elif pidof $OSCAMBUILD > /dev/null; then # check if OScam is running
alert "$TEXTSUCCESS" 1 # send SUCCESS message
else
alert "$TEXTFAIL" 1 # send FAIL message
fi
exit 0
;;
stop) # option stop
if pidof $OSCAMBUILD && [ ! -e $TMPDIR/stopused ] > /dev/null; then # check if OScam is running
killall $OSCAMBUILD # shutdown OScam
alert "$TEXTSTOP" 2 # send STOP message
elif pidof $OSCAMBUILD && [ -e $TMPDIR/stopused ] > /dev/null; then # check if OScam is running and stop was used
killall -9 $OSCAMBUILD # shutdown OScam immediately
rm $TMPDIR/stopused # remove the used marker
alert "$TEXTSTOP2" 2 # send STOP2 message
exit 0
else
touch $TMPDIR/stopused # marks first use of stop
fi
if pidof $OSCAMBUILD > /dev/null; then alert "$TEXTSTOPFAIL" 1; else alert "$TEXTSTOPSUCCESS" 1; fi
exit 0
;;
status) # option status
[ -f $TMPDIR/$LIBLOGFILE ] && echo -e "$(head -32 $TMPDIR/$LIBLOGFILE)\n[...]" || alert "$TEXTFAILSTATUS" 1
;;
*)
echo "Usage: $0 {start|stop|status}" 1>&2
exit 0
;;
esac
###################################################################
## PROGRAMCODE END ##
###################################################################
UE22F5480 T-MST12DEUC FW:1119.0
UE46F6470 T-MST12DEUC FW:1119.0
export TZ="GMT-1"
export TZ="GMT-2"
Wir verwenden Cookies und ähnliche Technologien für folgende Zwecke:
Akzeptieren Sie Cookies und diese Technologien?
Wir verwenden Cookies und ähnliche Technologien für folgende Zwecke:
Akzeptieren Sie Cookies und diese Technologien?