# $HeadURL$ $LastChangedRevision$ ifndef FACILITY_NETWORK_MK FACILITY_NETWORK_MK = 1 # In pass #1: load recipe generators # In pass #0: load generated recipes include method-service.mk include file-tradnics.mk include file-traddnss.mk include file-nmnics.mk include file-nmdnss.mk include file-hosts.mk include method-copy.mk # Do not install stuff in this facility; the network may be down! # Variables mentioned both in pass#1 and pass#0. # Tell recipe generators what to generate recipes for ifeq ($(PCMS_PASS_NUM),1) all.service: networking.service all.copy: $(shell encode /etc/NetworkManager/conf.d/stop-nm-automatically-managing-wired-connections.conf).copy # No .install targets allowed here! # The real Makefile else ifeq ($(PCMS_PASS_NUM),0) all.facility: network.facility network.facility: hosts.file drivers.facility purge-nm-config.fix ifneq ($(TRADNICENT_FILES),) network.facility: tradnics.file endif ifneq ($(TRADDNSENT_FILES),) network.facility: traddnss.file endif ifneq ($(NMNICENT_FILES),) network.facility: nmnics.file endif ifneq ($(NMDNSENT_FILES),) network.facility: nmdnss.file endif # Recipe is the same everywhere network.facility: msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) info "restarting networking with 10s settle time ..." systemctl restart networking sleep 10 netreach --debug=$(VERBOSELEVEL) internet msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) info "networking has been restarted" touch $@ # purge-nm-config.fix is a dependency of configuring individual NM-managed NICs *and* individual # tradnic entries in /etc/network/interfaces. *This* file is the 'lowest' file that controls # both those things, so it's the best place to put the recipe for purge-nm-config.fix. purge-nm-config.fix: $(shell encode /etc/NetworkManager/conf.d/stop-nm-automatically-managing-wired-connections.conf).copy @# can't use xargs to process list as listy may be empty and xargs can't handle that. msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) info "purging network-manager configuration ..." if type -p nmcli > /dev/null; then \ nmcli -t conn show | cut -f1 -d: | while read CONN_NAME; do nmcli conn delete "$$CONN_NAME" > /dev/null; done; \ fi touch $@ # Ordering tradnics.file nmnics.file traddns.file nmdns.file: purge-nm-config.fix endif # PCMS_PASS_NUM endif # FACILITY_NETWORK_MK