#!/bin/sh
# This is a shell archive
echo x discus
mkdir -p discus > /dev/null 2>&1
echo x discus/distinfo
sed 's/^X//' > discus/distinfo << 'SHAR_END'
XTIMESTAMP = 1619608755
XSHA256 (ncarrier-discus-0.4.0_GH0.tar.gz) = bf9b9e94da6751a9b9f849b44d65cd7809e5d4814ac24f67353c70f09f743485
XSIZE (ncarrier-discus-0.4.0_GH0.tar.gz) = 16392
SHAR_END
echo x discus/Makefile
sed 's/^X//' > discus/Makefile << 'SHAR_END'
XPORTNAME=	discus
XDISTVERSION=	0.4.0
XCATEGORIES=	sysutils
X
XMAINTAINER=	freebsd@ny-central.org
XCOMMENT=	Discus is a program to display hard drive space usage
X
XLICENSE=	GPLv2
X
XUSES=		python:3.6+ shebangfix
XUSE_GITHUB=	yes
XGH_ACCOUNT=	ncarrier
X
XSHEBANG_FILES=	discus.py
X
XDOCSDIR=	${PREFIX}/share/doc/discus
XNO_BUILD=	yes
X
XOPTIONS_DEFINE=	DOCS
X
Xdo-install:
X	${MKDIR} ${STAGEDIR}/${ETCDIR}/
X	${MKDIR} ${STAGEDIR}/${DOCSDIR}
X	${MKDIR} ${STAGEDIR}/${PREFIX}/sbin
X	${INSTALL_DATA} ${WRKSRC}/discusrc ${STAGEDIR}/${ETCDIR}/discusrc.sample
X	${INSTALL_MAN} ${WRKSRC}/discus.1 ${STAGEDIR}/${MANPREFIX}/man/man1
X	${INSTALL_SCRIPT} ${WRKSRC}/discus.py ${STAGEDIR}/${PREFIX}/sbin/discus
X
Xdo-install-DOCS-on:
X	${INSTALL_MAN} ${WRKSRC}/README.md ${STAGEDIR}/${DOCSDIR}
X	${INSTALL_MAN} ${WRKSRC}/AUTHORS ${STAGEDIR}/${DOCSDIR}
X
X.include <bsd.port.mk>
SHAR_END
echo x discus/pkg-plist
sed 's/^X//' > discus/pkg-plist << 'SHAR_END'
X@sample %%ETCDIR%%/discusrc.sample
Xman/man1/discus.1.gz
Xsbin/discus
X%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
X%%PORTDOCS%%%%DOCSDIR%%/README.md
SHAR_END
echo x discus/files
mkdir -p discus/files > /dev/null 2>&1
echo x discus/pkg-descr
sed 's/^X//' > discus/pkg-descr << 'SHAR_END'
XDiscus is a program to display hard drive space usage, much like the standard
XUNIX command df.
X
XDiscus aims to make df(1) prettier. Features include color, bar graphs, and
Xsmart formatting of numbers (automatically choosing the most suitable size
Xfrom kilobytes, megabytes, gigabytes, or terabytes). Or choose your own size,
Xalong with specifying the number of decimal places you'd like to see.
X
XTo configure Discus on a system-wide basis, edit the /usr/local/etc/discusrc
Xfile. But you should probably change things just for yourself, by copying
X/usr/local/etc/discusrc to ~/.discusrc and editing that.
X
XWWW: https://github.com/ncarrier/discus
SHAR_END
echo x discus/files/patch-discus.1
sed 's/^X//' > discus/files/patch-discus.1 << 'SHAR_END'
X--- discus.1.orig	2020-04-13 07:05:40 UTC
X+++ discus.1
X@@ -2,7 +2,7 @@
X .\" DISCUS
X .\" 1
X .\" other parameters are allowed: see man(7), man(1)
X-.TH DISCUS 1 "October 20, 2003"
X+.TH DISCUS 1 "April 26, 2021"
X .\" Please adjust this date whenever revising the manpage.
X .\"
X .\" Some roff macros, for reference:
X@@ -26,9 +26,8 @@ discus \- print a report of disk space usage
X and smart formatting of numbers (automatically choosing the most suitable
X size from kilobytes, megabytes, gigabytes, or terabytes). Or choose your
X own size, along with specifying the number of decimal places you'd like to
X-see. You may also copy /etc/discusrc to $HOME/.discusrc and customize things to
X-your preference.
X-
X+see. You may also copy /usr/local/etc/discus/discusrc to $HOME/.discusrc and 
X+customize things to your preference.
X .SH OPTIONS
X .TP
X .B \-h, \-\-help
X@@ -56,14 +55,15 @@ Show version of program.
X .B \-r
X Takes into account even the reserved space to root; it will be counted in percentage and in available columns only (Used is for real used space).
X .SH FILES
X-.SH FILES
X-.BR /etc/discusrc,
X+.BR /usr/local/etc/discus/discusrc,
X .BR $HOME/.discusrc
X .SH SEE ALSO
X-.BR df (1),
X-.BR pydf (1).
X+df(1)
X .br
X .SH AUTHOR
X This manual page was adapted by Ron Farrer <rbf@debian.org> from one
X written by Stormy Henderson <stormy@raincrazy.com> for the Debian
X GNU/Linux system (but may be used by others).
X+
X+This manual page was later updated by Chris Moerz <freebsd@ny-central.org>
X+for FreeBSD.
SHAR_END
echo x discus/files/patch-README.md
sed 's/^X//' > discus/files/patch-README.md << 'SHAR_END'
X--- README.md.orig	2021-04-26 14:05:27 UTC
X+++ README.md
X@@ -11,9 +11,9 @@ Features include color, bar graphs, and smart formatti
X gigabytes, or terabytes). Or choose your own size, along with specifying the
X number of decimal places you'd like to see.
X 
X-To configure Discus on a system-wide basis, edit the **/etc/discusrc** file.
X+To configure Discus on a system-wide basis, edit the **/usr/local/etc/discusrc** file.
X But you should probably change things just for yourself, by copying
X-**/etc/discusrc** to **~/.discusrc** and editing that.
X+**/usr/local/etc/discusrc** to **~/.discusrc** and editing that.
X 
X The source code is contained in the discus.py file itself, as it is a Python
X code encapsulated in a shell script.
X@@ -52,13 +52,14 @@ for more information.
X ## Installation
X 
X ```
X-cp discus.py /usr/local/bin
X-chmod a+rx /usr/local/bin/discus
X-cp discusrc /etc
X-chmod a+r /etc/discusrc
X-gzip -9 discus.1
X-cp discus.1.gz /usr/local/man/man1
X-chmod a+r /usr/local/man/man1/discus.1.gz
X+pkg install discus
X+```
X+
X+or
X+
X+```
X+cd /usr/ports/sysutils/discus
X+make install; make clean
X ```
X 
X ## Test
SHAR_END
echo x discus/files/patch-discusrc
sed 's/^X//' > discus/files/patch-discusrc << 'SHAR_END'
X--- discusrc.orig	2021-04-27 15:52:50 UTC
X+++ discusrc
X@@ -17,11 +17,6 @@ opts["graph"] = 1
X opts["graph_char"] = "*"
X opts["graph_fill"] = "-"
X 
X-##  Example mtab entry that uses a shell command (always use a ! as
X-##  first character) rather than a file:
X-##	opts["mtab"] = "!/bin/mount |awk '{print $1, $3}'"
X-opts["mtab"] = "/etc/mtab"
X-
X ##  Number of decimal places to display, same as -p
X opts["places"] = 1
X 
X@@ -30,10 +25,6 @@ opts["skip_list"] = ["/dev/pts", "/proc", "/dev", "/pr
X 
X ##  Use smart formatting of numbers.
X opts["smart"] = 1
X-
X-##  Location of stat program in lieu of Python's statvfs module.
X-# Deprecated starting from version 0.3.0
X-#opts["stat_prog"] = "stat -ft"
X 
X ##  These colors should work on VT100-type displays.  Change them if you use
X ##  something else.
SHAR_END
echo x discus/files/patch-discus.py
sed 's/^X//' > discus/files/patch-discus.py << 'SHAR_END'
X--- discus.py.orig	2020-04-13 07:05:40 UTC
X+++ discus.py
X@@ -437,16 +437,8 @@ def read_mounts(mtab, skip_list):
X     """Read the mounts file."""
X     mounts = []
X 
X-    # If the first letter of the mtab file begins with a !, it is a
X-    # shell command to be executed, and not a file to be read.  Idea
X-    # provided by John Soward.
X-    if mtab[0] == "!":
X-        mtab = subprocess.getoutput(mtab[1:])
X-        mtab = str.split(mtab, "\n")
X-    else:
X-        fp = open(mtab)
X-        mtab = fp.readlines()
X-        fp.close()
X+    mtab = subprocess.getoutput('/sbin/mount -p')
X+    mtab = str.split(mtab, "\n")
X 
X     # Extract the mounted filesystems from the read file.
X     for entry in mtab:
X@@ -534,7 +526,7 @@ def get_layout(headers, reports):
X def main():
X     """Define main program."""
X     parse_options()
X-    mounts = read_mounts(opts["mtab"], opts["skip_list"])
X+    mounts = read_mounts(None, opts["skip_list"])
X     headers = get_header(opts["graph"])
X     stats_factory = StatsFactory(opts["reserved"])
X     size_formatter = SizeFormatter(opts["smart"], opts["placing"],
X@@ -559,13 +551,13 @@ def main():
X 
X if __name__ == "__main__":
X     # Before starting, we need to load the configuration files which
X-    # contain global objects.  First the global /etc file, then the user's
X+    # contain global objects.  First the global /usr/local/etc file, then the user's
X     # file, if exists.
X     try:
X-        exec(compile(open("/etc/discusrc", "rb").read(), "/etc/discusrc",
X+        exec(compile(open("/usr/local/etc/discus/discusrc", "rb").read(), "/usr/local/etc/discus/discusrc",
X              'exec'))
X     except IOError:
X-        usage(EX_CONFIG, "/etc/discusrc must exist and be readable.")
X+        usage(EX_CONFIG, "/usr/local/etc/discus/discusrc must exist and be readable.")
X 
X     try:
X         exec(compile(open(os.environ['HOME'] + "/.discusrc", "rb").read(),
SHAR_END
exit
