diff options
author | grimi | 2016-12-19 06:57:42 +0100 |
---|---|---|
committer | grimi | 2016-12-19 06:57:42 +0100 |
commit | 724172feec1b667710cd248b77577bc646221aed (patch) | |
tree | 5cd5a3c1c597aa3fc6f4c7e39265437f8fb7b1d7 | |
parent | 7908f20e9d64863a39b681598bc8e97b0965a7c8 (diff) | |
download | aur-724172feec1b667710cd248b77577bc646221aed.tar.gz |
Upstream: 0.3.6.1
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rw-r--r-- | mime-archpkg.sh | 116 |
3 files changed, 67 insertions, 57 deletions
@@ -1,6 +1,6 @@ pkgbase = mime-archpkg pkgdesc = mime type for archlinux packages - pkgver = 0.3.6.0 + pkgver = 0.3.6.1 pkgrel = 1 url = http://www.archlinux.org install = mime-archpkg.install @@ -25,7 +25,7 @@ pkgbase = mime-archpkg source = FaenzaFlattr2-Zephyr.svgz source = elementary.svgz sha1sums = 93b739fec9667c80837d38ff67d4a69faf43e4e8 - sha1sums = 310165b21fb8d3a0b82e06fce5eedcb98f23f9e9 + sha1sums = 09973447b96ccb9e9a8a7a159384973371864802 sha1sums = ef315dab623a0539dd1919bf983473150de1002c sha1sums = d645b34f08693c5e9814f0f023288b780dca7471 sha1sums = 59bf9af96487b4d90926acfd6df9242504465b58 @@ -1,7 +1,7 @@ # Contributor: grimi <grimi at poczta dot fm> pkgname=mime-archpkg -pkgver=0.3.6.0 +pkgver=0.3.6.1 pkgrel=1 pkgdesc="mime type for archlinux packages" arch=('any') @@ -12,7 +12,7 @@ makedepends=('librsvg' 'imagemagick') install=${pkgname}.install source=(${pkgname}.{xml,sh} {hicolor,gnome,Tango,oxygen,nuoveXT2,Faenza,Faience,NITRUX,Numix,breeze,FaenzaFlattr2-Zephyr,elementary}.svgz) sha1sums=('93b739fec9667c80837d38ff67d4a69faf43e4e8' - '310165b21fb8d3a0b82e06fce5eedcb98f23f9e9' + '09973447b96ccb9e9a8a7a159384973371864802' 'ef315dab623a0539dd1919bf983473150de1002c' 'd645b34f08693c5e9814f0f023288b780dca7471' '59bf9af96487b4d90926acfd6df9242504465b58' diff --git a/mime-archpkg.sh b/mime-archpkg.sh index 1ec9695cd302..b5ae8500d676 100644 --- a/mime-archpkg.sh +++ b/mime-archpkg.sh @@ -1,11 +1,11 @@ #!/bin/bash # author: grimi # name: mime-archpkg -# require: sed, cat, basename, convert, rsvg-convert, gtk-update-icon-cache +# require: grep, sed, convert (imagemagick), rsvg-convert (librsvg), gtk-update-icon-cache declare MODE=usage declare MYDIR=/usr/share/mime-archpkg -declare MYTHEME +declare MYTHEME="$2" declare -r NAME=application-x-archpkg @@ -13,80 +13,90 @@ update() { local file theme elem suf local -i size local -a taba tab - for file in "$MYDIR"/*.svgz; do - theme="/usr/share/icons/$(basename "$file"|sed 's/\.svgz//')" - if [[ ${MYTHEME} ]]; then - if [[ $(basename "$theme") != $MYTHEME ]]; then - continue + if [[ -d $MYDIR ]]; then + cd "$MYDIR" + for file in *.svgz; do + theme="/usr/share/icons/${file%.svgz}" + if [[ ${MYTHEME} ]]; then + if [[ ${file%.svgz} != $MYTHEME ]]; then + continue + fi fi - fi - if [[ -f $theme/index.theme ]]; then - echo ">> Updating mimetype icons in $theme... <<" - taba=($(cat "$theme/index.theme"|grep "\[.*mimetypes"|sed 's/\[//; s/\]//')) - for elem in "${taba[@]}"; do - tab=($(echo $elem|sed 's/\//\n/')) - if [[ ${tab[0]/[0-9]/} != ${tab[0]} ]]; then - size=${tab[0]/x[0-9][0-9]*/} - if [[ ${tab[0]/@2x/} != ${tab[0]} ]]; then - size=$size*2 - fi - elif [[ ${tab[1]/[0-9]/} != ${tab[1]} ]]; then - size=${tab[1]/x[0-9][0-9]*/} - if [[ ${tab[1]/@2x/} != ${tab[1]} ]]; then - size=$size*2 + if [[ -f $theme/index.theme ]]; then + echo ">> Updating mimetype icons in $theme... <<" + taba=($(grep "\[.*mimetypes.*\]" "$theme/index.theme"|sed 's/\[//; s/\]//')) + for elem in "${taba[@]}"; do + tab=($(echo $elem|sed 's/\//\n/')) + if [[ ${tab[0]/[0-9]/} != ${tab[0]} ]]; then + size=${tab[0]/x[0-9][0-9]*/} + if [[ ${tab[0]/@2x/} != ${tab[0]} ]]; then + size=$size*2 + fi + elif [[ ${tab[1]/[0-9]/} != ${tab[1]} ]]; then + size=${tab[1]/x[0-9][0-9]*/} + if [[ ${tab[1]/@2x/} != ${tab[1]} ]]; then + size=$size*2 + fi + elif [[ ${elem/scalable/} != ${elem} ]]; then + size=0 fi - elif [[ ${elem/scalable/} != ${elem} ]]; then - size=0 - fi - if [[ $size ]]; then - if [[ $size -ne 0 ]]; then - if [[ -f $theme/$elem/package.svg ]]; then - suf=svg + if [[ $size ]]; then + if [[ $size -ne 0 ]]; then + if [[ -f $theme/$elem/package.svg ]]; then + suf=svg + else + suf=png + fi + convert -resize ${size}x${size} -background none "$file" /tmp/archpkg.$suf + install -m644 /tmp/archpkg.$suf "$theme/$elem/$NAME.$suf" else - suf=png + rsvg-convert -o /tmp/archpkg.svg -f svg "$file" + install -m644 /tmp/archpkg.svg "$theme/$elem/$NAME.svg" fi - convert -resize ${size}x${size} -background none "$file" /tmp/archpkg.$suf - install -m644 /tmp/archpkg.$suf "$theme/$elem/$NAME.$suf" - else - rsvg-convert -o /tmp/archpkg.svg -f svg "$file" - install -m644 /tmp/archpkg.svg "$theme/$elem/$NAME.svg" fi + done + if [[ -f $theme/icon-theme.cache ]]; then + gtk-update-icon-cache -q -f "$theme" fi - done - if [[ -f $theme/icon-theme.cache ]]; then - gtk-update-icon-cache -q -f "$theme" fi - fi - done + done + fi } remove() { local file theme - for file in "$MYDIR"/*.svgz; do - theme="/usr/share/icons/$(basename "$file"|sed 's/\.svgz//')" - if [[ -d $theme ]]; then - echo ">> Removing installed mimetype icons from $theme... <<" - find "$theme/" -type f -name $NAME.png -exec rm "{}" \; - find "$theme/" -type f -name $NAME.svg -exec rm "{}" \; - if [[ -f $theme/icon-theme.cache ]]; then - gtk-update-icon-cache -q -f "$theme" + if [[ -d $MYDIR ]]; then + cd "$MYDIR" + for file in *.svgz; do + theme="/usr/share/icons/${file%.svgz}" + if [[ ${MYTHEME} ]]; then + if [[ ${file%.svgz} != $MYTHEME ]]; then + continue + fi + fi + if [[ -d $theme ]]; then + echo ">> Removing installed mimetype icons from $theme... <<" + find "$theme/" -type f -name $NAME.png -exec rm "{}" \; + find "$theme/" -type f -name $NAME.svg -exec rm "{}" \; + if [[ -f $theme/icon-theme.cache ]]; then + gtk-update-icon-cache -q -f "$theme" + fi fi - fi - done + done + fi } usage() { - echo "USAGE: [-u] [-r] [-s <theme>]" + echo "USAGE: [-u] [-r] [theme]" echo " -u: update archpkg mime icons" echo " -r: remove archpkg mime icons" - echo " -s: update selected archpkg mime icons theme" + echo " theme: action only for entered theme" } case "$1" in -u) MODE=update ;; -r) MODE=remove ;; - -s) if [[ $2 ]]; then MODE=update; MYTHEME="$2"; fi ;; esac if [[ $MODE != "usage" && $USER != "root" ]]; then |