diff options
author | Hans-Nikolai Viessmann | 2019-10-21 17:09:01 +0200 |
---|---|---|
committer | Hans-Nikolai Viessmann | 2019-10-21 17:09:01 +0200 |
commit | 0a7bb73e0339f8015ed11a34e32d6c73fa31df63 (patch) | |
tree | 4178b05d22a8b4b26a93d6e995798972606850c4 /clenv.sh | |
download | aur-0a7bb73e0339f8015ed11a34e32d6c73fa31df63.tar.gz |
initial commit
Diffstat (limited to 'clenv.sh')
-rw-r--r-- | clenv.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/clenv.sh b/clenv.sh new file mode 100644 index 000000000000..79e9dd340dd5 --- /dev/null +++ b/clenv.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# this script creates a copy of the current system-level +# StdEnv files of the Clean distribution and places them +# in the users home directory (under .cache) + +_install_dir="$HOME/.cache/clean-itasks-dev-bin" + +usage () { + echo "USAGE: clenv [cmd]" >&2 + echo "" + echo "Commands: status, init, deinit" +} + +if [ $# -lt 1 ]; then + usage + exit 0 +fi + +case $1 in + status) + if [ ! -d "$_install_dir/lib" ]; then + echo "not initilised" + else + echo "initilised" + fi + ;; + init) + if [ -d "$_install_dir/lib" ]; then + echo -n "already initilised, overwrite? [Y/n]: " + read -r yn + if [ "$yn" != "${yn#[Yy]}" ] ;then + rm -rf "$_install_dir" + cp -r /opt/clean-itasks-dev-bin/lib "$_install_dir/" + echo "done" + fi + else + [ -d "$_install_dir" ] || mkdir -p "$_install_dir" + cp -r /opt/clean-itasks-dev-bin/lib "$_install_dir/" + echo "done" + fi + ;; + deinit) + if [ ! -d "$_install_dir/lib" ]; then + echo "not initilised, nothing to do :(" + else + rm -rf "$_install_dir" + echo "done" + fi + ;; + *) + echo "unknown command..." + usage + exit 1 + ;; +esac |