#!/bin/sh
# test we are root
if [ "$(id -u)" != "0" ]; then
   exit 1
fi

# not a compile...if compile v 1.8.3 I would need permission to update node > 18.18

P=browsh
V=1.8.0
USER=`cat /etc/sysconfig/tcuser`
LIST="submitqc "
for Z in $LIST 
    do 
    su -c "tce-load -i $Z" $USER
done

cd /tmp
su -c "/usr/local/bin/wget -nc --no-check-certificate \
https://github.com/browsh-org/browsh/releases/download/v1.8.0/browsh_1.8.0_linux_amd64    " $USER
chown root:root $P*     # its already stripped
chmod 755 $P*

# create tce
######## 
mkdir -p $P/usr/local/bin
mv browsh*64 $P/usr/local/bin/$P
mkdir -p $P/usr/local/share/doc/$P
echo ' LGPL v 2.1' >  $P/usr/local/share/doc/$P/LICENSE

# TCZ them
#######
LIST="$P  "
for Z in $LIST
do
	mksquashfs $Z $Z.tcz
	md5sum $Z.tcz > $Z.tcz.md5.txt
	cd $Z
	find . -not -type d | cut -c 2- | sort > /tmp/$Z.tcz.list
	cd /tmp
done

ls -hal

echo 'Title:          browsh.tcz 
Description:    tty or terminal browser - dep is A firefox as below
Version:        1.8.3
Author:         Thomas Buckley-Houston
Original-site:  https://www.brow.sh/   LIC@ https://github.com/browsh-org/browsh
Copying-policy: LGPL v 2.1
Size:           3.8M		
Extension_by:   aus9 @linuxquestions.org 
Tags:           firefox terminal web browser tty getty
Comments:       For those that suffer slow and/or expensive Internet.

                TCE works by rendering the pages (& videos altho not worth watching) 
                in headless Firefox & then injects multiple scripts including the UTF-8  
                half-block trick to get 2 colors from every character cell, to simulate
                basic graphics. Firefox v57 or newer needs to be loaded & use
                true color terminal.  Otherwise, toggle on  monochrome setting.
                
                No firefox dependency set. Host firefox must be loaded
                but not needed to be open. TCE allow multiple tabs.

                Can also run at the exit prompt. (tty)  But you lose the ability to 
                copy and paste from other applications. I am unable to copy from TCE.

                Optional TCE=vt-color-test for true color test. 
                Recommended TCE=lxterminal for true color PLUS mouse support for paste

                Paste FAILS with context menu terminals, but lxterminal offers mouse clickable 
                pulldown Edit -> paste.  So you can save bookmarks/urls in a text file 
                to copy and paste from.
            
                Keybindings   below CTRL = C (+ means hold C and press other key)
                #######
                F1 Opens the documentation
                arrow keys, PgUp, PgDn =  Scrolling
                Backspace = Go back in history
                C+l = ( lowercase L for London) = input address bar
                C+q =Exit app
                C+r =   Reload page
                C+t =   New tab
                C+w = Close tab
                C+\   = Cycle tabs (Can only cycle left to right but goes back to original to start again)
                Alt + m  toggle on/off to monochrome (no graphics)

                eg C+t  (next) C+l  (input) https://forum.tinycorelinux.net  -> press enter               
              
Change-log:    2024/10/12 v 1.8.0 on 15x
Current:       2024/10/12 ' > $P.tcz.info
# binutils supplies readelf but it can not read this elf!

submitqc --libs
rm -rf *.zsync

