WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: view repository info.lst and display already downloaded + loaded tcz extentions  (Read 2670 times)

Offline mocore

  • Hero Member
  • *****
  • Posts: 641
  • ~.~
this post was a large part of the inspiration/motivation for this script
1. With "Load local", I am using a standard FLTK widget that just so happens to offer "favorites" where you can create a shortcut to selecting a file. I my drop that standard widget and just reuse some of my existing code. That way, I could display only "not already loaded" extensions that would be more practical and consistent with the rest of the layout.
...

i have imagined at times that it would be a good thing to see
what extensions all ready down loaded
and after coming a cross the above quote
 it seems to make seance to see
what extensions are loaded as well as down loaded


the script needs less.tcz to display colours  (to use it without less it needs modification)
and it will also download info.lst
i have only used it on 4.x
Code: [Select]
#!/bin/sh
. /etc/init.d/tc-functions
tcz_path="/etc/sysconfig/tcedir/optional"
tcz_installed="/usr/local/tce.installed"
 # is less instaled
 if [ ! -f /usr/local/tce.installed/less ] ; then
   tce-load -iw less
 fi

 # is info.lst avalible
 if [ ! -f /etc/sysconfig/tcedir/info.lst ] ; then
   url=`cat /opt/tcemirror`
   v=`version` ;v=${v:0:1}

   tc4x="/x86/tcz/info.lst"
   tcX="/tcz/info.lst"

   if [ "${v:0:1}" = "4" ] ; then
     u="$url""$v"".x""$tc4x"
    else
     u="$url""$v"".x""$tcX"
     tcz_path=`cat /opt/.tcedir`/optonal
   fi

   dir="/etc/sysconfig/tcedir/"
   wget -P $dir $u
 fi


info_file='info.lst'
  # cat $info_file |less -r
info=`cat $info_file`
 #
tmp_info=''
already_downloaded=''
not_already_downloaded=''

# do stuff
for i in $info
 do
  if [ ! -f $tcz_path/$i ] ; then
       # extentions in repository
       #echo " >$i"

   tmp_info="$tmp_info
${NORMAL}  > $i"

   not_already_downloaded="$not_already_downloaded
${NORMAL}  > $i"

  else
       # extentions downloaded
       #echo "< ${GREEN}$i${NORMAL}"
       tmp_string="<   ${GREEN}$i${NORMAL}"
       # extentions loaded
       if [ -f $tcz_installed/${i%.*} ] ; then
        tmp_string="<${YELLOW}!  ${GREEN}$i${YELLOW}!${NORMAL}"
       fi
   tmp_info="$tmp_info
$tmp_string"
   already_downloaded="$already_downloaded
$tmp_string"

  fi
 done


# show all
 echo "$tmp_info"|less -r

# show local only (loaded&notloaded)
  #echo "$already_downloaded" |less -r
# show remote only
  #echo "$not_already_downloaded" |less -r

hears is quick key
<    downloaded
<!   downloaded +loaded
   > not downloaded 
and a screenshot

#^ April 16, 2012
 # ----
edit see also tce-status
http://goosh.org/#site%20tinycorelinux.net%20tce-status !
« Last Edit: April 25, 2013, 08:25:27 AM by dubcore »