Description: Add the raidautorun builtin command
Origin: https://build.opensuse.org/projects/openSUSE:Leap:42.3:Update/packages/sash/files/sash-raid.diff

--- a/sash.c
+++ b/sash.c
@@ -285,6 +285,14 @@ static const CommandEntry	commandEntryTa
 		""
 	},
 
+#if	HAVE_LINUX_RAID
+	{
+		"-raidautorun",		do_raidautorun,	1,	1,
+		"Configure the RAID devices",
+		""
+	},
+#endif
+
 	{
 		"-rm",		do_rm,		2,	INFINITE_ARGS,
 		"Remove the specified files",
@@ -1312,6 +1320,26 @@ do_unalias(int argc, const char ** argv)
 }
 
 
+#if	HAVE_LINUX_RAID
+/*
+ * Configure the RAID devices.
+ */
+int
+do_raidautorun(int argc, const char ** argv)
+{
+	int fd = open("/dev/md0", O_RDWR);
+
+	if(fd >= 0)
+	{
+		ioctl(fd , RAID_AUTORUN, 0);
+		close(fd);
+	}
+
+  return 0;
+}
+#endif
+
+
 /*
  * Display the prompt string.
  */
--- a/sash.h
+++ b/sash.h
@@ -26,6 +26,12 @@
 #include <malloc.h>
 #endif
 
+#if HAVE_LINUX_RAID
+#include <sys/ioctl.h>
+#include <linux/major.h>
+#include <linux/raid/md_u.h>
+#endif
+
 
 #define	PATH_LEN	1024
 #define	CMD_LEN		10240
@@ -67,6 +73,7 @@ extern	int	do_prompt(int argc, const cha
 extern	int	do_source(int argc, const char ** argv);
 extern	int	do_umask(int argc, const char ** argv);
 extern	int	do_unalias(int argc, const char ** argv);
+extern	int	do_raidautorun(int argc, const char ** argv);
 extern	int	do_help(int argc, const char ** argv);
 extern	int	do_ln(int argc, const char ** argv);
 extern	int	do_cp(int argc, const char ** argv);
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ HAVE_LINUX_CHROOT	= 1
 HAVE_LINUX_LOSETUP	= 1
 HAVE_LINUX_PIVOT	= 1
 HAVE_LINUX_MOUNT	= 1
+HAVE_LINUX_RAID		= 1
 HAVE_BSD_MOUNT		= 0
 MOUNT_TYPE		= '"ext4"'
 
@@ -36,6 +37,7 @@ DEFS = \
  	-DHAVE_LINUX_LOSETUP=$(HAVE_LINUX_LOSETUP) \
  	-DHAVE_LINUX_PIVOT=$(HAVE_LINUX_PIVOT) \
 	-DHAVE_LINUX_MOUNT=$(HAVE_LINUX_MOUNT) \
+	-DHAVE_LINUX_RAID=$(HAVE_LINUX_RAID) \
 	-DHAVE_BSD_MOUNT=$(HAVE_BSD_MOUNT) \
 	-DMOUNT_TYPE=$(MOUNT_TYPE)
 
