ShadowArch/ShadowArch/Makefile

43 lines
2.2 KiB
Makefile

HTTPROOT = /srv/http/aninix.net
HTTPUSER = http
SYNCLIST = /etc/vimrc /etc/bashrc /etc/skel /etc/tmux.conf /etc/profile
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
compile: ./shadowarch
@echo Nothing to compile
install: compile
for i in ${SYNCLIST}; do rsync -avz -r `echo $$i | sed 's#^/etc/##'` $$i; done
# This is a nicety.
if [ -f /root/shadowarch* ]; then sed -i 's/`uname -o`/ShadowArch/g' /etc/bash.bashrc; fi
repository: shadowarch ${HTTPROOT}
cp ./shadowarch ${HTTPROOT}
checkperm: ${SYNCLIST}
printf "What is your deprivileged user? "; read user; chown -R ${user}:${user} .
if [ -f ${HTTPROOT}/shadowarch ]; then chmod 0755 ${HTTPROOT}/shadowarch; chown ${HTTPUSER} ${HTTPROOT}/shadowarch; fi
chown -R root:root ${SYNCLIST}
for i in ${SYNCLIST}; do if [ -f "${i}" ]; then chmod 0644 "${i}"; elif [ -d "${i}" ]; then chmod 0755 "${i}"; fi; done
test:
bash -n shadowarch
bash ./shadowarch -h
echo Success.
reverse: ${HTTPROOT}/shadowarch ${SYNCLIST}
cat ${HTTPROOT}/shadowarch > ./shadowarch
for i in ${SYNCLIST}; do rsync -avz ${SYNCLIST} .; done
sed -i 's/ShadowArch/`uname -o`/' ./bash.bashrc
clean:
if [ -f /etc/bash.bashrc ]; then printf "Remove /etc/bash.bashrc? [y/n] "; read answer; if [ "$$answer" == "y" ]; then rm /etc/bash.bashrc; fi; fi
diff: ${HTTPROOT}/shadowarch ${SYNCLIST}
diff ./shadowarch ${HTTPROOT}/shadowarch
for i in ${SYNCLIST}; do diff "$$i" ./`echo $$i | rev | cut -f 1 -d '/' | rev` || [ 1 -eq 1 ]; done
find-missing-hooks-in-src:
@for i in `wget -q -O - https://aninix.net/foundation/ | grep toplevel-repo | cut -f 4 -d \'`; do if [ -z $$i ]; then continue; fi; for file in `find ../.. -type f -name Makefile | grep $$i`; do if [ -z "$$file" ]; then echo NO MAKEFILE FOR $$i; elif [ `grep -c -i 'hook for systemd' $$file` -eq 0 ]; then echo HOOK MISSING IN: $$file; else echo HOOK FOUND IN: $$file; fi; done; done
@for i in `wget -q -O - https://aninix.net/foundation/ | grep toplevel-repo | cut -f 4 -d \'`; do if [ -z $$i ]; then continue; fi; for file in `find ../.. -type f -name Makefile | grep $$i`; do if [ -z "$$file" ]; then echo NO MAKEFILE FOR $$i; elif [ `grep -c useradd $$file` -eq 0 ]; then echo DEPRIV MISSING IN: $$file; else echo DEPRIV FOUND IN: $$file; fi; done; done