File: buildManpage.sh

package info (click to toggle)
buskill 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 30,984 kB
  • sloc: python: 3,187; sh: 85; makefile: 22; javascript: 9
file content (61 lines) | stat: -rwxr-xr-x 1,758 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
set -x
################################################################################
# File:    buildManpage.sh
# Purpose: Script that converts manpage.rst (in reStructuredText format) into
#          buskill.1 (in groff format)
#
# Authors: Michael Altfield <michael@buskill.in>
# Created: 2022-12-12
# Updated: 2022-12-12
# Version: 0.1
################################################################################

################################################################################
#                                  SETTINGS                                    #
################################################################################

SUDO=$(which sudo)

pwd
env
ls -lah
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
DATE=$(date "+%b %Y" --date="@${SOURCE_DATE_EPOCH}")
HEADER="Laptop Kill Cord"

################################################################################
#                                 MAIN BODY                                    #
################################################################################

#################
# SANITY CHECKS #
#################

# this script isn't robust enough
if [ ! -e "`pwd`/docs/$(basename $0)" ]; then
	echo "ERROR: This script should only be executed from the root of the github dir."
	exit 1
fi

###################
# INSTALL DEPENDS #
###################

${SUDO} apt-get update
${SUDO} apt-get -y install pandoc

PANDOC=$(which pandoc)

#################
# BUILD MANPAGE #
#################

${PANDOC} -s -t man --variable header="${HEADER}" --variable date="${DATE}" --variable footer="${FOOTER}" docs/software_usr/manpage.rst -o "docs/buskill.1"

##################
# CLEANUP & EXIT #
##################

# exit cleanly
exit 0