summaryrefslogblamecommitdiffstats
path: root/modules.d/slx-dmsetup/module-setup.sh
blob: 99c1adf2b67879a297e498b80fbc8546ddac9964 (plain) (tree)
1
2
3
4
5
6
7
8
9




                   
                                

           
                                                                                   
 






                                                                  
                                                                                
                                                         
                                                                                      
 
                                    
                                     
                                              
 

                                                                      

                 
                                                                                  
                  

                                                           
                        
 
#!/usr/bin/env bash
check() {
	return 255
}
depends() {
	echo "haveged slx-tools"
}
install() {
	inst "$moddir/hooks/dmsetup-slx-device" "/usr/local/bin/dmsetup-slx-device"

	# Grows the rootfs to match the underlying blockdev
	_name="s3-grow-rootfs"
	inst "$moddir/hooks/${_name}.sh" \
			"/usr/local/bin/${_name}.sh"
	inst_simple "${moddir}/services/${_name}.service" \
			"${systemdsystemunitdir}/${_name}.service"
	mkdir --parents \
			"${initdir}/${systemdsystemunitdir}/initrd.target.wants"
	ln_r "${systemdsystemunitdir}/${_name}.service" \
			"${systemdsystemunitdir}/initrd.target.wants/${_name}.service"

	inst_multiple blockdev xxd \
		mkfs.ext4 resize2fs \
		mkfs.xfs xfs_repair xfs_growfs

	# TODO properly find binary in PATH + /opt/openslx/{s,}bin etc
	inst /opt/openslx/sbin/ntfsfree /usr/local/bin/ntfsfree
}
installkernel() {
	# install those modules in case the used kernel does not have them builtin
	instmods \
		dm-thin-pool dm-snapshot dm-zero dm-crypt \
		crc32c xts aes drbg ansi_cprng \
		xfs ext4
}