Add new installation script

This commit is contained in:
Sergei Eremenko 2018-01-18 18:37:25 +02:00
parent 11a58490d5
commit 182ff66970
6 changed files with 98 additions and 212 deletions

View file

@ -58,18 +58,19 @@ Use the scripts to install the latest version directly from this repo (independe
#### ROOT directory (recommended)
```
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install-papirus-root.sh | sh
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install.sh | sh
```
#### HOME directory for GTK
```
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install-papirus-home-gtk.sh | sh
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install.sh | DESTDIR="$HOME/.icons" sh
```
#### HOME directory for KDE
```
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install-papirus-home-kde.sh | sh
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install.sh | DESTDIR="$HOME/.local/share/icons" sh
```
**NOTE:** Qt4 apps require `libqt4-svg` to work correctly.
@ -77,7 +78,7 @@ wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-
#### Remove
```
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/remove-papirus.sh | sh
wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/uninstall.sh | sh
```
### Unofficial packages

View file

@ -1,69 +0,0 @@
#!/bin/sh
set -e
gh_repo="papirus-icon-theme"
gh_desc="Papirus icon theme GTK"
cat <<- EOF
ppppp ii
pp pp aaaaa ppppp rr rrr uu uu sssss
ppppp aa aa pp pp ii rrrr uu uu ssss
pp aa aa pp pp ii rr uu uu ssss
pp aaaaa ppppp ii rr uuuuu sssss
pp
pp
$gh_desc
https://github.com/PapirusDevelopmentTeam/$gh_repo
EOF
temp_dir=$(mktemp -d)
echo "=> Getting the latest version from GitHub ..."
wget -O "/tmp/$gh_repo.tar.gz" \
https://github.com/PapirusDevelopmentTeam/$gh_repo/archive/master.tar.gz
echo "=> Unpacking archive ..."
tar -xzf "/tmp/$gh_repo.tar.gz" -C "$temp_dir"
echo "=> Deleting old $gh_desc ..."
rm -rf ~/.icons/ePapirus
rm -rf ~/.icons/Papirus
rm -rf ~/.icons/Papirus-Adapta
rm -rf ~/.icons/Papirus-Adapta-Nokto
rm -rf ~/.icons/Papirus-Dark
rm -rf ~/.icons/Papirus-Light
echo "=> Installing ..."
mkdir -p ~/.icons
cp -R \
"$temp_dir/$gh_repo-master/ePapirus" \
"$temp_dir/$gh_repo-master/Papirus" \
"$temp_dir/$gh_repo-master/Papirus-Adapta" \
"$temp_dir/$gh_repo-master/Papirus-Adapta-Nokto" \
"$temp_dir/$gh_repo-master/Papirus-Dark" \
"$temp_dir/$gh_repo-master/Papirus-Light" ~/.icons/
# Try to restore the color of folders from a config
if which papirus-folders > /dev/null 2>&1; then
papirus-folders -R || true
fi
gtk-update-icon-cache -q ~/.icons/ePapirus || true
gtk-update-icon-cache -q ~/.icons/Papirus || true
gtk-update-icon-cache -q ~/.icons/Papirus-Adapta || true
gtk-update-icon-cache -q ~/.icons/Papirus-Adapta-Nokto || true
gtk-update-icon-cache -q ~/.icons/Papirus-Dark || true
gtk-update-icon-cache -q ~/.icons/Papirus-Light || true
echo "=> Clearing cache ..."
rm -rf "/tmp/$gh_repo.tar.gz" "$temp_dir"
echo "=> Done!"

View file

@ -1,63 +0,0 @@
#!/bin/sh
set -e
gh_repo="papirus-icon-theme"
gh_desc="Papirus icon theme KDE"
cat <<- EOF
ppppp ii
pp pp aaaaa ppppp rr rrr uu uu sssss
ppppp aa aa pp pp ii rrrr uu uu ssss
pp aa aa pp pp ii rr uu uu ssss
pp aaaaa ppppp ii rr uuuuu sssss
pp
pp
$gh_desc
https://github.com/PapirusDevelopmentTeam/$gh_repo
EOF
temp_dir=$(mktemp -d)
echo "=> Getting the latest version from GitHub ..."
wget -O "/tmp/$gh_repo.tar.gz" \
https://github.com/PapirusDevelopmentTeam/$gh_repo/archive/master.tar.gz
echo "=> Unpacking archive ..."
tar -xzf "/tmp/$gh_repo.tar.gz" -C "$temp_dir"
echo "=> Deleting old $gh_desc ..."
rm -rf ~/.local/share/icons/ePapirus
rm -rf ~/.local/share/icons/Papirus
rm -rf ~/.local/share/icons/Papirus-Adapta
rm -rf ~/.local/share/icons/Papirus-Adapta-Nokto
rm -rf ~/.local/share/icons/Papirus-Dark
rm -rf ~/.local/share/icons/Papirus-Light
echo "=> Installing ..."
mkdir -p ~/.local/share/icons
cp -R \
"$temp_dir/$gh_repo-master/ePapirus" \
"$temp_dir/$gh_repo-master/Papirus" \
"$temp_dir/$gh_repo-master/Papirus-Adapta" \
"$temp_dir/$gh_repo-master/Papirus-Adapta-Nokto" \
"$temp_dir/$gh_repo-master/Papirus-Dark" \
"$temp_dir/$gh_repo-master/Papirus-Light" ~/.local/share/icons/
# Try to restore the color of folders from a config
if which papirus-folders > /dev/null 2>&1; then
papirus-folders -R || true
fi
echo "=> Clearing cache ..."
rm -f ~/.cache/icon-cache.kcache
rm -rf "/tmp/$gh_repo.tar.gz" "$temp_dir"
echo "=> Done!"

View file

@ -1,76 +0,0 @@
#!/bin/sh
set -e
gh_repo="papirus-icon-theme"
gh_desc="Papirus icon theme"
cat <<- EOF
ppppp ii
pp pp aaaaa ppppp rr rrr uu uu sssss
ppppp aa aa pp pp ii rrrr uu uu ssss
pp aa aa pp pp ii rr uu uu ssss
pp aaaaa ppppp ii rr uuuuu sssss
pp
pp
$gh_desc
https://github.com/PapirusDevelopmentTeam/$gh_repo
EOF
temp_dir=$(mktemp -d)
if [ -d "/usr/local/share/icons/hicolor" ]; then
# is a BSD system
data_dir="/usr/local"
else
data_dir="/usr"
fi
echo "=> Getting the latest version from GitHub ..."
wget -O "/tmp/$gh_repo.tar.gz" \
https://github.com/PapirusDevelopmentTeam/$gh_repo/archive/master.tar.gz
echo "=> Unpacking archive ..."
tar -xzf "/tmp/$gh_repo.tar.gz" -C "$temp_dir"
echo "=> Deleting old $gh_desc ..."
sudo rm -rf "$data_dir/share/icons/ePapirus"
sudo rm -rf "$data_dir/share/icons/Papirus"
sudo rm -rf "$data_dir/share/icons/Papirus-Adapta"
sudo rm -rf "$data_dir/share/icons/Papirus-Adapta-Nokto"
sudo rm -rf "$data_dir/share/icons/Papirus-Dark"
sudo rm -rf "$data_dir/share/icons/Papirus-Light"
echo "=> Installing ..."
sudo cp -R \
"$temp_dir/$gh_repo-master/ePapirus" \
"$temp_dir/$gh_repo-master/Papirus" \
"$temp_dir/$gh_repo-master/Papirus-Adapta" \
"$temp_dir/$gh_repo-master/Papirus-Adapta-Nokto" \
"$temp_dir/$gh_repo-master/Papirus-Dark" \
"$temp_dir/$gh_repo-master/Papirus-Light" $data_dir/share/icons/
# Try to restore the color of folders from a config
if which papirus-folders > /dev/null 2>&1; then
sudo papirus-folders -R || true
fi
sudo gtk-update-icon-cache -q "$data_dir/share/icons/ePapirus" || true
sudo gtk-update-icon-cache -q "$data_dir/share/icons/Papirus" || true
sudo gtk-update-icon-cache -q "$data_dir/share/icons/Papirus-Adapta" || true
sudo gtk-update-icon-cache -q "$data_dir/share/icons/Papirus-Adapta-Nokto" || true
sudo gtk-update-icon-cache -q "$data_dir/share/icons/Papirus-Dark" || true
sudo gtk-update-icon-cache -q "$data_dir/share/icons/Papirus-Light" || true
echo "=> Clearing cache ..."
rm -rf "/tmp/$gh_repo.tar.gz" "$temp_dir"
echo "=> Done!"

93
install.sh Executable file
View file

@ -0,0 +1,93 @@
#!/bin/sh
set -e
gh_repo="papirus-icon-theme"
gh_desc="Papirus icon theme"
cat <<- EOF
ppppp ii
pp pp aaaaa ppppp rr rrr uu uu sssss
ppppp aa aa pp pp ii rrrr uu uu ssss
pp aa aa pp pp ii rr uu uu ssss
pp aaaaa ppppp ii rr uuuuu sssss
pp
pp
$gh_desc
https://github.com/PapirusDevelopmentTeam/$gh_repo
EOF
DESTDIR="${DESTDIR:-/usr/share/icons}"
THEMES="${THEMES:-ePapirus Papirus Papirus-Dark Papirus-Light Papirus-Adapta Papirus-Adapta-Nokto}"
BRANCH="${BRANCH:-master}"
uninstall="${uninstall:-false}"
_msg() {
echo "=>" "$@" >&2
}
_rm() {
# removes parent directories if empty
_sudo rm -rf "$1"
_sudo rmdir -p "$(dirname "$1")" 2>/dev/null || true
}
_sudo() {
if [ -w "$DESTDIR" ] || [ -w "$(dirname "$DESTDIR")" ]; then
"$@"
else
sudo "$@"
fi
}
_download() {
_msg "Getting the latest version from GitHub ..."
wget -O "$temp_file" \
"https://github.com/PapirusDevelopmentTeam/$gh_repo/archive/$BRANCH.tar.gz"
_msg "Unpacking archive ..."
tar -xzf "$temp_file" -C "$temp_dir"
}
_uninstall() {
for theme in "$@"; do
_msg "Deleting '$theme' ..."
_rm "$DESTDIR/$theme"
done
}
_install() {
_sudo mkdir -p "$DESTDIR"
for theme in "$@"; do
_msg "Installing '$theme' ..."
_sudo cp -R "$temp_dir/$gh_repo-$BRANCH/$theme" "$DESTDIR"
_sudo gtk-update-icon-cache -q "$DESTDIR/$theme" || true
done
}
_cleanup() {
_msg "Clearing cache ..."
rm -rf "$temp_file" "$temp_dir"
rm -f "$HOME/.cache/icon-cache.kcache"
_msg "Done!"
}
trap _cleanup EXIT HUP INT TERM
temp_file="$(mktemp -u)"
temp_dir="$(mktemp -d)"
if [ "$uninstall" = "false" ]; then
_download
_uninstall $THEMES
_install $THEMES
else
_uninstall $THEMES
fi