mirror of
https://github.com/PapirusDevelopmentTeam/papirus-folders.git
synced 2024-09-18 18:48:47 -04:00
Allow to install to $HOME without sudo #28
wget -qO- https://git.io/papirus-folders-install | env PREFIX=$HOME/.local sh
This commit is contained in:
parent
86c63fdd21
commit
6837aa9ca9
2 changed files with 22 additions and 8 deletions
|
@ -55,6 +55,12 @@ Use the script to install the latest version directly from this repo (independen
|
|||
wget -qO- https://git.io/papirus-folders-install | sh
|
||||
```
|
||||
|
||||
To install papirus-folders to **home directory** using the following command:
|
||||
|
||||
```
|
||||
wget -qO- https://git.io/papirus-folders-install | env PREFIX=$HOME/.local sh
|
||||
```
|
||||
|
||||
To install papirus-folders on **BSD systems** using the following command:
|
||||
|
||||
```
|
||||
|
|
24
install.sh
24
install.sh
|
@ -36,10 +36,18 @@ _msg() {
|
|||
echo "=>" "$@"
|
||||
}
|
||||
|
||||
_sudo() {
|
||||
if [ -w "$PREFIX" ] || [ -w "$(dirname "$PREFIX")" ]; then
|
||||
"$@"
|
||||
else
|
||||
sudo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
_rm() {
|
||||
# removes parent directories if empty
|
||||
sudo rm -rf "$1"
|
||||
sudo rmdir -p "$(dirname "$1")" 2>/dev/null || true
|
||||
_sudo rm -rf "$1"
|
||||
_sudo rmdir -p "$(dirname "$1")" 2>/dev/null || true
|
||||
}
|
||||
|
||||
_download() {
|
||||
|
@ -63,17 +71,17 @@ _install() {
|
|||
tag="${TAG#v}"
|
||||
|
||||
_msg "Installing ..."
|
||||
sudo mkdir -p "$PREFIX/bin"
|
||||
sudo install -m 755 "$temp_dir/$gh_repo-$tag/$bin_name" \
|
||||
_sudo mkdir -p "$PREFIX/bin"
|
||||
_sudo install -m 755 "$temp_dir/$gh_repo-$tag/$bin_name" \
|
||||
"$PREFIX/bin/$bin_name"
|
||||
sudo mkdir -p "$PREFIX/share/bash-completion/completions"
|
||||
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/$bin_name" \
|
||||
_sudo mkdir -p "$PREFIX/share/bash-completion/completions"
|
||||
_sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/$bin_name" \
|
||||
"$PREFIX/share/bash-completion/completions"
|
||||
if [ -d "$PREFIX/share/zsh/site-functions" ]; then
|
||||
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
|
||||
_sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
|
||||
"$PREFIX/share/zsh/site-functions"
|
||||
elif [ -d "$PREFIX/share/zsh/vendor-completions" ]; then
|
||||
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
|
||||
_sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
|
||||
"$PREFIX/share/zsh/vendor-completions"
|
||||
else :
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue