Files
cups/recipe.sh

69 lines
2.6 KiB
Bash

# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
sed -i 's#@CUPS_HTMLVIEW@#xdg-open#' desktop/cups.desktop.in
./configure --libdir=/usr/lib \
--localstatedir=/var \
--with-rundir=/run/cups \
--with-cups-user=209 \
--with-cups-group=209 \
--with-optim="$CFLAGS" \
--with-tls=gnutls \
--enable-pam \
--enable-raw-printing \
--enable-dbus=yes \
--enable-relro
make
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package_cups() {
make DESTDIR="$BPM_OUTPUT" install-data install-exec
# Remove /run directory
rm -rf "$BPM_OUTPUT"/run
# Remove program that is installed by libcups
rm "$BPM_OUTPUT"/usr/bin/cups-config
# Remove SysV files
rm -r "$BPM_OUTPUT"/etc/rc.d
# Fix unknown directive error
sed -i 's/^IdleExitTimeout/#&/' "$BPM_OUTPUT"/etc/cups/cupsd.conf
# Create default cups client config
echo "ServerName /run/cups/cups.sock" | install -Dm644 -g 209 /dev/stdin "$BPM_OUTPUT"/etc/cups/client.conf
# Install sysusesrs and set user and group in config
install -Dm644 "$BPM_WORKDIR"/sysusers "$BPM_OUTPUT"/usr/lib/sysusers.d/cups.conf
sed -i "s/#User 209/User 209/" "$BPM_OUTPUT"/etc/cups/cups-files.conf{,.default}
sed -i "s/#Group 209/Group 209/" "$BPM_OUTPUT"/etc/cups/cups-files.conf{,.default}
# Install pam configuration file
install -Dm644 "$BPM_WORKDIR"/cups-pam "$BPM_OUTPUT"/etc/pam.d/cups
# Install ESVM service
install -Dm644 "$BPM_WORKDIR"/cupsd.esv "$BPM_OUTPUT"/etc/esvm/services/cupsd.esv
# Install package license
install -d "$BPM_OUTPUT"/usr/share/licenses/
ln -sf libcups "$BPM_OUTPUT"/usr/share/licenses/cups
}
package_libcups() {
make DESTDIR="$BPM_OUTPUT" install-libs install-headers
# Install program required by other software to locate the libraries
install -Dm755 "$BPM_SOURCE"/cups-config "$BPM_OUTPUT"/usr/bin/cups-config
# Install package license
install -Dm644 "$BPM_SOURCE"/{LICENSE,NOTICE} -t "$BPM_OUTPUT"/usr/share/licenses/libcups/
}