xfs image for "PVR over network share" on-the-fly

Ideas and dreaming about C series TV will go this forum.
Post Reply

User avatar
beatfreak
SamyGO Project Donor
Posts: 553
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

xfs image for "PVR over network share" on-the-fly

Post by beatfreak » Mon Feb 17, 2014 10:07 pm

thanks to Chicas for the tip.
i made a script out of it :)

Code: Select all

    #!/bin/sh
    . /dtv/SGO.env

    #### Change-your-stuff START

    L1='/core/layer1' # /core is the only tmpfs with more than 10MB available, you may change this to some permanent storage location on TV / USB-Drive
    MPL1='/dtv/ly1mnt'
    L2="$MPL1/layer2"
    MPL2="$MPL1/ly2mnt"

    # Change only if you know what you're doing

    USE4PVR="0"

    #### Change-your-stuff END
    GOON="1"

    WriteToLog ()
    {
       case $2 in
          1)
          NOW=`date +%Y%m%d-%H%M%S`
          echo "$3" "$NOW $1" >>$LOGFILE
          ;;
          2)
          echo "$3" "$1" >>$LOGFILE
          ;;
       esac
    }

    case $1 in
        start)
       touch $LOGFILE
       WriteToLog "start of beatfreaks 03_01_xfsimg.init script" 1
       WriteToLog "1st layer image: " 2 '-n'
       if [ ! -e $L1 ]; then
          mkfs.xfs -f -d file,name=$L1,size=18m >> $LOGFILE
          WriteToLog "created" 2
       else
          WriteToLog "found" 2
       fi
       WriteToLog "1st layer mountpoint : " 2 '-n'
       if [ ! -d $MPL1 ]; then
          mkdir $MPL1
          WriteToLog "created" 2
       else
          WriteToLog "found" 2
       fi
       if [ `/bin/busybox mount | grep -c "$MPL1"` -lt "1" ] ; then
          mount -o loop $L1 $MPL1/
          WriteToLog "mounting layer1 : " 2 '-n'
          if [ `/bin/busybox mount | grep -c "$MPL1"` -lt "1" ] ; then
             WriteToLog "failed, aborting..." 2
             GOON="0"
          else
             WriteToLog "successful" 2
          fi
       else
          WriteToLog "layer1 already mounted" 2
       fi
       if [ $GOON = "1" ]; then
          WriteToLog "2nd layer image : " 2 '-n'
          if [ ! -e $L2 ]; then
             mkfs.xfs -f -d file,name=$L2,size=1536m >> $LOGFILE
             WriteToLog "created" 2
          else
             WriteToLog "found" 2
          fi
          WriteToLog "2nd layer mountpoint : " 2 '-n'
          if [ ! -d $MPL2 ]; then
             mkdir $MPL2
             WriteToLog "created" 2
          else
             WriteToLog "found" 2
          fi
          if [ `/bin/busybox mount | grep -c "$MPL2"` -lt "1" ] ; then
             mount -o loop $L2 $MPL2/
             WriteToLog "mounting layer2 : " 2 '-n'
             if [ `/bin/busybox mount | grep -c "$MPL2"` -lt "1" ] ; then
                WriteToLog "failed, aborting..." 2
                GOON="0"
             else
                WriteToLog "successful" 2
             fi
          else
             WriteToLog "layer 2already mounted" 2
          fi
          if [ $GOON = "1" ]; then
             WriteToLog "PVR Flag : " 2 '-n'
             if [ ! -f $MPL2/.PlaceHolderDO-NOT-REMOVE ]; then
                touch $MPL2/.PlaceHolderDO-NOT-REMOVE
                WriteToLog "created" 2
             else
                WriteToLog "found" 2
             fi
             if [ $USE4PVR != "0" ]; then
             umount $MPL2
             echo "PVRIMAGE=\"$L2\"" >> /dtv/SGO.env #this will be overwritten in vusb.remi71 if you don't fit it
             fi
          fi
       fi
       WriteToLog "end of beatfreaks 03_01_xfsimg.init script" 1
       ;;
        stop)
       [ $USE4PVR = "0" ] && umount $MPL2
       umount $MPL1
       rm -r $MPL1
       rm $L1
       ;;
        restart)
       $0 stop && $0 start || exit 1
       ;;
        status)
       ;;
        *)
        echo "Usage: $0 {start|stop|restart}" 1>&2
        exit 0
        ;;
    esac
it seems to be fast enough to be executed as a init.d script, i think it has become a little too big to be included as a subfunction in vusb.remis71.init
Last edited by beatfreak on Mon Jun 09, 2014 2:15 pm, edited 3 times in total.
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS //
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.

karo2204
SamyGO Project Donor
Posts: 137
Joined: Fri Feb 07, 2014 10:09 am
Location: M?nchen
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by karo2204 » Tue Feb 18, 2014 2:49 pm

Hi beatfreak,

I tried your script but I always get "mkfs.xfs not found".

I would appreciate your help.

Karolin
Samsung TV: UE46F6500
Website: http://www.karolin-bierbrauer.de

User avatar
beatfreak
SamyGO Project Donor
Posts: 553
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak » Tue Feb 18, 2014 8:06 pm

what is your model and firmware?
i have tested it only with T-VALDEUC 3011 and samyGO Extensions v0.03.6-r15
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS //
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.

tempinbox
Posts: 317
Joined: Wed May 11, 2011 7:00 pm

Re: xfs image for "PVR over network share" on-the-fly

Post by tempinbox » Mon Feb 24, 2014 2:31 pm

what is this script for?
can i use to simple record on samba share?

User avatar
beatfreak
SamyGO Project Donor
Posts: 553
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak » Mon Feb 24, 2014 6:40 pm

yes, it should be ok for samba shares too, it only generates the 1,5GB pvrimage with xfs filesystem so you dont have to keep it on usb or nw-share anymore
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS //
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.

User avatar
beatfreak
SamyGO Project Donor
Posts: 553
Joined: Tue Aug 23, 2011 9:03 am
Location: Hamburg
Contact:

Re: xfs image for "PVR over network share" on-the-fly

Post by beatfreak » Sat May 24, 2014 6:38 pm

Bugfix/update
improved logging, corrected check error


:oops: just saw the updated script in SF svn repo
DEUS has put the 18m xfs image in $SYSROOT, he checks if it is existing, if not creates it but then he always runs mkfs.xfs over it
this way on every boot/SamyGO init there is a unnecessary write on flash memory
/core is 230MB tmpfs but what is it used for?

@juuso i would have appreciated a hint that we already use this method in current version of vusb script ^^
//UE40C6500 @ T-VALDEUC 3011 // rooted manual HotelMode style // PVR to NFS via 18MB on-the-fly sparse XFS //
FYI: you can close your ssh session with SamyGO with

Code: Select all

~.
If you can't fix it using dvct tape, you are not using enough dvct tape.

Post Reply

Return to “[C] Brainstorm”