mirror of
https://github.com/PapirusDevelopmentTeam/papirus-folders.git
synced 2024-09-19 11:08:48 -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
|
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:
|
To install papirus-folders on **BSD systems** using the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
24
install.sh
24
install.sh
|
@ -36,10 +36,18 @@ _msg() {
|
||||||
echo "=>" "$@"
|
echo "=>" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_sudo() {
|
||||||
|
if [ -w "$PREFIX" ] || [ -w "$(dirname "$PREFIX")" ]; then
|
||||||
|
"$@"
|
||||||
|
else
|
||||||
|
sudo "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_rm() {
|
_rm() {
|
||||||
# removes parent directories if empty
|
# removes parent directories if empty
|
||||||
sudo rm -rf "$1"
|
_sudo rm -rf "$1"
|
||||||
sudo rmdir -p "$(dirname "$1")" 2>/dev/null || true
|
_sudo rmdir -p "$(dirname "$1")" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
_download() {
|
_download() {
|
||||||
|
@ -63,17 +71,17 @@ _install() {
|
||||||
tag="${TAG#v}"
|
tag="${TAG#v}"
|
||||||
|
|
||||||
_msg "Installing ..."
|
_msg "Installing ..."
|
||||||
sudo mkdir -p "$PREFIX/bin"
|
_sudo mkdir -p "$PREFIX/bin"
|
||||||
sudo install -m 755 "$temp_dir/$gh_repo-$tag/$bin_name" \
|
_sudo install -m 755 "$temp_dir/$gh_repo-$tag/$bin_name" \
|
||||||
"$PREFIX/bin/$bin_name"
|
"$PREFIX/bin/$bin_name"
|
||||||
sudo mkdir -p "$PREFIX/share/bash-completion/completions"
|
_sudo mkdir -p "$PREFIX/share/bash-completion/completions"
|
||||||
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/bash-completion/completions"
|
"$PREFIX/share/bash-completion/completions"
|
||||||
if [ -d "$PREFIX/share/zsh/site-functions" ]; then
|
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"
|
"$PREFIX/share/zsh/site-functions"
|
||||||
elif [ -d "$PREFIX/share/zsh/vendor-completions" ]; then
|
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"
|
"$PREFIX/share/zsh/vendor-completions"
|
||||||
else :
|
else :
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue