🔒 Repository is read-only – file editing is disabled.

recipes/gui/cups/PAGBUILD.yaml main

128 linii Raw ← Powrót
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
pkgname: cups
pkgver: '2.4.19'
pkgrel: '2'
pkgdesc: 'The Common Unix Printing System (CUPS) is a print spooler and associated utilities'
url: 'https://www.cups.org'
arch: x86_64
depends:
- 'xdg-utils'
- 'gtk-update-icon-cache'

makedepends:
- pam
- libusb
- avahi
- python
- gnutls
- libxcrypt

source:
- 'https://github.com/OpenPrinting/cups/releases/download/v${pkgver}/${pkgname}-${pkgver}-source.tar.gz'
- '99-printer.rules'

sha256sums:
- SKIP
- SKIP

hooks:
  'post-install': |
    name=cups
    version=2.4.19
    release=2
    INFO="\033[1;36m"
    NORMAL="\033[0;39m"
    systemctl enable cups
    if [ ! -f /etc/cups/client.conf ]; then
      echo "ServerName /run/cups/cups.sock" > /etc/cups/client.conf
      printf "${INFO} /etc/cups/client.conf created ${NORMAL}\n"
      printf "${INFO} Double check /etc/cups/client.conf and adapted to your needs ${NORMAL}\n"
    fi
    systemctl enable cups
  'pre-install': |
    name=cups
    version=2.4.19
    release=2
    INFO="\033[1;36m"
    NORMAL="\033[0;39m"
    
    SN="lpadmin"
    IDN="19"
    
    if ! (getent group $SN > /dev/null); then
       printf "${INFO}Creating $SN group${NORMAL}\n"
       groupadd -g $IDN $SN
    fi
    
    UN="lp"
    IDN="9"
    if ! (getent group $UN > /dev/null); then
       printf "${INFO}Creating $UN group${NORMAL}\n"
       groupadd -g $IDN $UN
    fi
    if ! (getent passwd $UN > /dev/null); then
       printf "${INFO}Creating $UN user${NORMAL}\n"
       useradd -c "Print Service User" -d /var/spool/cups \
       -u $IDN -g $UN -s /bin/false $UN
    fi

build: |
  SN="lpadmin"
  IDN="19"
  UN="lp"

  if ! (getent group $SN > /dev/null); then
     groupadd -g $IDN $SN
  fi

  UN="lp"
  IDN="9"
  if ! (getent passwd $UN > /dev/null); then
     useradd -c "Printer Service User" -d /var/spool/cups \
     -u $IDN -g $SN -s /bin/false $UN
  fi
  cd ${pkgname}-${pkgver}
  sed -i '/stat.h/a #include <asm-generic/ioctls.h>' tools/ipptool.c

  CC=gcc CXX=g++ \
  ./configure --libdir=/usr/lib        \
                     --sbindir=/usr/bin       \
                     --with-rundir=/run/cups  \
        		--with-rcdir=/tmp/cupsinit \
  	--with-system-groups=lpadmin \
  	--with-docdir=/usr/share/cups/doc \
  	--disable-libusb
  make
  make BUILDROOT=${PKGDIR} install

  rm -rf ${PKGDIR}/tmp
  mkdir -p ${PKGDIR}/usr/share/doc
  ln -svnf ../cups/doc ${PKGDIR}/usr/share/doc/cups

  # Lanceur
  if [ ! -f ${PKGDIR}/usr/share/applications/cups.desktop ]; then
  	mkdir -p ${PKGDIR}/usr/share/applications
  	install -m644 desktop/cups.desktop \
  	${PKGDIR}/usr/share/applications/cups.desktop
  fi

  # Supprimer les filtres faisant parti de cups-filters
  rm -rf ${PKGDIR}/usr/share/cups/banners
  rm -rf ${PKGDIR}/usr/share/cups/data/testprint

  chmod 755 ${PKGDIR}/etc

  # PAM
  cat > ${PKGDIR}/etc/pam.d/cups << "EOF"
  # Begin /etc/pam.d/cups

  auth    include system-auth
  account include system-account
  session include system-session

  # End /etc/pam.d/cups
  EOF
  mkdir -p ${PKGDIR}/etc/udev/rules.d
  install -m644 ../99-printer.rules  ${PKGDIR}/etc/udev/rules.d/99-printer.rules

package: |
  true