#!/bin/sh -exu
# 2013 Marco B Caminati

read srcid
naive=""; recuwarn=""; b=busybox; mtp=/tmp/mtp

me="Marco B. Caminati (caminati.net.tf)"
name="$1"; [ "$name" ] 
sep="-"
osver="$(version)"
today=`date +%Y/%m/%d`

ver="20120701"
description="additional fonts for texlive.tcz"
tags="typesetting/document preparation systems, markup languages TeX LaTeX LuaTeX pdf dvi text print format"
authors="Donald Knuth, Michael Plass, John Hobby, Leslie Lamport, Sebastian Rahtz, Karl Berry, the TeX Users Group and others"
homepage="http://www.tug.org/texlive/"
license="LPPL and GPL2"
deps=""

rmdir $mtp || true
mkdir $mtp
sudo $b mount "${name}" "${mtp}"
(cd ${mtp} && find -mindepth 1 -not -type d| $b sed -e "s_^\./\(.*$\)_\1_" | sort) > ${name}.list
umount "${mtp}"
rmdir "${mtp}"
md5sum ${name} > ${name}.md5.txt
rm -f ${name}.dep
for each in ${deps}; do echo ${each} >> ${name}.dep; done
size=`du -h ${name} | cut -f 1`

cat <<EOF > ${name}.info
Title:		${name}
Description:	${description}
Version:	${ver}
Author:		${authors}
Original-site:	${homepage}
Copying-policy:	${license}
Size:		${size}
Extension_by:	${me}
Tags:		${tags}
Comments:	Roughly the fonts implied by TeXLive's latex-recommended, 
		latexextra (implying pictures), mathextra (implying fontsrecommended), 
		metapost, htmlxml collections and the expressly added 
		(bug in TeXLive installer dependencies?) ulem package.
		TeX font scheme makes packaging and separation harder, see buildscripts.
		I've kept ~/texmf and ~/.texliveXXXX untouched, so that further fonts 
		can be added (on a per-user basis) using texhash and updmap. 
		TODO: correct configuration for binaries (e.g., metapost).
		Built under Core version ${osver} from 
		${srcid}
		available on Original-site.
		${naive}
		${recuwarn}
Change-log:     ----
Current:	${today} version ${ver}
EOF

