# HG changeset patch # User Carl Byington # Date 1489542167 25200 # Node ID ecf6bac512ae5bc4862f3c02ae3962674dc2231d # Parent 0e3c9806a620a9adcbcda1171ad6d5936d691a96 cleanup make for c6/c7/fedora diff -r 0e3c9806a620 -r ecf6bac512ae Makefile --- a/Makefile Thu Mar 02 12:45:31 2017 -0800 +++ b/Makefile Tue Mar 14 18:42:47 2017 -0700 @@ -5,31 +5,26 @@ r := $(shell grep Wrote: mylog | grep -v debuginfo | awk '{print $$2}') b := $(shell basename ${r}) m := google-authenticator.pp +c6 := $(shell grep -q 'CentOS .* 6' /etc/system-release && echo 1 || echo 0) +sy := $(shell which systemctl 2>/dev/null) all: - yum -y install pam-devel selinux-policy-devel + yum -y install pam-devel selinux-policy-devel qrencode-devel rpmbuild --rebuild google-authenticator-1.0-0.gita096a62.fc24.6.src.rpm >mylog 2>&1 grep Wrote: mylog - make -f /usr/share/selinux/devel/Makefile + [ ${c6} -eq 1 ] && make -f /usr/share/selinux/devel/Makefile install: [ -f ${r} ] || /bin/false yum -y install ${r} - semodule -i ${m} + [ ${c6} -eq 1 ] && semodule -i ${m} sed -i -e 's/PAM-1.0/PAM-1.0\nauth required pam_google_authenticator.so nullok/g' /etc/pam.d/sshd sed -i -e 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config - service sshd restart - -install-centos7: - [ -f ${r} ] || /bin/false - yum -y install ${r} - sed -i -e 's/PAM-1.0/PAM-1.0\nauth required pam_google_authenticator.so nullok/g' /etc/pam.d/sshd - sed -i -e 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config - systemctl restart sshd.service + [ -z "${sy}" ] && service sshd restart || systemctl restart sshd.service setup: google-authenticator - # authenticator setup creates the file with the wrong label. + # authenticator setup creates the file with the wrong label on C6 restorecon ~/.google_authenticator