diff setup @ 404:c171c29e13f5

A bit of documentation.
author Edho Arief <edho@myconan.net>
date Fri, 26 Oct 2012 18:57:13 +0700
parents 0aabb2b34ef6
children fd0a889066a6
line wrap: on
line diff
--- a/setup	Mon Oct 08 15:29:49 2012 +0700
+++ b/setup	Fri Oct 26 18:57:13 2012 +0700
@@ -1,19 +1,38 @@
 #!/bin/sh
 
+# This script is bourne-shell compatible.
+# Or at least it is when I last tested it in Solaris 10.
+
+# Ensure no variable is empty when used.
 set -u
+# Stop on any error.
 set -e
 
+# Get directory where this script and dotfiles are located.
+# $0 contains either full path when executed from a PATH (godwhy)
+# or with complete path or ./<scriptname> when executed that way.
+# Therefore it's safe to use dirname in this case.
 basedir="`dirname "${0}"`"
+
+# To get actual path, go to the directory and pwd from it.
 cd "${basedir}"
 basedir="`pwd`"
+
+# FIXME: test existence of the directories.
+# dotfiles
 rcdir="${basedir}/rc"
+# misc scripts
 bindir="${basedir}/bin"
 
+# Make sure $HOME points somewhere.
+# FIXME: ensure it is writable (or maybe not).
 test -n "${HOME}" || exit 1
 
+# A safe echo.
 _echo() {
   _echon "${*}"; printf "\n"
 }
+# A safe and cross platform echo -n.
 _echon() {
   printf '%s' "${*}"
 }