*inbox*: if empty, only bypass *folder* to $MAIL or builtin default
[s-mailx.git] / mk-release.sh
blob5384a6686bd4a76e772c5548fbd19446b6850208
1 #!/bin/sh -
2 #@ mk-release.sh: simple somewhat generic release builder
4 # In order to be able to remove the release scripts from the release tarball,
5 # we must delete them, which some shells may not like while they are running.
6 # So be safe and move instances temporarily to .git/, the .inc will remove them
7 if [ "`basename \`pwd\``" != .git ]; then
8 cp mk-release.sh mk-release.inc .git/
9 cd .git
10 exec sh mk-release.sh
12 cd ..
14 ## Variables
16 : ${PROGRAM:=s-nail}
17 : ${UPROGRAM:=S-nail}
18 : ${UPLOAD:=steffen@sdaoden.eu:/var/www/localhost/downloads}
20 # Mail
21 : ${MAILX:=s-nail}
22 : ${ACCOUNT:=ich}
23 : ${MAILBCC:=mailx-announce-bcc}
24 : ${MAILTO:=mailx-announce}
26 ## Hooks
28 update_stable_hook() {
29 if [ -f nail.1 ]; then
30 < nail.1 > nail.1x awk '
31 BEGIN { written = 0 }
32 /\.\\"--MKREL-START--/, /\.\\"--MKREL-END--/ {
33 if (written++ != 0)
34 next
35 print ".\\\"--MKREL-START--"
36 print ".\\\"@ '"${UPROGRAM}"'(1): v'"${REL}"' / '"${DATE_ISO}"'"
37 print ".Dd '"${DATE_MAN}"'"
38 print ".ds VV \\\\%v'"${REL}"'"
39 print ".\\\"--MKREL-END--"
40 next
42 {print}
43 ' &&
44 mv -f nail.1x nail.1
45 git add nail.1
48 if [ -f nail.rc ]; then
49 < nail.rc > nail.rcx awk '
50 BEGIN { written = 0 }
51 /^#--MKREL-START--/, /^#--MKREL-END--/ {
52 if (written++ != 0)
53 next
54 print "#--MKREL-START--"
55 print "#@ '"${UPROGRAM}"'(1): v'"${REL}"' / '"${DATE_ISO}"'"
56 print "#--MKREL-END--"
57 next
59 {print}
60 ' &&
61 mv -f nail.rcx nail.rc
62 git add nail.rc
66 update_release_hook() {
67 if [ -f nail.1 ]; then
68 sed -E -e '/^\.\\"--MKREL-(START|END)--/d' \
69 -e '/--BEGINSTRIP--/,$ {' \
70 -e '/^\.[[:space:]]*$/d' -e '/^\.[[:space:]]*\\"/d' \
71 -e '}' \
72 -e '/^\.$/d' \
73 < nail.1 > nail.1x
74 mv -f nail.1x nail.1
75 if command -v mdocmx.sh >/dev/null 2>&1; then
76 mdocmx.sh < nail.1 > nail.1x
77 mv -f nail.1x nail.1
79 git add nail.1
82 if [ -f nail.rc ]; then
83 sed -Ee '/^#--MKREL-(START|END)--/d' < nail.rc > nail.rcx
84 mv -f nail.rcx nail.rc
85 git add nail.rc
89 . ./mk-release.inc
91 # s-sh-mode