summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrimi2017-03-27 07:34:34 +0200
committergrimi2017-03-27 07:34:34 +0200
commita0975e96cb6a027c16aaf3d04372b1c5d2f4dc98 (patch)
tree069471770688bb60e57e3ee9182811cdc301f896
parentd133b204bc74550a8fc8cb4dfde9bfe83cb37c1b (diff)
downloadaur-a0975e96cb6a027c16aaf3d04372b1c5d2f4dc98.tar.gz
Upd: 0.3.7, relative path handling, fixes, optim.
-rw-r--r--.SRCINFO10
-rw-r--r--PKGBUILD14
-rw-r--r--hook-script.sh9
-rw-r--r--install.hook1
-rw-r--r--mime-archpkg.install2
-rw-r--r--mime-archpkg.sh78
-rw-r--r--update.hook2
7 files changed, 61 insertions, 55 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b7d8dddebcac..65cc5ab8a269 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = mime-archpkg
pkgdesc = mime type for archlinux packages
- pkgver = 0.3.6.4
+ pkgver = 0.3.7
pkgrel = 1
url = http://www.archlinux.org
install = mime-archpkg.install
@@ -29,7 +29,7 @@ pkgbase = mime-archpkg
source = remove.hook
source = hook-script.sh
sha256sums = e3fc45b1121fa845a245c115704715ec0b6a17860a507202cc5e1b02d01c797b
- sha256sums = 9b3418ba5cb6acf32ea63bb9868554efcc0375b1f60aa8f244be38174c4f004c
+ sha256sums = 2a26f7e7a2cfdfe4fbe380c12f17ea4170b452ece12e954f63d85024af5a5815
sha256sums = fc9b1f43e5993e994707285d89e0da28be48b69046f4cac68578a8d0beef4653
sha256sums = a59eb69c6fcdf7e8017c2596384cff0635dee46e3db5949370de766273451a85
sha256sums = 0a4951fd15afb85229ee17629686f914b5e5ed0583846dde2350e0c247007975
@@ -42,10 +42,10 @@ pkgbase = mime-archpkg
sha256sums = 8af276bc4afecede207a6742a5ef9320155650364339af183f9d47e1614c30a7
sha256sums = 3f0177c13377ad94745ec0f0324ab5fb58eeccac4e4b56695ac0f2113fb4d5bb
sha256sums = a99c2b48796d6f8299867034242c69fbddef4c380df0b68a678ee2727c841f29
- sha256sums = 814ec6d8b1318ffde6732c6ba468d66bc32534e79e486e4a4aaace0147b00d22
- sha256sums = 372f44c4e8d5d9dcca7cf80bd2e2b8ef3874aad6f6051073f4e98839dd9ed531
+ sha256sums = b0377905a4228bde2544c35cc23350dbd3b9c7849d441fa53e25819c414d2e4a
+ sha256sums = 641d017a42be2c2c0659934770d8f3638ffb88c2a0941798be82cf52f4a628e8
sha256sums = 622ee32d6ddbcb46671dcc46c7b31f4b7d9d4083e416af0100ab4bcc9829bd06
- sha256sums = 2c553f584aa0be02e5d62bc1b7af005b963124dba8987af9b13c5fbd8707fb2f
+ sha256sums = f374e455f0e4bfd5327d9a9ae32410f0698c916199ac46631d53b4d8f58cbcb7
pkgname = mime-archpkg
diff --git a/PKGBUILD b/PKGBUILD
index fd67faf73001..66c0cf1089eb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Contributor: grimi <grimi at poczta dot fm>
pkgname=mime-archpkg
-pkgver=0.3.6.4
+pkgver=0.3.7
pkgrel=1
pkgdesc="mime type for archlinux packages"
arch=('any')
@@ -12,7 +12,7 @@ install=${pkgname}.install
source=(${pkgname}.{xml,sh} {hicolor,gnome,Tango,oxygen,nuoveXT2,Faenza,Faience,NITRUX,Numix,breeze,FaenzaFlattr2-Zephyr,elementary}.svgz
{install,update,remove}.hook hook-script.sh)
sha256sums=('e3fc45b1121fa845a245c115704715ec0b6a17860a507202cc5e1b02d01c797b'
- '9b3418ba5cb6acf32ea63bb9868554efcc0375b1f60aa8f244be38174c4f004c'
+ '2a26f7e7a2cfdfe4fbe380c12f17ea4170b452ece12e954f63d85024af5a5815'
'fc9b1f43e5993e994707285d89e0da28be48b69046f4cac68578a8d0beef4653'
'a59eb69c6fcdf7e8017c2596384cff0635dee46e3db5949370de766273451a85'
'0a4951fd15afb85229ee17629686f914b5e5ed0583846dde2350e0c247007975'
@@ -25,10 +25,10 @@ sha256sums=('e3fc45b1121fa845a245c115704715ec0b6a17860a507202cc5e1b02d01c797b'
'8af276bc4afecede207a6742a5ef9320155650364339af183f9d47e1614c30a7'
'3f0177c13377ad94745ec0f0324ab5fb58eeccac4e4b56695ac0f2113fb4d5bb'
'a99c2b48796d6f8299867034242c69fbddef4c380df0b68a678ee2727c841f29'
- '814ec6d8b1318ffde6732c6ba468d66bc32534e79e486e4a4aaace0147b00d22'
- '372f44c4e8d5d9dcca7cf80bd2e2b8ef3874aad6f6051073f4e98839dd9ed531'
+ 'b0377905a4228bde2544c35cc23350dbd3b9c7849d441fa53e25819c414d2e4a'
+ '641d017a42be2c2c0659934770d8f3638ffb88c2a0941798be82cf52f4a628e8'
'622ee32d6ddbcb46671dcc46c7b31f4b7d9d4083e416af0100ab4bcc9829bd06'
- '2c553f584aa0be02e5d62bc1b7af005b963124dba8987af9b13c5fbd8707fb2f')
+ 'f374e455f0e4bfd5327d9a9ae32410f0698c916199ac46631d53b4d8f58cbcb7')
package() {
@@ -38,8 +38,8 @@ package() {
install -m644 *.svgz "${pkgdir}"/usr/share/${pkgname}/
install -Dm755 hook-script.sh "${pkgdir}"/usr/share/libalpm/scripts/${pkgname}
install -Dm644 install.hook "${pkgdir}"/usr/share/libalpm/hooks/${pkgname}-install.hook
- install -Dm644 update.hook "${pkgdir}"/usr/share/libalpm/hooks/${pkgname}-update.hook
- install -Dm644 remove.hook "${pkgdir}"/usr/share/libalpm/hooks/${pkgname}-remove.hook
+ install -m644 update.hook "${pkgdir}"/usr/share/libalpm/hooks/${pkgname}-update.hook
+ install -m644 remove.hook "${pkgdir}"/usr/share/libalpm/hooks/${pkgname}-remove.hook
}
diff --git a/hook-script.sh b/hook-script.sh
index bef1b8d19673..c78ce893f719 100644
--- a/hook-script.sh
+++ b/hook-script.sh
@@ -1,11 +1,12 @@
#!/bin/bash
while read -r path; do
- name="$(/usr/bin/basename "$path")"
+ name="${path/usr\/share\/icons\//}"
+ name="${name/\/*/}"
case "$1" in
- -i) /usr/bin/mime-archpkg -q -a "$name" ;;
- -u) /usr/bin/mime-archpkg -q -u "$name" ;;
- -r) /usr/bin/mime-archpkg -q -r "$name" ;;
+ -i) /usr/bin/mime-archpkg -q -r -a "$name" ;;
+ -u) /usr/bin/mime-archpkg -q -r -u "$name" ;;
+ -r) /usr/bin/mime-archpkg -q -r -d "$name" ;;
esac
done
diff --git a/install.hook b/install.hook
index 8987baf544b8..6e58d0b0cb46 100644
--- a/install.hook
+++ b/install.hook
@@ -2,6 +2,7 @@
Type = File
Operation = Install
Target = usr/share/icons/*/
+Target = !usr/share/icons/*/?*
[Action]
Description = Adding archpkg mimetypes icons...
diff --git a/mime-archpkg.install b/mime-archpkg.install
index 3377ad8c5476..0f5ab7bd3568 100644
--- a/mime-archpkg.install
+++ b/mime-archpkg.install
@@ -3,5 +3,5 @@ post_install() {
}
pre_remove() {
- mime-archpkg -r
+ mime-archpkg -d
}
diff --git a/mime-archpkg.sh b/mime-archpkg.sh
index f75e91f4d816..2b670b0e6111 100644
--- a/mime-archpkg.sh
+++ b/mime-archpkg.sh
@@ -3,10 +3,11 @@
# name: mime-archpkg
# require: grep, sed, convert (imagemagick), rsvg-convert (librsvg), gtk-update-icon-cache
-declare MODE=usage
-declare MYDIR=/usr/share/mime-archpkg
-declare -r NAME=application-x-archpkg
-declare MUTE=0
+declare MODE="usage"
+declare MYDIR="/usr/share/mime-archpkg"
+declare ICODIR="/usr/share/icons"
+declare -r NAME="application-x-archpkg"
+declare -i MUTE=0
add() {
@@ -17,33 +18,31 @@ add() {
if [[ -d $MYDIR ]]; then
cd "$MYDIR"
for file in *.svgz; do
- theme="/usr/share/icons/${file%.svgz}"
- if [[ $one ]]; then
- if [[ ${file%.svgz} != $one ]]; then
- continue
- fi
+ theme="$ICODIR/${file%.svgz}"
+ if [[ $one && ${file%.svgz} != $one ]]; then
+ continue
fi
if [[ -f $theme/index.theme ]]; then
if [[ $mute -ne 1 ]]; then
echo ">> Adding mimetype icons for $theme... <<"
fi
- taba=($(grep "\[.*mimetypes.*\]" "$theme/index.theme"|sed 's/\[//; s/\]//'))
+ taba=($(grep -e "\[.*mimetypes.*\]" -e "\[.*mimes.*\]" "$theme/index.theme"|sed 's/\[//; s/\]//'))
for elem in "${taba[@]}"; do
- tab=($(echo $elem|sed 's/\//\n/'))
- if [[ ${elem/scalable/} != ${elem} ]]; then
+ tab=($(echo -e ${elem/\//\\n}))
+ if [[ $elem =~ "scalable" ]]; then
size=0
else
- if [[ ${tab[0]/[0-9]/} != ${tab[0]} ]]; then
+ if [[ ${tab[0]} =~ [0-9]{2,3} ]]; then
abc="${tab[0]}"
- elif [[ ${tab[1]/[0-9]/} != ${tab[1]} ]]; then
+ elif [[ ${tab[1]} =~ [0-9]{2,3} ]]; then
abc="${tab[1]}"
else
continue
fi
- if [[ -h $theme/$abc ]]; then # skip link
+ if [[ -h $theme/${tab[0]} ]]; then # skip link
continue
fi
- if [[ ${abc/@2x/} != $abc ]]; then
+ if [[ $elem =~ "@2x" ]]; then
abc=${abc/@2x/}
size=${abc/x*/}
size=$size*2
@@ -52,14 +51,16 @@ add() {
fi
fi
if [[ $size -ne 0 ]]; then
- if [[ -f $theme/$elem/package.svg ]]; then
- suf=svg
- else
- suf=png
+ if [[ -d $theme/$elem ]]; 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"
fi
- convert -resize ${size}x${size} -background none "$file" /tmp/archpkg.$suf
- install -m644 /tmp/archpkg.$suf "$theme/$elem/$NAME.$suf"
- else
+ elif [[ -d $theme/$elem ]]; then
rsvg-convert -o /tmp/archpkg.svg -f svg "$file"
install -m644 /tmp/archpkg.svg "$theme/$elem/$NAME.svg"
fi
@@ -78,11 +79,9 @@ remove() {
if [[ -d $MYDIR ]]; then
cd "$MYDIR"
for file in *.svgz; do
- theme="/usr/share/icons/${file%.svgz}"
- if [[ $one ]]; then
- if [[ ${file%.svgz} != $one ]]; then
- continue
- fi
+ theme="$ICODIR/${file%.svgz}"
+ if [[ $one && ${file%.svgz} != $one ]]; then
+ continue
fi
if [[ -d $theme ]]; then
if [[ $MUTE -ne 1 ]]; then
@@ -104,11 +103,9 @@ update() {
if [[ -d $MYDIR ]]; then
cd "$MYDIR"
for file in *.svgz; do
- theme="/usr/share/icons/${file%.svgz}"
- if [[ $one ]]; then
- if [[ ${file%.svgz} != $one ]]; then
- continue
- fi
+ theme="$ICODIR/${file%.svgz}"
+ if [[ $one && ${file%.svgz} != $one ]]; then
+ continue
fi
if [[ -d $theme && -f $theme/index.theme ]]; then
if [[ $MUTE -ne 1 ]]; then
@@ -124,11 +121,12 @@ update() {
}
usage() {
- echo "USAGE: [-q] <-a|-u|-r> [theme]"
+ echo "USAGE: [-q] [-r] <-a|-u|-d> [theme]"
echo " -q: don't comment action"
+ echo " -r: relative path (default abs.)"
echo " -a: add archpkg mime icons"
echo " -u: update archpkg mime icons"
- echo " -r: remove archpkg mime icons"
+ echo " -d: remove archpkg mime icons"
echo " theme: action only for entered theme"
}
@@ -138,11 +136,18 @@ if [[ $1 == "-q" ]]; then
shift
fi
+if [[ $1 == "-r" ]]; then
+ if [[ $PWD != "/" ]]; then
+ MYDIR="$PWD/${MYDIR:1}"
+ ICODIR="$PWD/${ICODIR:1}"
+ fi
+ shift
+fi
case "$1" in
-a) MODE=add ;;
-u) MODE=update ;;
- -r) MODE=remove ;;
+ -d) MODE=remove ;;
esac
if [[ $MODE != "usage" && $USER != "root" ]]; then
@@ -152,4 +157,3 @@ fi
$MODE "$2"
-
diff --git a/update.hook b/update.hook
index ae0f4e32715d..cd5bfebe2149 100644
--- a/update.hook
+++ b/update.hook
@@ -1,7 +1,7 @@
[Trigger]
Type = File
Operation = Upgrade
-Target = usr/share/icons/*/
+Target = usr/share/icons/*/*/
[Action]
Description = Updating archpkg mimetypes icons...