summaryrefslogtreecommitdiff
path: root/recipes-support/libpwquality/libpwquality_%.bbappend
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-support/libpwquality/libpwquality_%.bbappend')
-rw-r--r--recipes-support/libpwquality/libpwquality_%.bbappend60
1 files changed, 60 insertions, 0 deletions
diff --git a/recipes-support/libpwquality/libpwquality_%.bbappend b/recipes-support/libpwquality/libpwquality_%.bbappend
new file mode 100644
index 0000000..910929e
--- /dev/null
+++ b/recipes-support/libpwquality/libpwquality_%.bbappend
@@ -0,0 +1,60 @@
+SUMMARY = "Library for password quality checking and generating random passwords"
+HOMEPAGE = "https://launchpad.net/libpwquality"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=6bd2f1386df813a459a0c34fde676fc2"
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "\
+ file://pwquality_conf.patch \
+ file://pam.configure \
+ "
+
+do_install_append() {
+ install -d -m755 ${D}/${datadir_native}/${PN}
+ install ${WORKDIR}/pam.configure ${D}/${datadir_native}/${PN}
+}
+
+# The postinstall installs libpwquality into PAM.
+# The prerm removes libpwquatlity from PAM.
+# The file we change is /etc/pam.d/common-password,
+# which is a configuration file for libpam-runtime.
+# We ignore failures in the post-install and pre-remove.
+# so if the patch does not apply, pam will not use us.
+pkg_postinst_${PN}() {
+ PAM_CONFIGURE="/${datadir_native}/${PN}/pam.configure"
+ if [[ -n $D ]] ; then
+ LOG='printf %s\n'
+ PAM_CONFIGURE="$D${PAM_CONFIGURE}"
+ cd $D
+ else
+ LOG="logger -s -p user.info -t opkg\ libpwquality"
+ cd /
+ fi
+ # -N busybox option for patch is broken
+ if patch --dry-run -p1 < "$PAM_CONFIGURE" ; then
+ logsave=$(patch -p1 < "$PAM_CONFIGURE" 2>&1 || true)
+ if [[ -n ${logsave} ]] ; then
+ ${LOG} "In directory $(pwd)"
+ ${LOG} "patch -p1 < $PAM_CONFIGURE"
+ ${LOG} "${PN} patch: ${logsave}"
+ fi
+ fi
+}
+
+pkg_prerm_${PN}() {
+ PAM_CONFIGURE="/${datadir_native}/${PN}/pam.configure"
+ if [[ -n $D ]] ; then
+ LOG='printf %s\n'
+ PAM_CONFIGURE="$D${PAM_CONFIGURE}"
+ cd $D
+ else
+ LOG="logger -s -p user.info -t opkg\ libpwquality"
+ cd /
+ fi
+ logsave=$(patch -p1 -R < "$PAM_CONFIGURE" 2>&1 || true)
+ if [[ -n ${logsave} ]] ; then
+ ${LOG} "In directory $(pwd)"
+ ${LOG} "patch -p1 -R < "$PAM_CONFIGURE""
+ ${LOG} "${PN} remove patch: ${logsave}"
+ fi
+}