GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — hithesis/make_release_pkg.sh at master · hithesis/hithesis

Expand file tree

/

make_release_pkg.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
164 lines (146 loc) · 7.18 KB
/

make_release_pkg.sh

Copy path

File metadata and controls

executable file
·
164 lines (146 loc) · 7.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/env bash
# Package hithesis example templates into per-variant folders for release.
#
# Produces (under dist/):
# <variant>.zip # one zip per template, version-independent name
# hithesis-examples.zip # all templates in one zip, version-independent
# hithesis-examples.zip.md5 # checksum of the combined zip
# MD5SUMS # checksums of every *.zip
#
# Variants (the folder inside each <variant>.zip is <variant>-<version>):
# chinese-<campus>-<type> (12)
# english-<campus>-<type> (12)
# reports-<campus>-<type>-<stage> (17)
# reportplus-shenzhen-doctor-midterm (1)
#
# Zip names are version-independent so that
# https://github.com/hithesis/hithesis/releases/latest/download/<name>.zip
# always points at the newest release, letting the GitHub Page stay static.
#
# Usage: bash make_release_pkg.sh <version> # e.g. v3.2.1
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VERSION="${1:?usage: $0 <version>}"
STAGE_DIR="${ROOT}/dist"
DIST_DIR="${STAGE_DIR}/hithesis-examples"
rm -rf "${STAGE_DIR}"
mkdir -p "${DIST_DIR}"
# Runtime files generated by hithesis.ins into the repo root; hithesis.ins no
# longer writes into examples/, so copy them here to keep each release zip
# self-contained. Run `make cls` (or `latex hithesis.ins`) before this script.
[ -f "${ROOT}/hithesisbook.cls" ] || {
echo "error: hithesisbook.cls not found; run 'make cls' first" >&2
exit 1
}
HITBOOK_RUNTIME="hithesisbook.cls hithesisbook.cfg hithesis.sty hithesis.bst hitszthesis.bst hithesis-logo.eps hithesis-bthesistitle.eps hithesis-shenzhenbthesistitle.eps hithesis-zfb.eps hithesis-hrb-bachelor-bottommark.eps"
CHINESE_EXTRA="hithesis.ist"
REPORTS_RUNTIME="hithesisart.cls hithesisart.cfg hithesis.bst hitszthesis.bst hithesis-logo.eps hithesis-bthesistitle.eps hithesis-zfb.eps hithesis-hrb-bachelor-bottommark.eps"
REPORTPLUS_RUNTIME="hithesisartplus.cls hithesisart.cfg hithesis.bst hitszthesis.bst hithesis-logo.eps hithesis-bthesistitle.eps hithesis-zfb.eps"
# copy_runtime <folder> <file...> -- copy runtime files (plus the golfer demo
# figure into figures/) into an example folder.
copy_runtime() {
local folder="$1"; shift
local f
for f in "$@"; do
cp -a "${ROOT}/${f}" "${DIST_DIR}/${folder}/${f}"
done
mkdir -p "${DIST_DIR}/${folder}/figures"
cp -a "${ROOT}/hithesis-golfer.eps" "${DIST_DIR}/${folder}/figures/hithesis-golfer.eps"
}
# package <src-dir> <main-tex> <stable-name> <type> <campus> [<stage>]
# Copies the example source into dist/hithesis-examples/<stable-name>-<version>,
# copies the runtime files, rewrites the \documentclass options, then strips
# build artifacts.
package() {
local src="$1" main_tex="$2" dst="$3" type="$4" campus="$5" stage="${6:-}"
local folder="${dst}-${VERSION}"
cp -a "${ROOT}/${src}" "${DIST_DIR}/${folder}"
case "${src}" in
examples/hitbook/chinese)
copy_runtime "${folder}" ${HITBOOK_RUNTIME} ${CHINESE_EXTRA} ;;
examples/hitbook/english)
copy_runtime "${folder}" ${HITBOOK_RUNTIME} ;;
examples/hitart/reports)
copy_runtime "${folder}" ${REPORTS_RUNTIME} ;;
examples/hitart/reportplus)
copy_runtime "${folder}" ${REPORTPLUS_RUNTIME} ;;
esac
local tex="${DIST_DIR}/${folder}/${main_tex}"
# Values are matched as "any run of chars that are not `]`, `,` or `}`" so
# that the option being the last one before `]{...}` does not swallow the
# class name (e.g. `campus=harbin]{hithesisbook}`).
sed -i \
-e "s/type=[^],}]*/type=${type}/" \
-e "s/campus=[^],}]*/campus=${campus}/" \
-e "s/stage=[^],}]*/stage=${stage}/" \
"${tex}"
# Strip AUCTeX auto/ dirs (and any stray *.el files).
find "${DIST_DIR}/${folder}" -type d -name auto -prune -exec rm -rf {} + 2>/dev/null || true
# Strip LaTeX build artifacts.
find "${DIST_DIR}/${folder}" -type f \( \
-name '*.aux' -o -name '*.log' -o -name '*.out' -o -name '*.toc' \
-o -name '*.bbl' -o -name '*.blg' -o -name '*.idx' -o -name '*.ind' \
-o -name '*.ilg' -o -name '*.glo' -o -name '*.gls' -o -name '*.glg' \
-o -name '*.thm' -o -name '*.toe' -o -name '*.hd' \
-o -name '*.fdb_latexmk' -o -name '*.fls' -o -name '*.synctex.gz' \
-o -name '*.xdv' -o -name '*.vrb' -o -name '*.lof' -o -name '*.lot' \
-o -name '*.loe' -o -name '*.el' -o -name '*.run.xml' -o -name '*.bcf' \
\) -delete
# Compiled PDFs, but keep the placeholder scan empty-resolution.pdf.
find "${DIST_DIR}/${folder}" -type f -name '*.pdf' ! -name 'empty-resolution.pdf' -delete
# Stray makeindex/splitindex style copies.
find "${DIST_DIR}/${folder}" -type f \( -name 'thesis.ist' -o -name 'report.ist' \) -delete
}
# ---------------------------------------------------------------------------
# hitbook: chinese / english (hithesisbook)
# type = doctor | master | bachelor | postdoc
# campus = shenzhen | weihai | harbin
# ---------------------------------------------------------------------------
for lang in chinese english; do
for campus in shenzhen weihai harbin; do
for type in doctor master bachelor postdoc; do
package "examples/hitbook/${lang}" "thesis.tex" \
"${lang}-${campus}-${type}" "${type}" "${campus}"
done
done
done
# ---------------------------------------------------------------------------
# hitart: reports (hithesisart)
# type = doctor | master | bachelor
# stage = opening | midterm
# campus = shenzhen | weihai | harbin
# hithesisart does NOT support doctor+midterm+shenzhen -> that goes to
# hithesisartplus below.
# ---------------------------------------------------------------------------
for campus in shenzhen weihai harbin; do
for type in doctor master bachelor; do
for stage in opening midterm; do
if [ "${type}" = doctor ] && [ "${stage}" = midterm ] && [ "${campus}" = shenzhen ]; then
continue
fi
package "examples/hitart/reports" "report.tex" \
"reports-${campus}-${type}-${stage}" "${type}" "${campus}" "${stage}"
done
done
done
# ---------------------------------------------------------------------------
# hitart: reportplus (hithesisartplus) — only doctor+midterm+shenzhen
# ---------------------------------------------------------------------------
package "examples/hitart/reportplus" "report.tex" \
"reportplus-shenzhen-doctor-midterm" doctor shenzhen midterm
# ---------------------------------------------------------------------------
# zip: one per variant (stable name) + one combined (stable name) + checksums
# ---------------------------------------------------------------------------
for folder in "${DIST_DIR}"/*/; do
folder="${folder%/}"
name="${folder#"${DIST_DIR}"/}" # e.g. chinese-harbin-doctor-v3.2.1
stable="${name%-${VERSION}}" # e.g. chinese-harbin-doctor
( cd "${DIST_DIR}" && zip -r "${STAGE_DIR}/${stable}.zip" "${name}" )
done
( cd "${STAGE_DIR}" && zip -r "hithesis-examples.zip" "hithesis-examples" )
( cd "${STAGE_DIR}" && md5sum "hithesis-examples.zip" > "hithesis-examples.zip.md5" )
( cd "${STAGE_DIR}" && md5sum *.zip > MD5SUMS )
echo "Created ${STAGE_DIR}:"
ls "${STAGE_DIR}"/*.zip | sed "s#${STAGE_DIR}/##" | sort
echo
echo "Total zips: $(ls "${STAGE_DIR}"/*.zip | wc -l)"
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.