puppalyzer - like hwinfo, for puppy isos

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
learnhow2code

puppalyzer - like hwinfo, for puppy isos

#1 Post by learnhow2code »

some of you may be able to tell what kind of stuff could be done with this.

feature-wise, this is what it says: version 0.1. its a demo of the concept. i indend for it to have more info / more useful info / more detail / a better overview.

this does require fig if you want to modify its functions but since it is compiled to python, you only need python 2 to run the program.

i wlil list the fig code and attach the html file it outputs:

Code: Select all

#### license: creative commons cc0 1.0 (public domain) 
#### http://creativecommons.org/publicdomain/zero/1.0/ 

proginf="puppalyzer 0.1, jul 2016 mn"


now  split proginf ","  mid 1 1  print  ""  print  

rootfolder "/root"

# create puppisos folder in /root
try
    now rootfolder  chdir  "mkdir puppisos 2> /dev/null"  shell
    now rootfolder  chdir  "mkdir puppisos/mount 2> /dev/null"  shell
except
    now "cant change folder to /root, exiting."  end
    resume

# load array urls with urls of isos
urls "http://distro.ibiblio.org/puppylinux/puppy-2.17.1-nolzma-seamonkey-fulldrivers.iso"  arr
urls plus "http://distro.ibiblio.org/puppylinux/puppy-3.01-seamonkey.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-4.2.1-k2.6.25.16-seamonkey.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-4.3.1/pup-431.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-5.2/lupu-520.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-5.4/slacko-5.4-firefox-4g.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-5.4/slacko-5.4-opera-4g.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-5.4/slacko-5.4-opera-PAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-5.6/slacko-5.6-PAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-5.6/slacko-5.6-4G-NON-PAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-slacko-5.7/slacko-5.7-NO-pae.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-slacko-5.7/slacko-5.7.0-PAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-tahr/iso/tahrpup%20-6.0-CE/tahr-6.0-CE_PAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-tahr/iso/tahrpup%20-6.0-CE/tahr-6.0-CE_noPAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-slacko-6.3.2/32/slacko-6.3.2-uefi.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-slacko-6.3.2/64/slacko64-6.3.2-uefi.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-tahr/iso/tahrpup%20-6.0-CE/tahr-6.0.5_PAE.iso"
urls plus "http://distro.ibiblio.org/puppylinux/puppy-tahr/iso/tahrpup64-6.0.5/tahr64-6.0.5.iso"
urls plus "http://meownplanet.net/puppylinuxstuff/argolance/isos/tooppy_1-0_precise-5.4.3.iso"
urls plus "http://archive.org/download/Puppy_Linux_Precise/precise-5.7.1-retro.iso"
urls plus "http://downloads.sourceforge.net/project/checkmatelxde/Lxpup-13.01/Lxpup_13.01.iso?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fcheckmatelxde%2Ffiles%2FLxpup-13.04%2F&ts=1467655822&use_mirror=tenet"
urls plus "http://distro.ibiblio.org/quirky/racy-5.5/racy-5.5.iso"
urls plus "http://distro.ibiblio.org/quirky/wary-5.5/wary-5.5.iso"
urls plus "http://downloads.sourceforge.net/project/legacyoslinux/Legacy%20OS%202.1%20LTS.iso?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Flegacyoslinux%2Ffiles%2FLegacy%2520OS%25202.1%2520LTS%2520Extra%2520Packages%2F&ts=1467656308&use_mirror=heanet"
urls plus "http://www.smokey01.com/pemasu/DpupSqueeze5X/DpupExprimo5X15/squeeze-5.X.15-SCSI.iso"
urls plus "https://dl.dropboxusercontent.com/u/20943717/yara.iso"

function replace text doublesp sp
    while
       ck instr text doublesp
       iftrue ck
           fix text    split fix doublesp    join fix sp
           text fix
       else 
           now return text
           fig
       wend
    fig

function urf p
    # filename from url
    # ... return whats to the right of the rightmost "/" (or entire string if "/" not found)
    r p  reverse  instr r "/" minus 1
    ifmore r 0
        now p  right r  return now
    else
        now p  return now
        fig
    fig

function parento u
    # parent folder from url
    # ... return whats url with (urf p) changed to ""
    fname  urf u
    now u  replace now fname ""  return now
    fig

# allow one url per iso filename 
# ... take array urls and filter to array uniques
ufiles   arrget urls 1  urf ufiles   arr
uniques  arrget urls 1               arr
forin p urls
    up urf p
    ck  instr ufiles up
    iftrue ck
        pass
    else
        ufiles  plus up
        uniques plus p
        fig
    next
ufiles ""

function quoted p
    # take string, return string in double quotes
    quote 34  chr
    now quote  plus p  plus quote  return now
    fig

function downloadiso u rootfolder
    urfname  urf u
    pname parento u
    now rootfolder  chdir  "puppisos/"  plus urfname  plus "_files"  chdir
    now "downloading folder info..."  print
    now  quoted pname  reverse  plus " -O- q- tegw"  reverse  plus " > folder.txt"  shell
    now "downloaded."  print
    now  quoted u  reverse  plus " tegw"  reverse  shell
    now rootfolder  chdir
    fig

skipdownload 0
forin p uniques
    # create a folder for each iso
    urfname  urf p 
    mfolder  "puppisos/"  plus urfname  plus "_files"  quoted mfolder  reverse  plus " ridkm"  reverse  plus " 2> /dev/null"  shell 

    # check if downloaded
    ckdl2  "puppisos/"  plus urfname  plus "_files"  quoted ckdl2  reverse  plus " sl"  reverse  plus "/*.iso 2> /dev/null | wc -l"         arrshell  mid 1 1  int  
    ckdl   "puppisos/"  plus urfname  plus "_files"  quoted ckdl   reverse  plus " sl"  reverse  plus "/*use_mirror* 2> /dev/null | wc -l"  arrshell  mid 1 1  int  plus ckdl2

    ifequal ckdl 0
        ifless skipdownload 1
            while            
                now "" print
                ifequal skipdownload -1
                    dlnow "y"
                else
                    dlnow p prints " not downloaded."  print  "download now? ([y]es / [n]o / [a]ll / [s]kip downloads) " print  lineinput  lcase ltrim rtrim
                    fig
                ifequal dlnow "s"
                    skipdownload 1
                    break
                    fig 
                ifequal dlnow "n"
                    break
                    fig 
                ifequal dlnow ""
                    break
                    fig 
                ifequal dlnow "a"
                    skipdownload -1
                    now downloadiso p rootfolder
                    break
                    fig 
                ifequal dlnow "y"
                    now downloadiso p rootfolder
                    break
                    fig 
                wend
            fig
        fig    
    
    next

isos rootfolder  chdir  "cd puppisos ; find -type f | egrep '\.iso$|use_mirror' | grep -v '\.txt$'"  arrshell

function shprint info
    arsh info arrshell
    now "<td valign='top'>"  fprint "puppalyzer.htm"
    forin p arsh
        now p  plus "<br>"  fprint "puppalyzer.htm"
        next
    now "</td>"  fprint "puppalyzer.htm"
    fig

function tron
pass
fig

opening "puppalyzer.htm" open "w"

now "<table border=1>"  fprint "puppalyzer.htm"



forin p isos
    now p rtrim  
    ifmore now ""
        purf  urf p
        table "<tr ><td colspan=4>" plus purf plus "</td></tr>"  fprint "puppalyzer.htm"
        table "<tr>"  fprint "puppalyzer.htm"

        isoq now  quoted isoq 
        now "mounting "  plus isoq  print 
        now "cd puppisos ; mount " plus isoq plus " mount -o loop" shell 

        info "cd puppisos/mount && ls ./dists 2> /dev/null" shprint info
        info "cd puppisos/mount && ls -l ./efi.img ./grub.cfg  2> /dev/null" shprint info
        info "cd puppisos/mount && ls -l ./isolinux/isolinux.cfg ./isolinux/menu.cfg ./isolinux.cfg 2> /dev/null" shprint info
        info "cd puppisos/mount && cat -A ./help.msg ./help2.msg  ./help/help.msg  ./help/help2.msg  2> /dev/null | sed 's/\^O0d//g' | sed 's/\^O0c//g' | sed 's/\^O07//g' | sed 's/.\$$//g' | grep pfix" shprint info 
        info "cd puppisos/mount && ls -l ./initrd.gz ./vmlinuz 2> /dev/null" shprint info

        listing "cd puppisos/mount && find | grep -v '^\.\/pool\/main\/' | grep -v '^\.\/doc\/manual\/'" shprint listing 
        #forin item listing
        #    now item rtrim print
        #    next
        now "umount " plus rootfolder plus "/puppisos/mount && echo puppisos/mount unmounted successfully ; echo " shell
        table "</tr>"  fprint "puppalyzer.htm"
        fig
    next


now "</table>"  fprint "puppalyzer.htm"
now "puppalyzer.htm" close
Attachments
puppalyzer.htm.gz
(41.13 KiB) Downloaded 248 times

learnhow2code

Re: puppalyzer - like hwinfo, for puppy isos

#2 Post by learnhow2code »

if you are analyzing the contents of iso files and want to open the .sfs files, here are some guidelines-- of the isos analyzed by puppalyzer so far...


the two debian-based isos contain:

* no .sfs files
* a ./dists folder indicating which version the iso is based on
* a ./pool/main hierachy where packages are stored/listed
* these are standard debian distros/spins, dpup is later in this list.


10 puppy isos (including puppy 2 and 3, and some versions of tahr and slacko) contain:

* 1 .sfs file with a name beginning with "pup"
* 1 .sfs file with a name beginning with "zdrv"


more than 10 puppy isos (including puppy 4.2, 4.3, the squeeze version of dpup, rary, wary and some versions of slacko and lxpup) contain:

* 1 .sfs file with a name beginning with "pup"
* no additional .sfs files


a lupu-based puppy (possibly lupu 5.2x itself) contains:

* 1 .sfs file with a name beginning with "lupu"
* no additional .sfs files


so as a rule its possible that looking for pup*.sfs will not always find the primary .sfs, but it usually will.
Attachments
puppalyzer.htm.gz
includes data on older sfs images too
(48.02 KiB) Downloaded 329 times
puppalyzer03.fig.gz
puppalyzer 0.3 loads older sfs images too
(15.32 KiB) Downloaded 238 times
puppalyzer.htm.gz
(47.43 KiB) Downloaded 222 times
puppalyzer02.fig.gz
(13.64 KiB) Downloaded 270 times

learnhow2code

puppalyzer 0.4

#3 Post by learnhow2code »

0.4 gives folder sizes of both folders in the iso and folders in .sfs images in the iso.

still uses unsquashfs (if found) for older .sfs files, but only gives folder sizes for newer .sfs files.
Attachments
puppalyzer.htm.gz
(64.61 KiB) Downloaded 233 times
puppalyzer04.fig.gz
(16.67 KiB) Downloaded 247 times

Post Reply