]> TLD Linux GIT Repositories - rc-scripts.git/blobdiff - rc.d/rc.sysinit
- disable lock checks (happens on LUKS2 and fails during system boot)
[rc-scripts.git] / rc.d / rc.sysinit
index f7f0eeae19ffc1dda0272ef78a1fc740fc683d07..826b4353e72ef385691a6bbb916aee4906069e08 100755 (executable)
@@ -123,9 +123,7 @@ init_selinux() {
        if ! grep -Fq selinuxfs /proc/filesystems; then
                # no support in kernel, no chance
                SELINUX=no
-       fi
-
-       if ! is_fsmounted selinuxfs /selinux; then
+       elif ! is_fsmounted selinuxfs /selinux; then
                mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
        fi
 
@@ -299,63 +297,26 @@ check_root_fs() {
        fi
 }
 
-# mdadm - manage MD devices aka Linux Software RAID
+# Init software RAID arrays
 init_mdadm() {
-       if [ ! -x /sbin/mdadm -o ! -f /etc/mdadm.conf ]; then
+       local output
+
+       if [ ! -x /sbin/mdadm ]; then
                return
        fi
 
        modprobe -s md
-       local rc=0 golvm=0 have_md=0
        if [ ! -f /proc/mdstat ]; then
                return
        fi
 
-       # assume we have md if at least one ARRAY line is present
-       if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf; then
-               have_md=1
-       fi
-       # configured to do auto scanning
-       if [ $have_md = 0 ] && grep -qE "^([[:blank:]]|)DEVICE[[:blank:]]partitions" /etc/mdadm.conf; then
-               have_md=1
-       fi
-
-       # none found
-       if [ $have_md = 0 ]; then
-               return
-       fi
-
        show "Starting up RAID devices"; busy
-       /sbin/mdadm --assemble --scan --auto=yes
-       rc=$?
-       if [ "$rc" -eq 0 -o "$rc" -eq 2 ]; then
-               # rc is used later too, so set sane value
-               rc=0
-               deltext; ok
-               golvm=1
-       else
-               deltext; fail
-       fi
-
-       # A non-zero return means there were problems
-       if [ $rc -gt 0 ]; then
-               [ -e /proc/splash ] && echo "verbose" > /proc/splash
-               show "Starting up RAID devices"; fail
-
-               PS1="$(nls '(RAID Repair)# ')"; export PS1
-               repair_shell "$(nls '*** An error occurred during the RAID startup.')"
-       fi
+       output=$(/sbin/mdadm --assemble --scan 2>&1)
+       ok
 
-       # LVM on RAID (keep in sync with LVM init)
-       if [ "$golvm" -eq "1" ]; then
-               if [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
-                       run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelocking
-                       run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmsysinit
-                       [ "$lvmversion" = "2" ] && /sbin/vgmknodes
-               fi
+       if [ -n "$output" ]; then
+               echo "$output"
        fi
-       show "Starting up RAID devices"; ok
-       return $rc
 }
 
 # Init LVM
@@ -388,8 +349,10 @@ init_lvm() {
 
        run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelocking
        run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmsysinit
+
        if [ "$lvmversion" = "2" ]; then
-               /sbin/vgmknodes $lvmignorelocking
+               # silently refresh LV /dev nodes (just in case)
+               /sbin/vgmknodes $lvmignorelocking 1>/dev/null 2>&1
                # display VG statistics
                /sbin/vgdisplay -s $lvmignorelocking
        fi
@@ -409,7 +372,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
        parse_cmdline
 
        if [ -d /run ]; then
-               is_fsmounted tmpfs /run || mount -n -t tmpfs run /run
+               is_fsmounted tmpfs /run || mount -n -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev
        fi
 
        # Early sysctls
@@ -425,7 +388,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
 
        init_selinux
 
-       # PLD Linux LiveCD support
+       # TLD Linux LiveCD support
        if [ -x /etc/rc.d/rc.live ]; then
                /etc/rc.d/rc.live
        fi
@@ -456,7 +419,7 @@ fi
 
 
 # Print welcome message
-nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
+nls "\t\t\t%sPowered by %sTLD Linux%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CTLD)" "$(termput op)"
 if ! is_no "$RC_PROMPT"; then
        nls -n "\t\t  Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
        echo
@@ -597,7 +560,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
        _ROOTFS_DEVICE=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $1}' /etc/fstab)
        _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
 
-       if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "aufs" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_TYPE" != "squashfs" -a "$_ROOTFS_PASSNO" != 0 -a -e $_ROOTFS_DEVICE ] && [[ "$container" != lxc* ]]; then
+       if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "aufs" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_TYPE" != "tmpfs" -a "$_ROOTFS_TYPE" != "squashfs" -a "$_ROOTFS_PASSNO" != 0 -a -e $_ROOTFS_DEVICE ] && [[ "$container" != lxc* ]]; then
                check_root_fs
        fi
 
@@ -680,7 +643,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
                mount -f -t devtmpfs devtmpfs /dev 2> /dev/null
        fi
        if is_fsmounted tmpfs /run; then
-               mount -f -t tmpfs run /run 2> /dev/null
+               mount -f -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev 2> /dev/null
        fi
 
        if is_fsmounted usbfs /proc/bus/usb; then
@@ -822,7 +785,10 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
                fi
        fi
 
-       # Init LVM
+       if ! is_no "$MDADM"; then
+               init_mdadm
+       fi
+
        if ! is_no "$LVM2"; then
                init_lvm
        fi
@@ -834,10 +800,6 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
                [ $delay_cryptsetup = 0 ] && ok || fail
        fi
 
-       if ! is_no "$MDADM"; then
-               init_mdadm
-       fi
-
        _RUN_QUOTACHECK=0
        # Check filesystems
        if [ -z "$fastboot" ] && [ -z "$nofsck" ]; then
@@ -952,7 +914,7 @@ if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
                . /etc/rc.d/rc.serial
        fi
 
-       if [ -n "$PANIC_REBOOT_TIME" -a "$PANIC_REBOOT_TIME" -gt "0" -a -f /proc/sys/kernel/panic ]; then
+       if [ -n "$PANIC_REBOOT_TIME" ] && [ "$PANIC_REBOOT_TIME" -gt "0" ] && [ -f /proc/sys/kernel/panic ]; then
                show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
                # DEPRECATED: use /etc/sysctl.conf or kernel commandline instead
                if sysctl -q -w kernel.panic=$PANIC_REBOOT_TIME; then ok; else fail; fi