aboutsummaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-06-15 16:30:40 +0200
committerKarel Kočí <cynerd@email.cz>2018-06-15 16:30:40 +0200
commit4c2ef15bdd2fa6b4dae19fe0fdbeefc99337a057 (patch)
treee9f79bdf4a89ab8267ae36cd87d56aec94be6609 /install
parent7bfda5959a346626dac3aa0959f2b4ae3232249b (diff)
downloadshellrc-ad593aac0591e1348bebed448e14a2dc63486c01.tar.gz
shellrc-ad593aac0591e1348bebed448e14a2dc63486c01.tar.bz2
shellrc-ad593aac0591e1348bebed448e14a2dc63486c01.zip
Add install scriptv0.4
Diffstat (limited to 'install')
-rwxr-xr-xinstall60
1 files changed, 60 insertions, 0 deletions
diff --git a/install b/install
new file mode 100755
index 0000000..af39291
--- /dev/null
+++ b/install
@@ -0,0 +1,60 @@
+#!/bin/sh
+set -ex
+cd "$(dirname "$0")"
+
+I_PREFIX=/
+U_BASH=false
+U_ZSH=false
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --help|-h)
+ echo "Usage: $0 [OPTION].."
+ echo
+ echo "Options:"
+ echo " -h, --help"
+ echo " Print this help text."
+ echo " -b, --bash"
+ echo " Install bash configuration"
+ echo " -z, --zsh"
+ echo " Install zsh configuration"
+ echo " --prefix PATH"
+ echo " Install prefix (in default set to /)"
+ exit 0
+ ;;
+ --bash|-b)
+ U_BASH=true
+ ;;
+ --zsh|-z)
+ U_ZSH=true
+ ;;
+ --prefix)
+ shift
+ I_PREFIX="$1"
+ ;;
+ *)
+ echo "Unknown option: $1" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+# Install shellrc
+mkdir -p "$I_PREFIX/etc"
+cp -r shellrc.d "$I_PREFIX/etc/shellrc.d"
+
+if $U_BASH; then
+ mkdir -p "$I_PREFIX/etc/bash"
+ cp -r bashrc.d/. "$I_PREFIX/etc/bash/bashrc.d"
+ mkdir -p "$I_PREFIX/usr/share/bash-completion/completions"
+ cp -r bash-completion/. "$I_PREFIX/usr/share/bash-completion/completions/"
+fi
+
+if $U_ZSH; then
+ mkdir -p "$I_PREFIX/etc/zsh"
+ cp -r zshrc.d/. "$I_PREFIX/etc/zsh/zshrc.d"
+ mkdir -p "$I_PREFIX/usr/share/zsh/site-functions"
+ cp -r zsh-completion/. "$I_PREFIX/usr/share/zsh/site-functions"
+fi
+