Linux/Bash(?) help please

peterworks

Ye Olde Bowler
I can post a combined patch of the one above and moving pointer patch both by @Matthew if anyone's interested. The patch above has lost some initial spaces which will cause it to fail.

I have added some extra genre colours and moved the pointer vertically because it was overlapping the days at the top and ending before the last channel entry at the bottom (this might be browser dependent).
Please excuse my almost total lack of knowledge of Linux. I am now a bit long in the tooth to learn it although I do dabble.

@xyz321 kindly made a patch to incorporate changes to the epg originating from @Matthew (as quoted above).
It works fine but whenever WebIf is updated it is 'lost' and I have to run the following:
cd /mod/webif
patch -p1 < /mod/tmp/webif-matthew-combined.patch

I am not at all familiar with Linux but wondered if I could create a bash(?) file that will run at each startup of the box.

I have looked at all sorts of examples and have come up with the following:
#!/bin/sh
$ chmod a+x DoEPG.sh
./DoEPG.sh
cd /mod/webif
patch -p1 < /mod/tmp/webif-matthew-combined.patch

Would this work ?

I do not know where to go from here. From my understanding I name the file DoEPG.sh and put it into the /bin/sh folder. I appreciate that I may not need the .sh extension but I would like to keep it to differentiate the file from those that are part of WebIf.

I would cause it to run by putting this:
* * * * * /mod/sbin/DoEPG.sh
in either /mod/etc/anacrontab or /mod/var/spool/cron/crontabs/root

Any advice very welcome.
 
I am not at all familiar with Linux but wondered if I could create a bash(?) file that will run at each startup of the box.
There are instructions for running a script at each startup (see below), but I'm not sure that's what you want. The patch should only be applied once, not each boot. It's the update which is wiping it, not the reboot, and I'm not sure what would happen if the target(s) of the patch file were different (a reason for the update) – the patch might fail anyway.

I think the only way you could reasonably do it is, instead of trying to patch the file set each boot (bearing in mind there might be multiple targets in the patch file), is to save a copy of the patched files somewhere else, and then copy them in each boot (over-writing the target files whether they're the patched ones or been reverted by an update). Of course, if the update made material changes to the target files, it could be a mistake to over-write them.

Creating a script to auto-run at boot (click)
 
Last edited:
If this patch is uncontroversial there's no reason not to include it in the delivered package, or massage it so that it isn't controversial.

Otherwise you have to observe when the affected files have been updated and apply the patch yourself, in a telnet or WebShell terminal session. Although patch will only apply the patch when the context seems to match, I'd want to see that failing first-hand rather than have it happen blindly. Distribution maintainers may use patch in build scripts but then they know what the source is to which the patches are being applied: it's a way to document their changes.
 
So
... or massage it so that it isn't controversial.

Style-only changes can be added to /mod/webif/html/css/EXTRA.css, which won't be updated. But if the affected page, either its structure or its styles, is significantly modified in a new version the EXTRA styles may become ineffective or actually degrade the display. Really skilled developers like those at the NatWest Bank can make this happen while controlling the entire site and its styles.
 
Thanks all for the responses. @Black Hole 's comment re patching an already patched file sounds like it could be a nightmare and
will only apply the patch when the context seems to match
sounds iffy too. It seems to be a nogo...
I am not sure how many people are using this patch so it I think I will have to remember to reapply it after each WebIf update rather than giving @prpr more headaches :( !

As an aside: Would the bash script I suggested work ? It would be good for my education to know.
 
If what you showed above worked before, then save this
Code:
#!/bin/sh
cd /mod/webif
patch -p1 < /mod/tmp/webif-matthew-combined.patch
to a file in /mod, make it executable as you showed and then run it when necessary.

With the GNU patch you can wrap in the cd and also ask for backups of any changed files patch -d /mod/webif -b -p1 ..., but the -d ... and -b options aren't supported in the busybox patch.

Surely the appropriate way forward for this is for someone, if not actually @Matthew, to make a pull request in the source repository so that reviewers can propose improvements/deletions/etc.
 
Surely the appropriate way forward for this is for someone, if not actually @Matthew, to make a pull request in the source repository so that reviewers can propose improvements/deletions/etc.
Agreed, but I'm several years adrift with updating my own packages;) (i have just restarted) and need to catch up before starting new projects

Perhaps @peterworks would like to get more inolved with actually updating the webif! ;)
 
@/df I did as you suggested in post 8 and created/copied myepg.sh to /MOD but am getting the following:
Code:
HumaxTwo# ls                                                                                                                                             
bin          core         img          lib          myepg.sh     screensaver  ssl          var
boot         etc          include      monitor      sbin         share        tmp          webif
HumaxTwo# chmod a+x myepg.sh                                                                                                                             
HumaxTwo# ls                                                                                                                                             
bin          core         img          lib          myepg.sh     screensaver  ssl          var
boot         etc          include      monitor      sbin         share        tmp          webif
HumaxTwo# myepg.sh                                                                                                                                       
/bin/sh: myepg.sh: not found                                                                                                                             
HumaxTwo# /mod/myepg.sh                                                                                                                                  
/bin/sh: /mod/myepg.sh: not found

Here is myepg.sh (created in Notepad++ and saving as a linux .sh file:
Code:
#!/bin/sh
cd /mod/webif
patch -p1 < /mod/tmp/webif-matthew-combined.patch
What am I doing wrong please ?

(Edited to show code in correct tags)
 
Last edited:
These days you can make console output appear
Code:
like this
using triple backquotes on a line before and after the console or code text (Markdown), equivalent to the [code]like this[/code] BB code tag, where I also used the single Markdown backquote to enclose the in-line example, to which the BB code alternative is [icode] and its / partner.

You can see where the system will look for executables:
Code:
# echo $PATH
/mod/bin:/mod/bin/busybox:/bin:/sbin:/usr/bin
#
This will be different in Maintenance mode, or if the Busybox package isn't installed (dependency of webif and many others, so unlikely).

/mod/bin: "our" programs, installed as packages
/mod/sbin: "our" system tools
/bin: programs installed in the firmware (supposedly, "essential" for running in single-user mode, the startup level at which only the local user could log in)
/sbin: system tools installed in the firmware
/usr/bin: Humax-supplied and other programs installed in the firmware (supposedly, "optional", for the plebs logging in multi-user mode)

In the Humax setup, the system never actually reaches "multi-user" mode, not that it matters, because the settop program takes over as the last startup task.

usr: Unix System [word beginning with "R", like Release or Resources], or maybe a backronym to cover someone at Bell Labs who couldn't be bothered to type the "e" of user. Ken Thompson has form: asked what he would change if he could develop Unix again he said that he would have called the system call to create a file create() instead of creat().
 
I made another version of the patch which incorporates the following additional changes...
  • Added 'system' channel groups (TV, Radio etc.).
  • Fixed long standing bug where the time now cursor would appear on top of an opened programme dialog box.
  • Fixed long standing bug where the time now cursor would stay in the same vertical position when the search area was expanded.
  • Removed the genre colour bars - IMO they made the table look too cluttered.
  • Removed the clock - most web clients will already have a clock somewhere on screen.
  • Removed the jump buttons - they were not that useful, especially in EPG scrolling mode.
I will post it, if anyone is interested.
 
Following the instruction from above I am getting the following:

1) File copied and made executable
Code:
HumaxTwo# cd mod
HumaxTwo# ls
bin          core         img          lib          myepg.sh     screensaver  ssl          var
boot         etc          include      monitor      sbin         share        tmp          webif
HumaxTwo# ls -l
drwxr-xr-x    3 root     root          4096 Dec  3 13:40 bin
lrwxrwxrwx    1 root     root            20 Dec  3 12:17 boot -> /var/lib/humaxtv/mod
drwxrwxrwx    2 root     root          4096 Apr  1  2023 core
drwxr-xr-x    9 root     root          4096 Dec  3 13:56 etc
drwxr-xr-x    2 root     root         57344 Jul 30  2022 img
drwxr-xr-x   12 root     root          4096 Nov 15 04:13 include
drwxr-xr-x    7 root     root          4096 Nov 15 04:13 lib
drwx------    4 root     root          4096 Dec  3 13:56 monitor
-rwxrwxrwx    1 root     root            77 Dec  3 13:53 myepg.sh
drwxr-xr-x    2 root     root          4096 Dec  3 13:39 sbin
drwxr-xr-x    5 root     root          4096 Jul 30  2022 screensaver
drwxr-xr-x    7 root     root          4096 Sep  7  2022 share
drwxr-xr-x    5 root     root          4096 Jul 30  2022 ssl
drwxrwxrwx    4 root     root          4096 Nov 25 18:43 tmp
drwxr-xr-x    7 root     root          4096 Dec  3 13:40 var
drwxr-xr-x    8 root     root          4096 Mar 15  2016 webif
HumaxTwo#

2) Tried to run it and get
Code:
HumaxTwo# ./myepg.sh
/bin/sh: ./myepg.sh: not found
HumaxTwo#

At a loss now :(
 
Attached is the new patch. Note that it must be applied to the unpatched webif.
If you save it on the box in /mod/tmp, then the following can be used to install...
Code:
cd /mod/tmp
unzip webif-matthew-cutdown2.zip
cd /mod/webif
patch -p1 < /mod/tmp/webif-matthew-cutdown2.patch

PS. This is no longer required (since it references the previous patch) but I think the reason why myepg.sh does not run is that it has Windows line endings.
You could convert it using dos2unix /myepg.sh
 

Attachments

  • webif-matthew-cutdown2.zip
    3.4 KB · Views: 4
Just to clarify, for anyone coming new to this, the patch in post 18 implements the following changes to an unpatched webif...
  • Added a moving 'time now' cursor (Matthew).
  • Added a channel selection box (Matthew).
  • Fixed an issue where if the 'EPG Search' header box was expanded the 'time now' cursor would be left behind.
  • If a programme was clicked on, the 'time now' cursor could appear on top of the 'Programme Details' dialogue box. This has been fixed.
  • Added 'TV', 'Radio', 'HD' and 'SD' channel groups.
 
Last edited:
Back
Top