# Get the tarball
cd
test -f installed/ipcalc-0.51.tar.gz &&
mv -f installed/ipcalc-0.51.tar.gz .
test ! -f ipcalc-0.51.tar.gz &&
wget https://github.com/kjokjo/ipcalc/archive/refs/tags/0.51.tar.gz -O \
ipcalc-0.51.tar.gz
# Extract the tarball
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "ipcalc-*" -execm rm -r {} \;
tar xzvf ~/ipcalc-0.51.tar.gz
cd ipcalc-0.51
test $UID = 0 && chown -R root:root .
# Read README.md, ipcalc (it's a Perl script), and 'man ./ipcalc.1'
# If upgrading, read changelog
# If you also want to use it as a CGI script, see the example use at
# https://jodies.de/ipcalc/
# and look at ipcalc.cgi, which is the file that makes that web page,
# and ipcalc.gif and ipcalculator.png
#
# If using source-installed Apache HTTP 2.x, you might put them in
# /usr/local/apache2/cgi-bin and make them owned by root:daemon with
# 0750 permissions or something like that... Or set up ScriptAlias
# somewhere else...
# https://httpd.apache.org/docs/2.4/howto/cgi.html
# https://httpd.apache.org/docs/current/mod/mod_cgi.html
# https://httpd.apache.org/docs/current/en/mod/mod_alias.html#scriptalias
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/ipcalc-*.tar.*
mv ipcalc-0.51.tar.gz installed/
# If you ever want to uninstall ipcalc, this should do it:
cd
su
rm -f /usr/local/bin/ipcalc /usr/local/man/man1/ipcalc.1
exit
find ~/src -maxdepth 1 -type d -name "ipcalc-*" -exec rm -r {} \;
rm -f ~/installed/ipcalc-*.tar.*