Hello Guest, if you are reading this it means you have not registered yet. Please take a second, Click here to register, and in a few simple steps you will be able to enjoy our community and use our OpenViX support section.
Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Thread: Script help

  1. #1
    Darmeth's Avatar
    Title
    Member
    Join Date
    May 2017
    Posts
    30
    Thanks
    2
    Thanked 8 Times in 4 Posts

    Script help

    Putting together an auto-grab script for e2 settings. It works, but a couple of issues. I welcome any help and suggestions please.

    1. Runs fine via telnet but no changes are seen on the box. I've "stepped through" on telnet and files are definately being delivered.
    2. Various errors when uploaded to /usr/scripts (thought it was to go in /usr/scrpt but when added there, it does not appear on the menu Vix > Script Runner??)

    Just ran from the box and it managed to clear my tuner setting! Nice!


    Code:
    #!/bin/sh
    # Darmeth 24-June-2017
    # Version 1.0
    rm -f -r /etc/enigma2/blacklist /etc/enigma2/lamedb /etc/enigma2/satellites.xml
    rm -f -r /etc/tuxbox/satellites.xml /etc/enigma2/whitelist /etc/enigma2/*.tv /etc/enigma2/*.radio
    rm -f -r /etc/enigma2/cables.xml /etc/enigma2/terrestrial.xml
    wget 'http://www.darmeth.com/downloads/Darmeth_Motor_NA_45E-30W.rar' -O '/tmp/Darmeth_Motor_NA_45E-30W.rar' > /dev/null
    unrar e -o+ '/tmp/Darmeth_Motor_NA_45E-30W.rar' '/etc/enigma2/'
    mv -f /etc/enigma2/satellites.xml /etc/tuxbox
    rm -rf /tmp/Darmeth_Motor_NA_45E-30W.rar > /dev/null
    wget -qO - hxxp://127.0.0.1/web/servicelistreload?mode=0
    sleep 3
    #wget -O /dev/null -q http://127.0.0.1/web/powerstate?newstate=3
    echo 'Darmeth Motor No Adult 45E-30W - UPDATED'
    exit 0

  2. #2
    abu baniaz's Avatar
    Title
    Moderator
    Join Date
    Sep 2010
    Location
    East London
    Posts
    23,338
    Thanks
    6,422
    Thanked 9,146 Times in 6,224 Posts
    usr/scripts not usr/script

    Your tuner config is not working maybe because there is an issue with the satellites.xml file. You should consider leaving it out of operations as the one in image gets updated regularly on updates.
    If you decide to use it, leave it in etc/enigma2/


    I don't think we have unrar in image. gzip is there.

  3. #3
    abu baniaz's Avatar
    Title
    Moderator
    Join Date
    Sep 2010
    Location
    East London
    Posts
    23,338
    Thanks
    6,422
    Thanked 9,146 Times in 6,224 Posts
    You should use "unzip"

    PS. You have a PM.

  4. #4
    Darmeth's Avatar
    Title
    Member
    Join Date
    May 2017
    Posts
    30
    Thanks
    2
    Thanked 8 Times in 4 Posts
    Thanks abu baniaz. Modified a bit and using unzip but getting an error:

    "zip flags 1 and 8 are not supported"

    You're 100% correct on unrar not in image; I installed using command "opkg install unrar"

  5. #5
    abu baniaz's Avatar
    Title
    Moderator
    Join Date
    Sep 2010
    Location
    East London
    Posts
    23,338
    Thanks
    6,422
    Thanked 9,146 Times in 6,224 Posts
    Try this until someone suggests something better. You may need to alter the way you pack/compress the files.

    Code:
    #!/bin/sh
    # Darmeth 25-June-2017
    # Version 1.1
    
    echo 'Removing old services'
    rm -rf /etc/enigma2/blacklist
    rm -rf /etc/enigma2/whitelist
    rm -rf /etc/enigma2/*.tv
    rm -rf /etc/enigma2/*.radio
    rm -rf /etc/enigma2/lamedb
    sleep 1
    echo 'obtaining new files'
    wget http://www.darmeth.com/downloads/Darmeth_Motor_NA_45E-30W.zip -O /tmp/Darmeth_Motor_NA_45E-30W.zip > /dev/null
    echo 'updating files....'
    unzip -o /tmp/Darmeth_Motor_NA_45E-30W.zip -d /etc/enigma2 > /dev/null
    wget -qO - http://127.0.0.1/web/servicelistreload?mode=0  > /dev/null
    echo 'removing temp files....'
    rm -rf /tmp/Darmeth_Motor_NA_45E-30W.zip > /dev/null
    sleep 3
    echo 'Darmeth Motor No Adult 45E-30W - UPDATED'
    exit 0
    Attached Files Attached Files

  6. #6
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,769
    Thanks
    235
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by Darmeth View Post
    Code:
    rm -f -r /etc/enigma2/blacklist /etc/enigma2/lamedb /etc/enigma2/satellites.xml
    rm -f -r /etc/tuxbox/satellites.xml /etc/enigma2/whitelist /etc/enigma2/*.tv /etc/enigma2/*.radio
    rm -f -r /etc/enigma2/cables.xml /etc/enigma2/terrestrial.xml
    Why are you recursively (-r) deleting files? It leads the reader to believe these should be directories.

    And given that he (now) zip file contains all of these entries anyway, why bother deleting them at all? Just give the -o option to unzip to overwrite those that already exist.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  7. #7
    Darmeth's Avatar
    Title
    Member
    Join Date
    May 2017
    Posts
    30
    Thanks
    2
    Thanked 8 Times in 4 Posts
    Thanks all but still no joy with unzip. Modified code below. FTP'd to /usr/scripts and chmod to 755 and tried 777. I'm stopping on the unzip with "zip flags 1 and 8 are not supported". Re-tried with unrar and it works, with files extracting. I'm suspecting now something is amiss with BusyBox.

    Code:
    echo 'PLEASE WAIT WHILE BOUQUETS ARE UPDATED'
    sleep 3
    echo $LINE
    wget http://www.darmeth.com/downloads/Darmeth_Motor_45E-30W.zip -O /tmp/darmeth.zip > /dev/null
    echo 'DOWNLOAD COMPLETE'
    echo $LINE
    echo 'UNPACKING BOUQUETS'
    sleep 1
    unzip -o /tmp/darmeth.zip -d /etc/enigma2 > /dev/null
    wget -qO - http://127.0.0.1/web/servicelistreload?mode=0  > /dev/null
    sleep 1
    echo 'CLEANING /tmp FOLDER'
    rm -rf /tmp/darmeth.zip > /dev/null
    sleep 1
    echo $LINE
    echo 'RELOADING SERVICES - PLEASE WAIT'
    wget -qO - http://127.0.0.1/web/servicelistreload?mode=1 > /dev/null
    wget -qO - http://127.0.0.1/web/servicelistreload?mode=2 > /dev/null
    echo $LINE
    echo 'DARMETH BOUQUETS UPDATED'
    echo $LINE
    exit 0

  8. #8
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,769
    Thanks
    235
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by Darmeth View Post
    Thanks all but still no joy with unzip. Modified code below. FTP'd to /usr/scripts and chmod to 755 and tried 777. I'm stopping on the unzip with "zip flags 1 and 8 are not supported". Re-tried with unrar and it works, with files extracting. I'm suspecting now something is amiss with BusyBox.
    The problem is in the zip file, so an issue with how it was created. [EDIT: probably something to do with the compression options]
    I get the same message for the download file.
    But if I unpack it on a Linux Mint system and create a new zip file, then copy that to the OpenVix box, all is OK.

    Now sure what $LINE was meant to be set to above, but here's a slightly simper version, with the locations parameterized at the top (easier to change).

    Code:
    #!/bin/sh
    # Darmeth 24-June-2017
    # Version 1.0
    
    src_uri="http://www.darmeth.com/downloads/Darmeth_Motor_45E-30W.zip"
    rld_uri="http://127.0.0.1/web/servicelistreload"
    
    echo 'PLEASE WAIT WHILE BOUQUETS ARE UPDATED'
    sleep 3
    echo
    wget -qO /tmp/darmeth.zip ${src_uri}
    echo 'DOWNLOAD COMPLETE'
    echo
    echo 'UNPACKING BOUQUETS'
    sleep 1
    unzip -qo /tmp/darmeth.zip -d /etc/enigma2
    wget -qO /dev/null "${rld_uri}?mode=0"
    sleep 1
    echo 'CLEANING /tmp FOLDER'
    rm -f /tmp/darmeth.zip
    sleep 1
    echo
    echo 'RELOADING SERVICES - PLEASE WAIT'
    wget -qO /dev/null "${rld_uri}?mode=1"
    wget -qO /dev/null "${rld_uri}?mode=2"
    echo
    echo 'DARMETH BOUQUETS UPDATED'
    echo
    exit 0
    Last edited by birdman; 25-06-17 at 15:15.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  9. #9
    abu baniaz's Avatar
    Title
    Moderator
    Join Date
    Sep 2010
    Location
    East London
    Posts
    23,338
    Thanks
    6,422
    Thanked 9,146 Times in 6,224 Posts
    Please try with the zip file I attached above.

  10. #10
    Darmeth's Avatar
    Title
    Member
    Join Date
    May 2017
    Posts
    30
    Thanks
    2
    Thanked 8 Times in 4 Posts
    Ok, getting there! Re-zipped properly and tested my script and birdman's. Files are extracted correctly to /etc/enigma2

    BUT...no change to my services. This file has had all the Sports Active channels removed from 28.2E as a test. After script run, they are still present.
    What are _bak & _org files? They are present on my box - could they be the issue?
    In addition to the regular lamebd, I also suddenly have a lamedb5.

  11. #11
    abu baniaz's Avatar
    Title
    Moderator
    Join Date
    Sep 2010
    Location
    East London
    Posts
    23,338
    Thanks
    6,422
    Thanked 9,146 Times in 6,224 Posts
    the bak files were created by your settings editor.

    don't worry about lamedb5, it is meant to be the new format of lamedb, but there is reluctance to accept it.

  12. #12
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,769
    Thanks
    235
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by abu baniaz View Post
    don't worry about lamedb5, it is meant to be the new format of lamedb, but there is reluctance to accept it.
    Really? It's a far more logical representation of the (same) data. Much simpler to parse.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  13. #13
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,769
    Thanks
    235
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by Darmeth View Post
    What are _bak & _org files? They are present on my box - could they be the issue?
    No. If you don't want them don't include them when you create the zip file.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  14. #14
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,769
    Thanks
    235
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by Darmeth View Post
    BUT...no change to my services. This file has had all the Sports Active channels removed from 28.2E as a test. After script run, they are still present..
    Given that mode=1 reloads lamedb and mode=2 reloads User Bouquets, why do you (first) do a mode=0, which does both of the mode=1 and mode=2 jobs?

    However, if you look at the debug logs it should show the reload happening.
    Whether that would forget existing channels I can't say,....
    Last edited by birdman; 26-06-17 at 00:34.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  15. #15
    abu baniaz's Avatar
    Title
    Moderator
    Join Date
    Sep 2010
    Location
    East London
    Posts
    23,338
    Thanks
    6,422
    Thanked 9,146 Times in 6,224 Posts
    The script in post 5 worked fine for me. Perhaps you can tweak that? My tests had the download and delete lines commented out. I manually transferred the attached zip file to /tmp.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.