| 1 | current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) |
| 2 | |
| 3 | .PHONY: all root slave bios initrd clean |
| 4 | help: |
| 5 | @echo This make file contains severals targets: |
| 6 | @echo ' - help: print this help;' |
| 7 | @echo ' - root: creates root tarball;' |
| 8 | @echo ' - slave: creates slave tarballs;' |
| 9 | @echo ' - bios: creates bios tarball;' |
| 10 | @echo ' - initrd: update initrd;' |
| 11 | @echo ' - clean: remove created tarballs, and cleanup file system in order to build ISO.' |
| 12 | |
| 13 | |
| 14 | all: root slave bios |
| 15 | |
| 16 | root slave bios: |
| 17 | $(current_dir)bin/create_$@_tarball.sh |
| 18 | |
| 19 | initrd: |
| 20 | update-initramfs -u |
| 21 | |
| 22 | clean: |
| 23 | service trc6500 stop |
| 24 | -rm /opt/tftp/*.tgz |
| 25 | aptitude remove $(shell apt-mark showmanual trc6500\*|egrep -v webconfig\|rproxy) ace tao myccm |
| 26 | aptitude clean |
| 27 | mv -f /etc/apt/sources.list.d/reseau_integration.list /etc/apt/sources.list.d/reseau_integration.list~ |
| 28 | cp -f /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf |
| 29 | chown webconfig: /etc/dhcp/dhcpd.conf* |
| 30 | echo "Etc/Zulu" > /etc/timezone |
| 31 | sed -i 's/XKBLAYOUT=.*/XKBLAYOUT="us"/;s/XKBVARIANT=.*/XKBVARIANT=""/;s/XKBOPTIONS=.*/XKBOPTIONS=""/' /etc/default/keyboard |
| 32 | find -P /dump/ -mindepth 2 -maxdepth 2 -print -exec rm -rf -v {} \; |
| 33 | find -P /home/ -mindepth 1 -maxdepth 1 ! -wholename '/home/trc6500' -exec rm -rf -v {} \; |
| 34 | find -P /opt/ -mindepth 1 -maxdepth 1 -regextype posix-egrep ! -regex '.*/(bios|cluster|ipmi|tftp)$$' -exec rm -rf -v {} \; |
| 35 | find -P /root/ -mindepth 1 -maxdepth 1 -name ".*" -o -name bin -o -exec rm -rf -v {} \; |
| 36 | -mkdir --parents /opt/trc6500/debian-rep |
| 37 | rm -f /root/.bash_history |
| 38 | rm -rf $(shell mount|awk '/type ext/ {print $$3 "/lost+found/*"}') |
| 39 | rm -rf /var/lib/nfs/v4recovery/* |
| 40 | find /var/log/ -type f -exec rm -f {} \; |
| 41 | touch /var/log/btmp /var/log/wtmp /var/log/lastlog |
| 42 | chmod ug+rw,o-rw,a-x /var/log/btmp |
| 43 | chmod ug+rw,o+r,o-w,a-x /var/log/wtmp /var/log/lastlog |
| 44 | chown root:utmp /var/log/btmp /var/log/wtmp /var/log/lastlog |
| 45 | find / -name trc6500_list_patched_files.txt -exec rm -f {} \; |
| 46 | echo date +%Y%m%d > /etc/trc6500_os_version |