#!/bin/sh
# Install st — create command trampolines in ../bin/
dir=`dirname "$0"`
case "$dir" in
    /*) ;;
    *)  dir="`pwd`/$dir" ;;
esac
dir=`cd "$dir" && pwd`
bundle=`basename "$dir"`
bindir=`dirname "$dir"`/bin
mkdir -p "$bindir"
echo "Installing st commands into $bindir"
echo '#!/bin/sh' > "$bindir/bunzip2"
echo 'dir=`dirname "$0"`' >> "$bindir/bunzip2"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bunzip2"
echo "exec \"\$dir/../$bundle/bunzip2\" \"\$@\"" >> "$bindir/bunzip2"
chmod 755 "$bindir/bunzip2" && echo "  bunzip2"
echo '#!/bin/sh' > "$bindir/bzcat"
echo 'dir=`dirname "$0"`' >> "$bindir/bzcat"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzcat"
echo "exec \"\$dir/../$bundle/bzcat\" \"\$@\"" >> "$bindir/bzcat"
chmod 755 "$bindir/bzcat" && echo "  bzcat"
echo '#!/bin/sh' > "$bindir/bzcmp"
echo 'dir=`dirname "$0"`' >> "$bindir/bzcmp"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzcmp"
echo "exec \"\$dir/../$bundle/bzcmp\" \"\$@\"" >> "$bindir/bzcmp"
chmod 755 "$bindir/bzcmp" && echo "  bzcmp"
echo '#!/bin/sh' > "$bindir/bzdiff"
echo 'dir=`dirname "$0"`' >> "$bindir/bzdiff"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzdiff"
echo "exec \"\$dir/../$bundle/bzdiff\" \"\$@\"" >> "$bindir/bzdiff"
chmod 755 "$bindir/bzdiff" && echo "  bzdiff"
echo '#!/bin/sh' > "$bindir/bzegrep"
echo 'dir=`dirname "$0"`' >> "$bindir/bzegrep"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzegrep"
echo "exec \"\$dir/../$bundle/bzegrep\" \"\$@\"" >> "$bindir/bzegrep"
chmod 755 "$bindir/bzegrep" && echo "  bzegrep"
echo '#!/bin/sh' > "$bindir/bzfgrep"
echo 'dir=`dirname "$0"`' >> "$bindir/bzfgrep"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzfgrep"
echo "exec \"\$dir/../$bundle/bzfgrep\" \"\$@\"" >> "$bindir/bzfgrep"
chmod 755 "$bindir/bzfgrep" && echo "  bzfgrep"
echo '#!/bin/sh' > "$bindir/bzgrep"
echo 'dir=`dirname "$0"`' >> "$bindir/bzgrep"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzgrep"
echo "exec \"\$dir/../$bundle/bzgrep\" \"\$@\"" >> "$bindir/bzgrep"
chmod 755 "$bindir/bzgrep" && echo "  bzgrep"
echo '#!/bin/sh' > "$bindir/bzip2"
echo 'dir=`dirname "$0"`' >> "$bindir/bzip2"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzip2"
echo "exec \"\$dir/../$bundle/bzip2\" \"\$@\"" >> "$bindir/bzip2"
chmod 755 "$bindir/bzip2" && echo "  bzip2"
echo '#!/bin/sh' > "$bindir/bzip2recover"
echo 'dir=`dirname "$0"`' >> "$bindir/bzip2recover"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzip2recover"
echo "exec \"\$dir/../$bundle/bzip2recover\" \"\$@\"" >> "$bindir/bzip2recover"
chmod 755 "$bindir/bzip2recover" && echo "  bzip2recover"
echo '#!/bin/sh' > "$bindir/bzless"
echo 'dir=`dirname "$0"`' >> "$bindir/bzless"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzless"
echo "exec \"\$dir/../$bundle/bzless\" \"\$@\"" >> "$bindir/bzless"
chmod 755 "$bindir/bzless" && echo "  bzless"
echo '#!/bin/sh' > "$bindir/bzmore"
echo 'dir=`dirname "$0"`' >> "$bindir/bzmore"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/bzmore"
echo "exec \"\$dir/../$bundle/bzmore\" \"\$@\"" >> "$bindir/bzmore"
chmod 755 "$bindir/bzmore" && echo "  bzmore"
echo '#!/bin/sh' > "$bindir/envsubst"
echo 'dir=`dirname "$0"`' >> "$bindir/envsubst"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/envsubst"
echo "exec \"\$dir/../$bundle/envsubst\" \"\$@\"" >> "$bindir/envsubst"
chmod 755 "$bindir/envsubst" && echo "  envsubst"
echo '#!/bin/sh' > "$bindir/fc-cache"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-cache"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-cache"
echo "exec \"\$dir/../$bundle/fc-cache\" \"\$@\"" >> "$bindir/fc-cache"
chmod 755 "$bindir/fc-cache" && echo "  fc-cache"
echo '#!/bin/sh' > "$bindir/fc-cache-32"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-cache-32"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-cache-32"
echo "exec \"\$dir/../$bundle/fc-cache-32\" \"\$@\"" >> "$bindir/fc-cache-32"
chmod 755 "$bindir/fc-cache-32" && echo "  fc-cache-32"
echo '#!/bin/sh' > "$bindir/fc-cat"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-cat"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-cat"
echo "exec \"\$dir/../$bundle/fc-cat\" \"\$@\"" >> "$bindir/fc-cat"
chmod 755 "$bindir/fc-cat" && echo "  fc-cat"
echo '#!/bin/sh' > "$bindir/fc-conflist"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-conflist"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-conflist"
echo "exec \"\$dir/../$bundle/fc-conflist\" \"\$@\"" >> "$bindir/fc-conflist"
chmod 755 "$bindir/fc-conflist" && echo "  fc-conflist"
echo '#!/bin/sh' > "$bindir/fc-list"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-list"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-list"
echo "exec \"\$dir/../$bundle/fc-list\" \"\$@\"" >> "$bindir/fc-list"
chmod 755 "$bindir/fc-list" && echo "  fc-list"
echo '#!/bin/sh' > "$bindir/fc-match"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-match"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-match"
echo "exec \"\$dir/../$bundle/fc-match\" \"\$@\"" >> "$bindir/fc-match"
chmod 755 "$bindir/fc-match" && echo "  fc-match"
echo '#!/bin/sh' > "$bindir/fc-pattern"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-pattern"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-pattern"
echo "exec \"\$dir/../$bundle/fc-pattern\" \"\$@\"" >> "$bindir/fc-pattern"
chmod 755 "$bindir/fc-pattern" && echo "  fc-pattern"
echo '#!/bin/sh' > "$bindir/fc-query"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-query"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-query"
echo "exec \"\$dir/../$bundle/fc-query\" \"\$@\"" >> "$bindir/fc-query"
chmod 755 "$bindir/fc-query" && echo "  fc-query"
echo '#!/bin/sh' > "$bindir/fc-scan"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-scan"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-scan"
echo "exec \"\$dir/../$bundle/fc-scan\" \"\$@\"" >> "$bindir/fc-scan"
chmod 755 "$bindir/fc-scan" && echo "  fc-scan"
echo '#!/bin/sh' > "$bindir/fc-validate"
echo 'dir=`dirname "$0"`' >> "$bindir/fc-validate"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/fc-validate"
echo "exec \"\$dir/../$bundle/fc-validate\" \"\$@\"" >> "$bindir/fc-validate"
chmod 755 "$bindir/fc-validate" && echo "  fc-validate"
echo '#!/bin/sh' > "$bindir/gettext"
echo 'dir=`dirname "$0"`' >> "$bindir/gettext"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/gettext"
echo "exec \"\$dir/../$bundle/gettext\" \"\$@\"" >> "$bindir/gettext"
chmod 755 "$bindir/gettext" && echo "  gettext"
echo '#!/bin/sh' > "$bindir/gettext.sh"
echo 'dir=`dirname "$0"`' >> "$bindir/gettext.sh"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/gettext.sh"
echo "exec \"\$dir/../$bundle/gettext.sh\" \"\$@\"" >> "$bindir/gettext.sh"
chmod 755 "$bindir/gettext.sh" && echo "  gettext.sh"
echo '#!/bin/sh' > "$bindir/msgattrib"
echo 'dir=`dirname "$0"`' >> "$bindir/msgattrib"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgattrib"
echo "exec \"\$dir/../$bundle/msgattrib\" \"\$@\"" >> "$bindir/msgattrib"
chmod 755 "$bindir/msgattrib" && echo "  msgattrib"
echo '#!/bin/sh' > "$bindir/msgcat"
echo 'dir=`dirname "$0"`' >> "$bindir/msgcat"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgcat"
echo "exec \"\$dir/../$bundle/msgcat\" \"\$@\"" >> "$bindir/msgcat"
chmod 755 "$bindir/msgcat" && echo "  msgcat"
echo '#!/bin/sh' > "$bindir/msgcmp"
echo 'dir=`dirname "$0"`' >> "$bindir/msgcmp"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgcmp"
echo "exec \"\$dir/../$bundle/msgcmp\" \"\$@\"" >> "$bindir/msgcmp"
chmod 755 "$bindir/msgcmp" && echo "  msgcmp"
echo '#!/bin/sh' > "$bindir/msgcomm"
echo 'dir=`dirname "$0"`' >> "$bindir/msgcomm"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgcomm"
echo "exec \"\$dir/../$bundle/msgcomm\" \"\$@\"" >> "$bindir/msgcomm"
chmod 755 "$bindir/msgcomm" && echo "  msgcomm"
echo '#!/bin/sh' > "$bindir/msgconv"
echo 'dir=`dirname "$0"`' >> "$bindir/msgconv"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgconv"
echo "exec \"\$dir/../$bundle/msgconv\" \"\$@\"" >> "$bindir/msgconv"
chmod 755 "$bindir/msgconv" && echo "  msgconv"
echo '#!/bin/sh' > "$bindir/msgen"
echo 'dir=`dirname "$0"`' >> "$bindir/msgen"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgen"
echo "exec \"\$dir/../$bundle/msgen\" \"\$@\"" >> "$bindir/msgen"
chmod 755 "$bindir/msgen" && echo "  msgen"
echo '#!/bin/sh' > "$bindir/msgexec"
echo 'dir=`dirname "$0"`' >> "$bindir/msgexec"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgexec"
echo "exec \"\$dir/../$bundle/msgexec\" \"\$@\"" >> "$bindir/msgexec"
chmod 755 "$bindir/msgexec" && echo "  msgexec"
echo '#!/bin/sh' > "$bindir/msgfilter"
echo 'dir=`dirname "$0"`' >> "$bindir/msgfilter"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgfilter"
echo "exec \"\$dir/../$bundle/msgfilter\" \"\$@\"" >> "$bindir/msgfilter"
chmod 755 "$bindir/msgfilter" && echo "  msgfilter"
echo '#!/bin/sh' > "$bindir/msgfmt"
echo 'dir=`dirname "$0"`' >> "$bindir/msgfmt"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgfmt"
echo "exec \"\$dir/../$bundle/msgfmt\" \"\$@\"" >> "$bindir/msgfmt"
chmod 755 "$bindir/msgfmt" && echo "  msgfmt"
echo '#!/bin/sh' > "$bindir/msggrep"
echo 'dir=`dirname "$0"`' >> "$bindir/msggrep"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msggrep"
echo "exec \"\$dir/../$bundle/msggrep\" \"\$@\"" >> "$bindir/msggrep"
chmod 755 "$bindir/msggrep" && echo "  msggrep"
echo '#!/bin/sh' > "$bindir/msginit"
echo 'dir=`dirname "$0"`' >> "$bindir/msginit"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msginit"
echo "exec \"\$dir/../$bundle/msginit\" \"\$@\"" >> "$bindir/msginit"
chmod 755 "$bindir/msginit" && echo "  msginit"
echo '#!/bin/sh' > "$bindir/msgmerge"
echo 'dir=`dirname "$0"`' >> "$bindir/msgmerge"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgmerge"
echo "exec \"\$dir/../$bundle/msgmerge\" \"\$@\"" >> "$bindir/msgmerge"
chmod 755 "$bindir/msgmerge" && echo "  msgmerge"
echo '#!/bin/sh' > "$bindir/msgunfmt"
echo 'dir=`dirname "$0"`' >> "$bindir/msgunfmt"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msgunfmt"
echo "exec \"\$dir/../$bundle/msgunfmt\" \"\$@\"" >> "$bindir/msgunfmt"
chmod 755 "$bindir/msgunfmt" && echo "  msgunfmt"
echo '#!/bin/sh' > "$bindir/msguniq"
echo 'dir=`dirname "$0"`' >> "$bindir/msguniq"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/msguniq"
echo "exec \"\$dir/../$bundle/msguniq\" \"\$@\"" >> "$bindir/msguniq"
chmod 755 "$bindir/msguniq" && echo "  msguniq"
echo '#!/bin/sh' > "$bindir/ngettext"
echo 'dir=`dirname "$0"`' >> "$bindir/ngettext"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/ngettext"
echo "exec \"\$dir/../$bundle/ngettext\" \"\$@\"" >> "$bindir/ngettext"
chmod 755 "$bindir/ngettext" && echo "  ngettext"
echo '#!/bin/sh' > "$bindir/pngfix"
echo 'dir=`dirname "$0"`' >> "$bindir/pngfix"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/pngfix"
echo "exec \"\$dir/../$bundle/pngfix\" \"\$@\"" >> "$bindir/pngfix"
chmod 755 "$bindir/pngfix" && echo "  pngfix"
echo '#!/bin/sh' > "$bindir/recode-sr-latin"
echo 'dir=`dirname "$0"`' >> "$bindir/recode-sr-latin"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/recode-sr-latin"
echo "exec \"\$dir/../$bundle/recode-sr-latin\" \"\$@\"" >> "$bindir/recode-sr-latin"
chmod 755 "$bindir/recode-sr-latin" && echo "  recode-sr-latin"
echo '#!/bin/sh' > "$bindir/st"
echo 'dir=`dirname "$0"`' >> "$bindir/st"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/st"
echo "exec \"\$dir/../$bundle/st\" \"\$@\"" >> "$bindir/st"
chmod 755 "$bindir/st" && echo "  st"
echo '#!/bin/sh' > "$bindir/xgettext"
echo 'dir=`dirname "$0"`' >> "$bindir/xgettext"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/xgettext"
echo "exec \"\$dir/../$bundle/xgettext\" \"\$@\"" >> "$bindir/xgettext"
chmod 755 "$bindir/xgettext" && echo "  xgettext"
echo '#!/bin/sh' > "$bindir/xmlwf"
echo 'dir=`dirname "$0"`' >> "$bindir/xmlwf"
echo 'case "$dir" in /*) ;; *) dir="`pwd`/$dir" ;; esac' >> "$bindir/xmlwf"
echo "exec \"\$dir/../$bundle/xmlwf\" \"\$@\"" >> "$bindir/xmlwf"
chmod 755 "$bindir/xmlwf" && echo "  xmlwf"
echo ""
echo "Done. Make sure $bindir is in your PATH:"
echo "  PATH=$bindir:\$PATH; export PATH"
echo ""
echo "Add that line to ~/.profile to make it permanent."
