3 # Gets information from packages to create a checklist for
4 # the installer of Dragora (also know as "tagfiles")
6 # Copyright (c) 2019 Matias Fonzo, <selk@dragora.org>.
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
22 lzip_output
="$(plzip -tvvv $1 2>&1)"
24 # To obtain the uncompressed, compressed size
25 echo $lzip_output |
awk '{ print $8 $10 }' | \
26 while IFS
=, read -r decompressed compressed
28 echo "Decompressed size $(( $decompressed / 1024 ))K, Compressed size $(( ${compressed%.} / 1024 ))K"
34 echo "Deleting any previous (.tmp) tagfile ..."
35 find .
-type f
-name 'tagfile*' -exec rm -f '{}' +
40 # Search all .tlz packages
41 for meta
in $
(find .
-type f
-name '*.tlz')
43 # Ignore some package names
46 echo " ${meta}: Ignored."
50 if test ! -e "${meta}.txt"
52 echo "Error ${meta##*/} does not have a meta tag file." 1>&2
57 directory
=$
(dirname -- "$meta")
58 category
="${directory##*/}"
60 # Determine output level for those series with sub-directories
62 */modules
/* |
*/xorg
/*)
64 parent_level
="$(dirname -- $directory)"
65 parent_level
="$(basename -- $parent_level)"
66 parent_level
=${parent_level}_
70 echo "Extracting information from $meta ..."
74 echo " Adding information to ${output_level}tagfile-${parent_level}${category}.tmp"
75 echo "${pkgname}:${blurb}:ON:Version ${pkgversion} - $(getSize $(basename -- "${meta%.txt}"))" \
76 >> "${output_level}tagfile-${parent_level}${category}.tmp
"
78 unset output_level parent_level
81 echo "Removing temporal tagfile
(s
) and sorting the final ones ...
"
82 for tagfile in ./*/*/tagfile*.tmp
84 LC_COLLATE=C sort -- "$tagfile" > "${tagfile%.tmp}"
85 rm -f -- "$tagfile"; # Delete temporary tagfile.