WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Request help for TCZ build script to build 17 TCZs in one script  (Read 2938 times)

aus9

  • Guest
I have a number of tczs to build within one build script.

My old simple way has the formula---where $I and the other letters are defined earlier

Code: [Select]
mksquashfs $I $I.tcz
md5sum $I.tcz > $I.tcz.md5.txt
cd $I
find usr -not -type d > $I.tcz.list
mv $I.tcz.list /tmp

but as a simple coder, it might be useful for my fav tcz checker that I don't have 17 such strings.

Can anyone point me to a good example of how to do it smarter with a loop or whatever you gurus use please?

thanks for reading

##### trivia

foomatic-db is a massive download, and instead of building a massive TCZ I plan to submit a TCZ for each open source PPD manufacturer. That way, a user may elect to read an info file and the link on what actual models are in side the tcz and then if a match download just that smaller TCZ.
« Last Edit: May 21, 2013, 09:11:55 PM by aus9 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11179
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #1 on: May 20, 2013, 07:02:30 PM »
Hi aus9
Create a file called tczs.list containing the names you wish to process. Then you can do:
Code: [Select]
for I in `cat tczs.list`
do
    mksquashfs $I $I.tcz
    md5sum $I.tcz > $I.tcz.md5.txt
    cd $I
    find usr -not -type d > $I.tcz.list
    mv $I.tcz.list /tmp
done

aus9

  • Guest
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #2 on: May 21, 2013, 02:14:52 AM »
great stuff, I will try that out tomorrow after I check on the other stuff I need to do

cheers

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11179
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #3 on: May 21, 2013, 07:49:34 AM »
Hi aus9
As it stands right now, you will need to add a  cd../  between the  mv  and  done  lines.

aus9

  • Guest
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #4 on: May 21, 2013, 04:35:02 PM »
Hi

Do you mean?

Code: [Select]
for I in `cat tczs.list`
do
    mksquashfs $I $I.tcz
    md5sum $I.tcz > $I.tcz.md5.txt
    cd $I
    find usr -not -type d > $I.tcz.list
    mv $I.tcz.list /tmp
    cd ../
done

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11179
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #5 on: May 21, 2013, 04:58:36 PM »
Hi aus9
Yes, like that.

aus9

  • Guest
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #6 on: May 21, 2013, 06:11:03 PM »
well I am trying now to convert that into a inbuilt list, fragments only to give the idea

Quote
A=Brother
B=Epson
C=Gestetner

LIST=A B C D E F G H I J K L M N O P Q

for Z in $LIST
do
    mksquashfs $Z $Z.tcz
    md5sum $Z.tcz > $Z.tcz.md5.txt
    cd $Z
    find usr -not -type d > $Z.tcz.list
    mv $Z.tcz.list /tmp
    cd /tmp
done

I am trying to do it manually at this stage, copy and paste each section and it fails

Code: [Select]
root@box:/tmp# A=Brother
root@box:/tmp# B=Epson
root@box:/tmp# C=Gestetner
root@box:/tmp# D=HP
root@box:/tmp# E=InfoPrint
root@box:/tmp# F=Infotec
root@box:/tmp# G=KONICA_MINOLTA
root@box:/tmp# H=Kyocera
root@box:/tmp# I=Lanier
root@box:/tmp# J=Lexmark
root@box:/tmp# K=NRG
root@box:/tmp# L=Oce
root@box:/tmp# M=Oki
root@box:/tmp# N=Samsung
root@box:/tmp# O=Savin
root@box:/tmp# P=Sharp
root@box:/tmp# Q=Toshiba
root@box:/tmp# VVV=foomatic-db
root@box:/tmp# SRC=foomatic-db-2013*
root@box:/tmp#
root@box:/tmp# LIST=A B C D E F G H I J K L M N O P Q
sh: B: not found

So am I forced to use an external list or am I missing something in my coding skills?

I am cheating off, but not very well the foomatic-db internal list

Quote
# List of user-selected driver XMLs to install
DRIVERXMLS=Postscript-Brother.xml Postscript-Epson.xml Postscript-Gestetner.xml (list culled by me its big)

( cd db/source/driver/; \
     for d in $(DRIVERXMLS); do \
       cp $$d $(DESTDIR)$(LIBDIR)/db/source/driver; \
     done )


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11179
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #7 on: May 21, 2013, 06:23:41 PM »
Hi aus9
I think you may need to do something like:
Code: [Select]
LIST="$A $B $C $D $E $F"

aus9

  • Guest
Re: Request help for TCZ build script to build 17 TCZs in one script
« Reply #8 on: May 21, 2013, 09:11:36 PM »
Rich

Thats it!  Woo hoo

Marked as solved.....thanks heaps

Now to tidy up the script etc

##########

in case other simple coders drop by it now reads.....fragments only to keep list short

Code: [Select]
#!/bin/sh

# do stuff

A=Brother
B=Epson
C=Gestetner
# etc

LIST="$A $B $C $D $E $F $G $H $I $J $K $L $M $N $O $P $Q"

# do stuff

for Z in $LIST
do
    mksquashfs $Z $Z.tcz
    md5sum $Z.tcz > $Z.tcz.md5.txt
    cd $Z
    find usr -not -type d > $Z.tcz.list
    mv $Z.tcz.list /tmp
    cd /tmp
done

# do stuff