summaryrefslogblamecommitdiffstats
path: root/modules.d/slx-network/module-setup.sh
blob: 3684d1615dd59dce5a7fe53d4c33aae70aea4fe3 (plain) (tree)
























                                                                                               
                                


                                                                                      
                                                                                                                     
                                                                                                   


                                                                                                            




                                                                              
                                                       

                                                                             

                                                                                            



                                                                                        

               
                                                                          
                           
                                                                        
 
#!/bin/bash
check() {
	[[ $mount_needs ]] && return 1

	if dracut_module_included "network" || dracut_module_included "systemd-networkd" ; then
		derror "This module conflicts with 'network' and 'systemd-networkd'!"
		return 1
	fi
	return 255
}

# called by dracut
depends() {
	echo "busybox kernel-network-modules"
}

# called by dracut
install() {
	# need initqueue to get a clean network start
	dracut_need_initqueue

		# install basic dns libs
	_arch=$(uname -m)
	inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*"

	# stage3 network scripts
	inst "${moddir}/scripts/udhcpc-trigger.stage3" "/usr/local/bin/udhcpc-trigger"

	# files for stage4, park them in /opt/openslx
	inst "${moddir}/scripts/s3-setup-bootif-network.stage4" "/opt/openslx/scripts/s3-setup-bootif-network.stage4"
	inst "${moddir}/scripts/udhcpc-trigger.stage4" "/opt/openslx/scripts/udhcpc-trigger.stage4"
	inst "${moddir}/services/udhcpc-bootif-stage4.service" "/opt/openslx/services/udhcpc-bootif.service"

	# Parse IP config etc. from KCL
	# After cmdline, we need the extracted MAC
	# Before udev, as we generate a udev rule for naming the iface
	slx_service "s3-parse-network-kcl" "Extract network config from KCL" \
		--wafter  "dracut-cmdline.service" \
		--wbefore "systemd-udevd.service"
	# Setup bootif network: bridge, vlan, dhcp, ...
	slx_service "s3-setup-bootif-network" "Configure main network link" \
		--wafter "s3-parse-network-kcl.service"
	# Copy files related to networking. Must be the very last thing before switchroot to
	# make sure nothing else tries to meddle with these after copying, e.g. slx-ssl.
	slx_service "s3-copy-network-files" "Copy networking-related files to stage 4" \
		--after  "s3-ssl-sat.service" \
		--wafter "initrd-root-fs.target" \
		--after  "s3-setup-bootif-network.service"

	# hooks
	inst_hook pre-pivot 10 "${moddir}/hooks/configure-jumbo-frames.sh"
	# DO NOT TOUCH THIS
	inst_hook pre-pivot 60 "${moddir}/hooks/activate-stage4-dhcp.sh"
}