]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
use /proc/sys/kernel/dmesg_restrict to set file mode for /var/log/dmesg
authorElan Ruusamäe <glen@delfi.ee>
Thu, 16 Oct 2014 07:56:53 +0000 (10:56 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Thu, 22 Jan 2015 16:01:18 +0000 (18:01 +0200)
rc.d/rc.sysinit

index e14ad740b0d3e6ba51f2d419f599273119a35c2e..6da057581ff3edf4bdc6b219e0df994418efef8a 100755 (executable)
@@ -1062,17 +1062,20 @@ if ! is_yes "$VSERVER"; then
 
        # Now that we have all of our basic modules loaded and the kernel going,
        # let's dump the syslog ring somewhere so we can find it later
+       mode=0600
+       if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then
+               mode=0644
+       fi
        dmesg --raw > /var/log/dmesg
+       chmod $mode /var/log/dmesg
        i=5
        while [ $i -ge 0 ]; do
                if [ -f /var/log/dmesg.$i ]; then
-                       chmod 0600 /var/log/dmesg.$i
                        mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
                fi
                i=$(($i-1))
        done
-       cp -f /var/log/dmesg /var/log/dmesg.0
-       chmod 0600 /var/log/dmesg /var/log/dmesg.0
+       cp -pf /var/log/dmesg /var/log/dmesg.0
 else
        emit --no-wait all-swaps
 fi
This page took 0.089118 seconds and 4 git commands to generate.