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.
20 # USAGE: makeTags [directory]
21 # e.g: makeTags i586/tools
27 lzip_output
="$(plzip -tvvv "$1" 2>&1)"
29 # To obtain the uncompressed, compressed size
30 echo $lzip_output |
awk '{ print $8 $10 }' | \
31 while IFS
=, read -r decompressed compressed
33 echo "Decompressed size $(( $decompressed / 1024 ))K, Compressed size $(( ${compressed%.} / 1024 ))K"
40 searchpath
="${searchpath:-.}"
42 echo "Deleting any previous (.tmp) tagfile ..."
43 find $searchpath -type f
-name 'tagfile*' -exec rm -f '{}' +
47 # Search all .tlz packages
48 for meta
in $
(find $searchpath -type f
-name '*.tlz')
50 # Ignore some package names
53 echo " ${meta}: Ignored."
57 if test ! -e "${meta}.txt"
59 echo "Error ${meta##*/} does not have a meta tag file." 1>&2
64 directory
=$
(dirname -- "$meta")
65 category
="${directory##*/}"
67 # Determine output level for those series with sub-directories
69 */modules
/* |
*/xorg
/*)
71 parent_level
="$(dirname -- $directory)"
72 parent_level
="$(basename -- $parent_level)"
73 parent_level
=${parent_level}_
77 echo "Extracting information from $meta ..."
81 echo " Adding information to ${output_level}tagfile-${parent_level}${category}.tmp"
82 echo "${pkgname}:${blurb}:ON:Version ${pkgversion} - $(getSize $(basename -- "${meta%.txt}"))" \
83 >> "${output_level}tagfile-${parent_level}${category}.tmp
"
85 unset output_level parent_level
88 echo "Removing temporal tagfile
(s
) and sorting the final ones ...
"
89 for tagfile in ./*/*/tagfile*.tmp
91 LC_COLLATE=C sort -- "$tagfile" > "${tagfile%.tmp}"
92 rm -f -- "$tagfile"; # Delete temporary tagfile.