comparison Makefile @ 2:ecf6bac512ae default tip

cleanup make for c6/c7/fedora
author Carl Byington <carl@five-ten-sg.com>
date Tue, 14 Mar 2017 18:42:47 -0700
parents 0e3c9806a620
children
comparison
equal deleted inserted replaced
1:0e3c9806a620 2:ecf6bac512ae
3 # 3 #
4 4
5 r := $(shell grep Wrote: mylog | grep -v debuginfo | awk '{print $$2}') 5 r := $(shell grep Wrote: mylog | grep -v debuginfo | awk '{print $$2}')
6 b := $(shell basename ${r}) 6 b := $(shell basename ${r})
7 m := google-authenticator.pp 7 m := google-authenticator.pp
8 c6 := $(shell grep -q 'CentOS .* 6' /etc/system-release && echo 1 || echo 0)
9 sy := $(shell which systemctl 2>/dev/null)
8 10
9 all: 11 all:
10 yum -y install pam-devel selinux-policy-devel 12 yum -y install pam-devel selinux-policy-devel qrencode-devel
11 rpmbuild --rebuild google-authenticator-1.0-0.gita096a62.fc24.6.src.rpm >mylog 2>&1 13 rpmbuild --rebuild google-authenticator-1.0-0.gita096a62.fc24.6.src.rpm >mylog 2>&1
12 grep Wrote: mylog 14 grep Wrote: mylog
13 make -f /usr/share/selinux/devel/Makefile 15 [ ${c6} -eq 1 ] && make -f /usr/share/selinux/devel/Makefile
14 16
15 install: 17 install:
16 [ -f ${r} ] || /bin/false 18 [ -f ${r} ] || /bin/false
17 yum -y install ${r} 19 yum -y install ${r}
18 semodule -i ${m} 20 [ ${c6} -eq 1 ] && semodule -i ${m}
19 sed -i -e 's/PAM-1.0/PAM-1.0\nauth required pam_google_authenticator.so nullok/g' /etc/pam.d/sshd 21 sed -i -e 's/PAM-1.0/PAM-1.0\nauth required pam_google_authenticator.so nullok/g' /etc/pam.d/sshd
20 sed -i -e 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config 22 sed -i -e 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config
21 service sshd restart 23 [ -z "${sy}" ] && service sshd restart || systemctl restart sshd.service
22
23 install-centos7:
24 [ -f ${r} ] || /bin/false
25 yum -y install ${r}
26 sed -i -e 's/PAM-1.0/PAM-1.0\nauth required pam_google_authenticator.so nullok/g' /etc/pam.d/sshd
27 sed -i -e 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config
28 systemctl restart sshd.service
29 24
30 setup: 25 setup:
31 google-authenticator 26 google-authenticator
32 # authenticator setup creates the file with the wrong label. 27 # authenticator setup creates the file with the wrong label on C6
33 restorecon ~/.google_authenticator 28 restorecon ~/.google_authenticator
34 29
35 30
36 install-remote: 31 install-remote:
37 scp ${r} ${m} $$target:/tmp 32 scp ${r} ${m} $$target:/tmp