summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c56a80d9102440074b43245d740e35035f971bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com

# Lexmark E260 and E360 Postscript takes about 30 seconds to print a page.
# Expanding the memory to max does not help. Moving to the MS810 drops the time to 15 seconds.
# PCL5 and PCL6 print at full speed with standard memory.
# Postscript is the only driver Foomatic provides.
# PCL5 prints at 300dpi. PCL6 prints at 1200dpi.
# Here we enable PXLMONO

# Chances are the E460 has the same problem but I don't have one to test.
# Let me know if it should be added.

# https://bugs.linuxfoundation.org/show_bug.cgi?id=1420 Add pxlmono to Lexmark E260 E360

set -u
pkgname='lexmark-e260-pxl'
pkgver='1.0.0'
pkgrel='1'
pkgdesc='add pxlmono to Foomatic driver for Lexmark E260 E360 E460 E462 MS310 MS312 MS315 MS410 MS415 MS510 MS610 MS710 MS810 MS811 MS812 to avoid slow Postscript'
arch=('any')
url='https://wiki.linuxfoundation.org/openprinting/database/foomatic'
license=('GPL')
depends=('foomatic-db' 'diffutils' 'patch')
options=('!strip')
install="${pkgname}-install.sh"
_patch='0000-Lexmark-E260-E360-pxlmono.patch'
source=("${_patch}")
sha256sums=('4794072332807a4d1540c10365f99eb56870cf2fa1a0eb1b0b1f23c9e5a0ae67')

_scriptdir="/usr/share/${pkgname}"
_script="${_scriptdir}/${pkgname}.sh"

# We can't modify .install but we can stop and force the user to fix it.
_install_check() {
  local _ckvar
  local _ckline
  for _ckvar in '_script'; do
    _ckline="${_ckvar}='${!_ckvar}'"
    if ! grep -q "^${_ckline}"'$' "${startdir}/${install}"; then
      msg "${install} must be fixed"
      echo "${_ckline}"
      set +u
      false
    fi
  done
}

prepare() {
  set -u
  _install_check
  set +u
}

package() {
  set -u
  #diff -pNaru5 printer{.old,} > '0000-Lexmark-E260-E360-pxlmono.patch'
  install -Dpm644 "${_patch}" -t "${pkgdir}${_scriptdir}"
  install -Dpm644 <(cat << EOF
#!/bin/sh

patch "\$@" -r - --no-backup-if-mismatch -d '/usr/share/foomatic/db/source/printer' -Nup1 -i "${_scriptdir}/${_patch}"
EOF
  ) "${pkgdir}${_script}"

  install -Dm644 <(cat << EOF
# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
# https://aur.archlinux.org/

# Update ${pkgname} on each reinstall of foomatic-db

[Trigger]
Operation = Upgrade
Type = Package
Target = foomatic-db

[Action]
Description = Add PXL to Lexmark printers
Depends = coreutils
When = PostTransaction
Exec = /usr/bin/bash "${_script}"
EOF
  ) "${pkgdir}/usr/share/libalpm/hooks/${pkgname}-foomatic-db.hook"
  set +u
}

set +u