mdadm: Fix missing conffile and add initscript
Start arrays on boot, stop them on shutdown, and enable monitoring to syslog. Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
This commit is contained in:
		 Daniel Dickinson
					Daniel Dickinson
				
			
				
					committed by
					
						 Jo-Philipp Wich
						Jo-Philipp Wich
					
				
			
			
				
	
			
			
			 Jo-Philipp Wich
						Jo-Philipp Wich
					
				
			
						parent
						
							3015af9647
						
					
				
				
					commit
					3e08637e87
				
			| @@ -33,6 +33,11 @@ define Package/mdadm/description | |||||||
|  A tool for managing Linux Software RAID arrays. |  A tool for managing Linux Software RAID arrays. | ||||||
| endef | endef | ||||||
|  |  | ||||||
|  | define Package/mdadm/conffiles | ||||||
|  | /etc/mdadm.conf | ||||||
|  | /etc/config/mdadm | ||||||
|  | endef | ||||||
|  |  | ||||||
| TARGET_CFLAGS += -ffunction-sections -fdata-sections | TARGET_CFLAGS += -ffunction-sections -fdata-sections | ||||||
| TARGET_LDFLAGS += -Wl,--gc-sections | TARGET_LDFLAGS += -Wl,--gc-sections | ||||||
|  |  | ||||||
| @@ -47,6 +52,10 @@ endef | |||||||
| define Package/mdadm/install | define Package/mdadm/install | ||||||
| 	$(INSTALL_DIR) $(1)/sbin | 	$(INSTALL_DIR) $(1)/sbin | ||||||
| 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdadm $(1)/sbin | 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdadm $(1)/sbin | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/init.d | ||||||
|  | 	$(INSTALL_BIN) ./files/mdadm.init $(1)/etc/init.d/mdadm | ||||||
|  | 	$(INSTALL_DIR) $(1)/etc/config | ||||||
|  | 	$(INSTALL_DATA) ./files/mdadm.config $(1)/etc/config/mdadm | ||||||
| endef | endef | ||||||
|  |  | ||||||
| $(eval $(call BuildPackage,mdadm)) | $(eval $(call BuildPackage,mdadm)) | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								package/utils/mdadm/files/mdadm.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								package/utils/mdadm/files/mdadm.config
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | config mdadm | ||||||
|  | 	option email root | ||||||
|  |  | ||||||
							
								
								
									
										34
									
								
								package/utils/mdadm/files/mdadm.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								package/utils/mdadm/files/mdadm.init
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | |||||||
|  | #!/bin/sh /etc/rc.common | ||||||
|  |  | ||||||
|  | START=13 | ||||||
|  | STOP=98 | ||||||
|  |  | ||||||
|  | USE_PROCD=1 | ||||||
|  | PROG=/sbin/mdadm | ||||||
|  | NAME=mdadm | ||||||
|  |  | ||||||
|  | mdadm_email() { | ||||||
|  | 	local cfg="$1" | ||||||
|  | 	if [ ! -x /sbin/sendmail ]; then | ||||||
|  | 		return | ||||||
|  | 	fi | ||||||
|  | 	config_get email "$cfg" email | ||||||
|  | } | ||||||
|  |  | ||||||
|  | start_service() { | ||||||
|  | 	local email | ||||||
|  |  | ||||||
|  | 	config_load mdadm | ||||||
|  | 	config_foreach mdadm_email mdadm | ||||||
|  |  | ||||||
|  | 	$PROG --assemble --scan | ||||||
|  |  | ||||||
|  | 	procd_open_instance | ||||||
|  | 	procd_set_param command "$PROG" --monitor ${email:+--mail=$email} --syslog --scan | ||||||
|  | 	procd_close_instance | ||||||
|  | } | ||||||
|  |  | ||||||
|  | stop_service() { | ||||||
|  | 	$PROG --stop --scan | ||||||
|  | } | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user