TDCroPower
Elite User
Hier meine aktuelle Version des Scripts, funktioniert bei mir tadellos!
Ihr benötigt ab dieser Version die ntpclient binary, zu finden im SamyGO Forum unter...
Viel Spaß damit !
Download:
SamyGO OScam Startscript 2019-09-16
und hier noch einmal das angepasste OScam Start/Stop Widget:
SamyGO OScam Start/Stop Widget
Programcode:
Changelog:
Verzeichnisbaum:
Verzeichnisinhalt:
Ihr benötigt ab dieser Version die ntpclient binary, zu finden im SamyGO Forum unter...
Sie müssen registriert sein, um Links zu sehen.
Viel Spaß damit !
Download:
SamyGO OScam Startscript 2019-09-16
und hier noch einmal das angepasste OScam Start/Stop Widget:
SamyGO OScam Start/Stop Widget
Programcode:
Code:
#!/bin/sh
##################################################################################
## OSCam Samsung script ##
## TDCroPower v20190916 ##
##################################################################################
##################################################################################
## 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
OSCAMVERSION=$(echo $OSCAMBUILD | cut -d "-" -f2) # OScam version
LIBOSCAMSO=$(basename $(ls $LIBSODIR/libOscam*.so)) # libOscam filename
LIBOSCAMMODEL=$(echo $LIBOSCAMSO | cut -d "_" -f2) # libOscam model
LIBOSCAMBUILD=$(echo $LIBOSCAMSO | cut -d "_" -f3 | cut -d "." -f0) # libOscam build
LIBLOGFILE=$(basename $(ls $TMPDIR/libOscam*.log)) # libOscam log filename
LIBALERTSO=libAlert.so # libAlert filename
SAMYGOSOBIN=samyGOso # samyGOso filename
NTPCLIENTBIN=ntpclient # ntpclient filename
TIMESERVER=pool.ntp.org # ntp timeserver
TIMEZONE='GMT-2' # set your timezone
##################################################################################
## libAlert popup text displayed on the TV ##
##################################################################################
TEXTUSB='STOP file found!' # your STOP 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
# has been inserted into the TV
stop_bootloop()
{
for USB in $TMPDIR/usb/sd* ; do
echo -ne "\033[1m[+]\033[0m checking $USB..."
if [ -e $USB/STOP ]; then
echo -e " \033[1;31mSTOP file found\033[0m"
alert "$TEXTUSB" 1
exit 1
else
echo -e " \033[1;32mSTOP file not found\033[0m"
fi
done
}
# the check_file function checks if the required files are available
check_file()
{
echo -ne "\033[1m[+]\033[0m checking required files..."
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 -e " \033[1;31mFile$LIBALERT$NTPCLIENT$SAMYGOSO not found\033[0m"
MISSINGFILE="File$LIBALERT$NTPCLIENT$SAMYGOSO $TEXTMISSINGFILE"
echo -e "\033[1m[!]\033[0m send MISSING Alert..."
alert "$MISSINGFILE" 2 # send MISSINGFILE message
exit 1
else
echo -e " \033[1;32mOK\033[0m"
fi
}
# the check_permission function checks if the permissions
# of the required files are set correctly and corrects them
check_permission()
{
echo -ne "\033[1m[+]\033[0m checking permissions..."
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/$NTPCLIENTBIN > /dev/null ]; then
NTPCLIENT=" ntpclient"
chmod 755 $BINDIR/$NTPCLIENTBIN # change permissions to -rwxr-xr-x
fi
if [ ! -x $BINDIR/$SAMYGOSOBIN > /dev/null ]; then
SAMYGOSO=" SamyGOso"
chmod 755 $BINDIR/$SAMYGOSOBIN # change permissions to -rwxr-xr-x
fi
if [ "$LIBALERT" ] || [ "$LIBOSCAM" ] || [ "$OSCAMBIN" ] || [ "$NTPCLIENT" ] || [ "$SAMYGOSO" ]; then
echo -e " \033[1;31mFile$LIBALERT$LIBOSCAM$OSCAMBIN$NTPCLIENT$SAMYGOSO permissions changed\033[0m"
PERMISSIONS="File$LIBALERT$LIBOSCAM$OSCAMBIN$NTPCLIENT$SAMYGOSO $TEXTPERMISSIONS"
echo -e "\033[1m[!]\033[0m send PERMISSIONS Alert..."
alert "$PERMISSIONS" 2 # send PERMISSIONS message
else
echo -e " \033[1;32mOK\033[0m"
fi
}
# the date_check function checks if the ntpclient is running
# starts it if necessary to correct the time and date
check_date()
{
echo -ne "\033[1m[+]\033[0m checking ntpclient..."
if ! pidof $NTPCLIENTBIN > /dev/null; then
$NTPCLIENTBIN -s -h $TIMESERVER &> /dev/null
$NTPCLIENTBIN -h $TIMESERVER &> /dev/null & export TZ="$TIMEZONE"
echo -e " \033[1;31mntpclient started with $TIMEZONE\033[0m"
else
echo -e " \033[1;32mOK\033[0m"
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
echo -e "\033[1m+++++++++++++++++ OScam Start +++++++++++++++++\033[0m"
stop_bootloop # jump to the bootloop check function
check_file # jump to the filcheck check function
check_permission # jump to the permission check function
check_date # jump to the date check function
echo -e "\033[1m[+]\033[0m start libOscam $LIBOSCAMBUILD for $LIBOSCAMMODEL..."
samyGOso -T -B -r -l $LIBSODIR/$LIBOSCAMSO # start the OScam library
echo -e "\033[1m[+]\033[0m start OScam $OSCAMVERSION"
$OSCAMDIR/$OSCAMBUILD -b -c $OSCAMDIR -t $TMPDIR -w 0 # start OScam
echo -e "\033[1m[+]\033[0m send START Alert..."
alert "$TEXTSTART" 2 # send START message
if ! pidof $OSCAMBUILD > /dev/null; then # check if OScam is not running
echo -e "\033[1m[+]\033[0m send START AGAIN Alert..."
alert "$TEXTSTART2" 2 # send START2 message
echo -e "\033[1m[+]\033[0m 2nd start OScam $OSCAMVERSION"
$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
echo -e "\033[1m[+]\033[0m send START SUCCESS Alert..."
alert "$TEXTSUCCESS" 1 # send SUCCESS message
else
echo -e "\033[1;31m[!]\033[0m send START FAILED Alert..."
alert "$TEXTFAIL" 1 # send FAIL message
fi
exit 0
;;
stop) # option stop
echo -e "\033[1m+++++++++++++++++ OScam Stop +++++++++++++++++\033[0m"
if pidof $OSCAMBUILD > /dev/null && [ ! -e $TMPDIR/stopused ] > /dev/null; then # check if OScam is running & file stopused present
echo -e "\033[1m[+]\033[0m OScam PID: $(pidof $OSCAMBUILD)"
echo -e "\033[1m[+]\033[0m kill $OSCAMBUILD"
killall $OSCAMBUILD # shutdown OScam
echo -e "\033[1m[+]\033[0m send STOP Alert..."
alert "$TEXTSTOP" 2 # send STOP message
elif pidof $OSCAMBUILD > /dev/null && [ -e $TMPDIR/stopused ] > /dev/null; then # check if OScam is running and stop was used
echo -e "\033[1;31m[!]\033[0m kill -9 $OSCAMBUILD"
killall -9 $OSCAMBUILD # shutdown OScam immediately
echo -e "\033[1;31m[!]\033[0m removing the used marker"
rm $TMPDIR/stopused # remove the used marker
echo -e "\033[1m[+]\033[0m send STOP immediately Alert..."
alert "$TEXTSTOP2" 2 # send STOP2 message
exit 0
else
echo -e "\033[1;31m[!]\033[0m set marker $TMPDIR/stopused"
touch $TMPDIR/stopused # marks first use of stop
fi
if pidof $OSCAMBUILD > /dev/null; then # check if OScam is running
echo -e "\033[1;31m[!]\033[0m send STOP FAILED Alert..."
alert "$TEXTSTOPFAIL" 1 # send STOPFAIL message
else
echo -e "\033[1m[+]\033[0m send STOP SUCCESS Alert..."
alert "$TEXTSTOPSUCCESS" 1 # send STOPSUCCESS message
fi
exit 0
;;
status) # option status
echo -e "\033[1m+++++++++++++++++ OScam Status +++++++++++++++++\033[0m"
NTPPID=$(pidof $NTPCLIENTBIN)
if pidof $NTPCLIENTBIN > /dev/null; then echo -e "\033[1m[+]\033[0m NTP PID: $NTPPID"; else echo "\033[1;31m[!]\033[0m NTP PID: \033[1;31mNOT RUNNING\033[0m"; fi
OSCAMPID=$(pidof $OSCAMBUILD)
if pidof $OSCAMBUILD > /dev/null; then echo -e "\033[1m[+]\033[0m OScam PID: $OSCAMPID"; else echo "\033[1;31m[!]\033[0m OScam PID: \033[1;31mNOT RUNNING\033[0m"; fi
[ -f $TMPDIR/$LIBLOGFILE ] && echo -e "\033[1m[+]\033[0m Output of $TMPDIR/$LIBLOGFILE:\n$(head -32 $TMPDIR/$LIBLOGFILE)\n[...]" || alert "$TEXTFAILSTATUS" 1
exit 0
;;
*)
echo "Usage: $0 {start|stop|status}" 1>&2
exit 0
;;
esac
##################################################################################
## PROGRAMCODE END ##
##################################################################################
Changelog:
v20190916:
- added colour marking on command line
v20190911:
- added more output information on command line
v20180610:
- STOP_SAMYGO changed to STOP
v20180325:
- timezone added
- program code cleaned up
v20180322:
- date_check function with ntpclient added, finally a correct date/time in oscam
- added check_file and check_permission functions
- alert function improved with transfer value for the sleep command
- option stop improved
- program code cleaned up
v20180320:
- added double OScam start attempts if something goes wrong at the first start
- libAlert command outsourced to a function
- added a lot of info popup
- remaining paths and file names moved to the configuration area
- updated OScam binary will now be detected automatically
- program code cleaned up
v20160625:
- insert stop function with 2 check killall
- more libAlert outputs for USB check, Oscam start check, stop check
- codefixes
v20160622:
OSCAM_DIR=/mnt/opt/privateer/usr/bin/oscam ==> OSCAM_DIR=$DISTROOT/usr/bin/oscam
>>> use the DISTROOT variable from the SGO.env
SODIR=$SYSROOT/opt/privateer/usr/libso ==> SODIR=$DISTROOT/usr/libso
>>> use the DISTROOT instead of SYSROOT variable from the SGO.env
BUILD=oscam-svn10666-samsungtv-webif ==> BUILD=oscam-samygo
>>> the OScam build can simple update to a higher version without to edit the *.init script
$OSCAM_DIR/libOscam*.so ==> $SODIR/libOscam*.so
>>> all SO files are now in the same directory
/dtv/xxxx ==> $TMPDIR/xxxx
>>> use the TMPDIR variable from the SGO.env
- added colour marking on command line
v20190911:
- added more output information on command line
v20180610:
- STOP_SAMYGO changed to STOP
v20180325:
- timezone added
- program code cleaned up
v20180322:
- date_check function with ntpclient added, finally a correct date/time in oscam
- added check_file and check_permission functions
- alert function improved with transfer value for the sleep command
- option stop improved
- program code cleaned up
v20180320:
- added double OScam start attempts if something goes wrong at the first start
- libAlert command outsourced to a function
- added a lot of info popup
- remaining paths and file names moved to the configuration area
- updated OScam binary will now be detected automatically
- program code cleaned up
v20160625:
- insert stop function with 2 check killall
- more libAlert outputs for USB check, Oscam start check, stop check
- codefixes
v20160622:
OSCAM_DIR=/mnt/opt/privateer/usr/bin/oscam ==> OSCAM_DIR=$DISTROOT/usr/bin/oscam
>>> use the DISTROOT variable from the SGO.env
SODIR=$SYSROOT/opt/privateer/usr/libso ==> SODIR=$DISTROOT/usr/libso
>>> use the DISTROOT instead of SYSROOT variable from the SGO.env
BUILD=oscam-svn10666-samsungtv-webif ==> BUILD=oscam-samygo
>>> the OScam build can simple update to a higher version without to edit the *.init script
$OSCAM_DIR/libOscam*.so ==> $SODIR/libOscam*.so
>>> all SO files are now in the same directory
/dtv/xxxx ==> $TMPDIR/xxxx
>>> use the TMPDIR variable from the SGO.env
Verzeichnisbaum:
LibAlert & libOscam*:
/mnt/opt/privateer/usr/libso
ntpclient & samyGOso:
/mnt/opt/privateer/usr/bin
Oscam files:
/mnt/opt/privateer/usr/bin/oscam/
Startscript:
/mnt/etc/init.d/
Logfiles:
/dtv
/mnt/opt/privateer/usr/libso
ntpclient & samyGOso:
/mnt/opt/privateer/usr/bin
Oscam files:
/mnt/opt/privateer/usr/bin/oscam/
Startscript:
/mnt/etc/init.d/
Logfiles:
/dtv
Verzeichnisinhalt:
root@tv:/mnt/opt/privateer/usr/libso $ ls -l
total 52
-rwxrwxrwx 1 root 0 24524 Jan 1 1970 libAlert.so
-rwxrwxrwx 1 root 0 25465 Jan 1 00:17 libOscamE_NON-MST_build26.so
root@tv:/mnt/opt/privateer/usr/bin $ ls -l sa* ntp*
-rwxrwxrwx 1 root 0 14536 Jan 1 00:14 ntpclient
-rwxrwxrwx 1 root 0 18487 Jan 1 1970 samyGOso
root@tv:/mnt/opt/privateer/usr/bin/oscam $ ls -l
total 1116
-rwxrwxrwx 1 root 0 1087532 Jan 1 1970 oscam-svn11546-samsungtv-webif
-rwxrwxrwx 1 root 0 258 Jan 1 1970 oscam.conf
-rwxrwxrwx 1 root 0 37 Jan 1 1970 oscam.dvbapi
-rwxrwxrwx 1 root 0 189 Jan 1 1970 oscam.server
-rwxrwxrwx 1 root 0 20798 Jan 1 1970 oscam.srvid
-rwxrwxrwx 1 root 0 71 Jan 1 1970 oscam.user
root@tv:/mnt/etc/init.d $ ls -l
total 56
-rwxrwxrwx 1 root 0 1984 Aug 16 2014 01_01_catch_crap.init
-rwxrwxrwx 1 root 0 803 Aug 26 2011 01_04_server_replacement.init
-rwxrwxrwx 1 root 0 1123 Jan 10 2011 01_05_hiddev.init
-rwxrwxrwx 1 root 0 1182 Apr 29 2013 02_01_sshd.init
-rwxrwxrwx 1 root 0 4185 May 9 2012 02_04_replace_wifi_mod.init
-rwxrwxrwx 1 root 0 1121 Nov 23 2010 02_10_wakelan.init
-rwxrwxrwx 1 root 0 593 Nov 5 2010 03_01_fuse.init
-rwxrwxrwx 1 root 0 7714 Mar 22 16:55 05_01_Oscam.init
-rwxrwxrwx 1 root 0 4521 Aug 8 2012 06_05_apache.init
-rwxr-xr-x 1 root 0 1452 Dec 8 2011 99_99_z_sendinfo.init
drwxr-xr-x 2 root 0 4096 Mar 22 16:52 disabled
root@tv:/dtv $ ls -l A* S* l* sa*
-rw-r--r-- 1 root 0 2407 Jan 1 00:00 Alert.log
-rw-r--r-- 1 root 0 1201 Jan 1 00:00 SGO.env
-rw-r--r-- 1 root 0 31002 Jan 1 00:08 libOscamE_NON-MST.log
-rw-r--r-- 1 root 0 25 Jan 1 00:00 samy.log
total 52
-rwxrwxrwx 1 root 0 24524 Jan 1 1970 libAlert.so
-rwxrwxrwx 1 root 0 25465 Jan 1 00:17 libOscamE_NON-MST_build26.so
root@tv:/mnt/opt/privateer/usr/bin $ ls -l sa* ntp*
-rwxrwxrwx 1 root 0 14536 Jan 1 00:14 ntpclient
-rwxrwxrwx 1 root 0 18487 Jan 1 1970 samyGOso
root@tv:/mnt/opt/privateer/usr/bin/oscam $ ls -l
total 1116
-rwxrwxrwx 1 root 0 1087532 Jan 1 1970 oscam-svn11546-samsungtv-webif
-rwxrwxrwx 1 root 0 258 Jan 1 1970 oscam.conf
-rwxrwxrwx 1 root 0 37 Jan 1 1970 oscam.dvbapi
-rwxrwxrwx 1 root 0 189 Jan 1 1970 oscam.server
-rwxrwxrwx 1 root 0 20798 Jan 1 1970 oscam.srvid
-rwxrwxrwx 1 root 0 71 Jan 1 1970 oscam.user
root@tv:/mnt/etc/init.d $ ls -l
total 56
-rwxrwxrwx 1 root 0 1984 Aug 16 2014 01_01_catch_crap.init
-rwxrwxrwx 1 root 0 803 Aug 26 2011 01_04_server_replacement.init
-rwxrwxrwx 1 root 0 1123 Jan 10 2011 01_05_hiddev.init
-rwxrwxrwx 1 root 0 1182 Apr 29 2013 02_01_sshd.init
-rwxrwxrwx 1 root 0 4185 May 9 2012 02_04_replace_wifi_mod.init
-rwxrwxrwx 1 root 0 1121 Nov 23 2010 02_10_wakelan.init
-rwxrwxrwx 1 root 0 593 Nov 5 2010 03_01_fuse.init
-rwxrwxrwx 1 root 0 7714 Mar 22 16:55 05_01_Oscam.init
-rwxrwxrwx 1 root 0 4521 Aug 8 2012 06_05_apache.init
-rwxr-xr-x 1 root 0 1452 Dec 8 2011 99_99_z_sendinfo.init
drwxr-xr-x 2 root 0 4096 Mar 22 16:52 disabled
root@tv:/dtv $ ls -l A* S* l* sa*
-rw-r--r-- 1 root 0 2407 Jan 1 00:00 Alert.log
-rw-r--r-- 1 root 0 1201 Jan 1 00:00 SGO.env
-rw-r--r-- 1 root 0 31002 Jan 1 00:08 libOscamE_NON-MST.log
-rw-r--r-- 1 root 0 25 Jan 1 00:00 samy.log
Zuletzt bearbeitet: