3 parms
=1 # How many parameters must it have?
4 usage
="Usage: pod COMMAND [PARM]
5 Action: pod is a collection of quick and dirty little scripts that aid
8 mkdist: PARM = destination_directory
10 Make tarballs of the system's build scripts, installed files, patches,
11 uninstall scripts, tarballs, and cloning execs, i.e. what we need to
12 write a release candidate CD/DVD.
14 rename: PARM = pkg-now pkg-new
16 Renames a pod package in build scripts, pio uninstall and backup files,
17 then fixes-up dependencies.
21 Fixes timestamps on pio's uninstall scripts to match the time its
22 header says it was run.
26 List the POD built packages, i.e. omit the LFS packages.
30 List the LFS built packages, i.e. omit the POD packages.
32 collect: PARM = package_name
34 Collect a package's uninstall script, installed files, build script, and
35 source tarball into one tarball useful for updates
37 chkup: PARM = collection1 [collection2 ... collectionN]
39 Go through a collected update looking for the updated files.
43 Cross reference dependencies on stdout.
44 pkg1 requires pkg2: pkg1 ==> pkg2
46 pkg1 uses pkg2: pkg1 --> pkg2
57 echo "No destination given"
62 echo "Compressing pio scripts"
63 tar -czpf $1/pio.tgz pio
/*-* --exclude=kernel\
*
65 echo "Tarballing asbuilt binaries"
66 tar -cpf $1/backups.
tar backups
/ --exclude=kernel\
*
68 echo "Compressing patches"
69 tar -czpf $1/patches.tgz patches
/
70 echo "Compressing build scripts"
71 tar -czpf $1/scripts.tgz
scripts
/
72 echo "Tarballing source tarballs"
73 tar -cpf $1/tarballs.
tar tarballs
/
74 # Sometimes this may have been moved around
75 ex
=`find / -xdev -type d -name execs`
79 echo "Compressing execs at " $ex
80 tar -czpf $1/execs.tgz execs
82 echo "execs directory not found"
90 mv /usr
/local
/src
/scripts
/$1 \
91 /usr
/local
/src
/scripts
/$2
92 # rename as-installed backup
93 mv /usr
/local
/pio
/backups
/$1.tgz \
94 /usr
/local
/pio
/backups
/$2.tgz
95 # rename the removal script
96 mv /usr
/local
/pio
/$1 \
98 # change references in pio scripts
99 # (catch self-reference, and dependencies in others)
100 for fn
in `ls /usr/local/pio/*-*` # avoid backups/
102 grep -q $1 $fn # sets return code 0 when found
103 if [ $?
-eq 0 ]; then
106 sed -i 's/'$1'/'$2'/' $fn # $1 & $2 are exposed for substitution
112 echo "Now and new names not given"
116 for i
in `ls /usr/local/pio/*-*`
119 touch -t `gawk '/# created by/{
133 printf("%4d%02d%02d%02d%02d.%02d",$14,month[$10],$11,time[1],time[2],time[3]) }' $i` $i
137 ls /usr
/local
/pio
/ |\
139 awk -F- '{OFS="-";print $3, $4, $5, $6, $7}' |\
140 sed -e 's/---$//' -e 's/--$//' -e 's/-$//' |\
145 ls /usr
/local
/pio
/ |\
147 awk -F- '{OFS="-";print $3, $4, $5, $6, $7}' |\
148 sed -e 's/---$//' -e 's/--$//' -e 's/-$//' |\
154 echo "No package name given"
156 # pull apart argument
157 wg
=${1#*-} # without group
158 ws
=${wg#*-} # without group & sequence number
159 wv
=${ws%-*} # without version
160 vn
=${ws##*-} # version number
161 src
=`find /usr/local/src/tarballs -iname "${ws}*" -print`
162 # if it's null, i.e. not found, try with "_" replaced by "-"
163 # duplicates ARE possible, quote it
164 if [ ! "$src" ]; then
166 src
=`find /usr/local/src/tarballs -iname "${tr}*" -print`
168 # list of patches in the build script
169 patches
=`grep "../patches" /usr/local/src/scripts/$1 | \
171 sed 's:patch -Np1 -i ..:/usr/local/src:'`
174 /usr
/local
/pio
/backups
/${1}.t
* \
175 /usr
/local
/src
/scripts
/$1 \
181 tempfile
=`mktemp -p /var/run` # in a tempfs
184 tar tvPf
$1 >$tempfile
185 while read tarred_file
187 tarred_data
=`echo $tarred_file|cut -d " " -f 3-6`
188 fn
=${tarred_data##*" "}
189 current_data
=`ls -l --time-style=long-iso $fn|cut -d " " -f 5-8`
190 if [ "$tarred_data" = "$current_data" ]; then
194 echo "Update:"$tarred_data # It's hard for me to suggest what
195 echo "Active:"$current_data # the fix would be, easy for you.
206 awk '/requires/ {print $1,"==>",$3,"\n" $3,"<==", $1}' <$i >$o
207 awk '/uses/ {print $1,"-->",$3,"\n" $3,"<--",$1}' <$i >>$o
208 sort <$o|
column -c 3 -t
212 echo "unknown command:" $command
220 --help) echo "$usage"
223 if [ $# -ge $parms ]; then