diff options
| -rwxr-xr-x | examples/bootstrap | 36 | ||||
| -rwxr-xr-x | examples/pkglist | 20 | 
2 files changed, 28 insertions, 28 deletions
diff --git a/examples/bootstrap b/examples/bootstrap index 5c03803..7694668 100755 --- a/examples/bootstrap +++ b/examples/bootstrap @@ -6,10 +6,10 @@  # and also have an excuse for using zsh here :P  setopt err_exit -trap "print -P '\n%N:%i: bootstrap failed ($?)'" ZERR +trap "print -P '\n%N:%i: bootstrap failed (${?})'" ZERR  typeset -i rcempty=0  typeset PKG_ROOT PKG_DIR default_path='~/packages' -: ${XDG_CONFIG_HOME=$HOME/.config} +: ${XDG_CONFIG_HOME=${HOME}/.config}  if ! which git &> /dev/null; then  	echo - 'It appears that git is not available on this system.' @@ -17,12 +17,12 @@ if ! which git &> /dev/null; then  	exit 200  fi -if [[ $# -ge 4 ]] { -	PKG_PROTO=$1 -	PKG_USER=$2 -	PKG_HOST=$3 -	PKG_PATH=$4 -	PKG_DIR=${~${5-$default_path}} +if [[ ${#} -ge 4 ]] { +	PKG_PROTO=${1} +	PKG_USER=${2} +	PKG_HOST=${3} +	PKG_PATH=${4} +	PKG_DIR=${~${5-${default_path}}}  } else {  	cat <<- meow  		Usage: ./bootstrap PKG_PROTO PKG_USER PKG_HOST PKG_PATH [PKG_DIR] @@ -32,7 +32,7 @@ if [[ $# -ge 4 ]] {  		PKG_HOST : remote host to connect to  		PKG_PATH : package root path on the remote host  		PKG_DIR : the path where caretaker and all further packages will be installed, -		        by default $default_path +		        by default ${default_path}  		Examples: ./bootstrap ssh '' aneurysm /home/derf/var/packages_root  		          ./bootstrap file '' '' /home/derf/var/packages_root @@ -58,18 +58,18 @@ if ! [[ -e ~/.zshrc ]] {  echo 'Creating the basic directory structure'  mkdir -p ~/bin -path=(~/bin $path) -mkdir -p $PKG_DIR/.collected/man/man{1..8} +path=(~/bin ${path}) +mkdir -p ${PKG_DIR}/.collected/man/man{1..8}  echo 'Fetching the caretaker package...' -cd $PKG_DIR +cd ${PKG_DIR}  git clone "${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/caretaker" caretaker  cd caretaker -echo "Writing $XDG_CONFIG_HOME/caretaker/caretaker.conf" -mkdir -p $XDG_CONFIG_HOME/caretaker +echo "Writing ${XDG_CONFIG_HOME}/caretaker/caretaker.conf" +mkdir -p ${XDG_CONFIG_HOME}/caretaker -cat > $XDG_CONFIG_HOME/caretaker/caretaker.conf <<- flurbl +cat > ${XDG_CONFIG_HOME}/caretaker/caretaker.conf <<- flurbl  	PKG_DIR="${PKG_DIR/${HOME}/\${HOME}/"  	PKG_ROOTS=(default) @@ -97,11 +97,11 @@ if (( rcempty )) {  cat <<- tac  	bootstrap finished. -	Package directory: $PKG_DIR, -	config path      : $XDG_CONFIG_HOME/caretaker/caretaker.conf +	Package directory: ${PKG_DIR}, +	config path      : ${XDG_CONFIG_HOME}/caretaker/caretaker.conf  tac -if [[ $PATH != *$HOME/bin* ]] { +if [[ ${PATH} != *${HOME}/bin* ]] {  	cat <<- tac  		Note: You may need to change your PATH to include ~/bin, diff --git a/examples/pkglist b/examples/pkglist index 5faf3a8..77cb16f 100755 --- a/examples/pkglist +++ b/examples/pkglist @@ -3,35 +3,35 @@  ## used by ct update remote  if [[ -z ${PKG_PATH} || -z ${PKG_PROTO} ]] { -	echo "PKG_PATH and PKG_PROTO must be set while running $0" >&2 +	echo "PKG_PATH and PKG_PROTO must be set while running ${0}" >&2  	exit 1  }  if [[ ! -d ${PKG_PATH} ]] { -	echo "$0: package root directory '$PKG_PATH' does not exist!" >&2 +	echo "${0}: package root directory '${PKG_PATH}' does not exist!" >&2  	exit 1  }  setopt err_exit -cd $PKG_PATH +cd ${PKG_PATH}  for dir in *(-/); {  	# git repo -	if [[ -d $dir/.git ]] { -		echo -n "$dir git " -		echo -n ${$(git --git-dir=$dir/.git log -n 1)[2]} +	if [[ -d ${dir}/.git ]] { +		echo -n "${dir} git " +		echo -n ${$(git --git-dir=${dir}/.git log -n 1)[2]}  		echo " ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${dir}/.git"  	# bare git repo -	} elif [[ -d $dir/objects && -d $dir/refs ]] { -		echo -n "$dir git " -		echo -n ${$(git --git-dir=$dir log -n 1)[2]} +	} elif [[ -d ${dir}/objects && -d ${dir}/refs ]] { +		echo -n "${dir} git " +		echo -n ${$(git --git-dir=${dir} log -n 1)[2]}  		echo " ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${dir}"  	# unknown  	} else { -		echo "$dir: Unsupported or no repository" >&2 +		echo "${dir}: Unsupported or no repository" >&2  	}  }  | 
