diff --git a/README.md b/README.md index 1650a310..c2e0603f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ _JavaScript has npm, Ruby has Gems, Python has pip and now Shell has bpkg!_ `bpkg` is a lightweight bash package manager. It takes care of fetching the shell scripts, installing them appropriately, setting the execution permission and more. -You can install shell scripts globally (on `/usr/local/bin`) or use them on a _per-project basis_ (on `./deps/`), as a lazy-man "copy and paste". +You can install shell scripts globally (on `${PREFIX:-/usr/local/bin}`) or use them on a _per-project basis_ (on `${BPKG_DEPS:-./deps/}`), as a lazy-man "copy and paste". * [Install](#install) @@ -78,8 +78,8 @@ You use `bpkg` by simply sending commands, pretty much like `npm` or `pip`. ### Installing packages -Packages can either be global (on `/usr/local/bin` if installed as root or - `$HOME/.local/bin` otherwize) or local (under `./deps`). +Packages can either be global (on `${PREFIX:-/usr/local/bin}` if installed as root or + `${PREFIX:-$HOME/.local/bin}` otherwize) or local (under `${BPKG_DEPS:-./deps}`). For example, here's a **global install for the current user** of the [term package][term]: diff --git a/lib/install/install.sh b/lib/install/install.sh index c92bb42e..ed59aeeb 100755 --- a/lib/install/install.sh +++ b/lib/install/install.sh @@ -11,6 +11,7 @@ if [[ ${#BPKG_REMOTES[@]} -eq 0 ]]; then BPKG_GIT_REMOTES[0]=${BPKG_GIT_REMOTE-https://github.com} fi BPKG_USER="${BPKG_USER:-bpkg}" +BPKG_DEPS="${BPKG_DEPS:-deps}" ## check parameter consistency validate_parameters () { @@ -436,17 +437,17 @@ bpkg_install_from_remote () { ## perform local install otherwise else ## copy 'bpkg.json' or 'package.json' over - save_remote_file "$url/$package_file" "$cwd/deps/$name/$package_file" "$auth_param" + save_remote_file "$url/$package_file" "$cwd/$BPKG_DEPS/$name/$package_file" "$auth_param" - ## make 'deps/' directory if possible - mkdir -p "$cwd/deps/$name" + ## make '$BPKG_DEPS/' directory if possible + mkdir -p "$cwd/$BPKG_DEPS/$name" - ## make 'deps/bin' directory if possible - mkdir -p "$cwd/deps/bin" + ## make '$BPKG_DEPS/bin' directory if possible + mkdir -p "$cwd/$BPKG_DEPS/bin" # install package dependencies info "Install dependencies for $name" - (cd "$cwd/deps/$name" && bpkg getdeps) + (cd "$cwd/$BPKG_DEPS/$name" && bpkg getdeps) ## grab each script and place in deps directory for script in "${scripts[@]}"; do @@ -455,13 +456,13 @@ bpkg_install_from_remote () { local scriptname="$(echo "$script" | xargs basename )" info "fetch" "$url/$script" - info "write" "$cwd/deps/$name/$script" - save_remote_file "$url/$script" "$cwd/deps/$name/$script" "$auth_param" + info "write" "$cwd/$BPKG_DEPS/$name/$script" + save_remote_file "$url/$script" "$cwd/$BPKG_DEPS/$name/$script" "$auth_param" scriptname="${scriptname%.*}" - info "$scriptname to PATH" "$cwd/deps/bin/$scriptname" - ln -si "$cwd/deps/$name/$script" "$cwd/deps/bin/$scriptname" - chmod u+x "$cwd/deps/bin/$scriptname" + info "$scriptname to PATH" "$cwd/$BPKG_DEPS/bin/$scriptname" + ln -si "$cwd/$BPKG_DEPS/$name/$script" "$cwd/$BPKG_DEPS/bin/$scriptname" + chmod u+x "$cwd/$BPKG_DEPS/bin/$scriptname" fi ) done @@ -472,8 +473,8 @@ bpkg_install_from_remote () { ( if [[ "$file" ]];then info "fetch" "$url/$file" - info "write" "$cwd/deps/$name/$file" - save_remote_file "$url/$file" "$cwd/deps/$name/$file" "$auth_param" + info "write" "$cwd/$BPKG_DEPS/$name/$file" + save_remote_file "$url/$file" "$cwd/$BPKG_DEPS/$name/$file" "$auth_param" fi ) done