#!/bin/bash # # Do automatic relabelling # . /etc/init.d/functions # If the user has this (or similar) UEFI boot order: # # Windows | grub | Linux # # And decides to boot into grub/Linux, then the reboot at the end of autorelabel # would cause the system to boot into Windows again, if the autorelabel was run. # # This function restores the UEFI boot order, so the user will boot into the # previously set (and expected) partition. efi_set_boot_next() { # NOTE: The [ -x /usr/sbin/efibootmgr ] test is not sufficent -- it could # succeed even on system which is not EFI-enabled... if ! efibootmgr > /dev/null 2>&1; then return fi # NOTE: It it possible that some other services might be setting the # 'BootNext' item for any reasons, and we shouldn't override it if so. if ! efibootmgr | grep --quiet -e 'BootNext'; then CURRENT_BOOT="$(efibootmgr | grep -e 'BootCurrent' | sed -re 's/(^.+:[[:space:]]*)([[:xdigit:]]+)/\2/')" efibootmgr -n "${CURRENT_BOOT}" > /dev/null 2>&1 fi } relabel_selinux() { # if /sbin/init is not labeled correctly this process is running in the # wrong context, so a reboot will be required after relabel AUTORELABEL= . /etc/selinux/config echo "0" > /sys/fs/selinux/enforce [ -x /bin/plymouth ] && plymouth --hide-splash if [ "$AUTORELABEL" = "0" ]; then echo echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required. " echo $"*** /etc/selinux/config indicates you want to manually fix labeling" echo $"*** problems. Dropping you to a shell; the system will reboot" echo $"*** when you leave the shell." sulogin else echo echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required." echo $"*** Relabeling could take a very long time, depending on file" echo $"*** system size and speed of hard drives." FORCE=`cat /.autorelabel` [ -x "/usr/sbin/quotaoff" ] && /usr/sbin/quotaoff -aug /sbin/fixfiles $FORCE restore > /dev/null 2>&1 fi rm -f /.autorelabel /usr/lib/dracut/dracut-initramfs-restore efi_set_boot_next sync systemctl --force reboot } # Check to see if a full relabel is needed if [ "$READONLY" != "yes" ]; then restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1 relabel_selinux fi
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
catalog | Folder | 0755 |
|
|
ntp-units.d | Folder | 0755 |
|
|
scripts | Folder | 0755 |
|
|
system | Folder | 0755 |
|
|
system-generators | Folder | 0755 |
|
|
system-preset | Folder | 0755 |
|
|
system-shutdown | Folder | 0755 |
|
|
system-sleep | Folder | 0755 |
|
|
user | Folder | 0755 |
|
|
user-generators | Folder | 0755 |
|
|
user-preset | Folder | 0755 |
|
|
import-pubring.gpg | File | 9.33 KB | 0644 |
|
rhel-autorelabel | File | 2.31 KB | 0755 |
|
rhel-configure | File | 399 B | 0755 |
|
rhel-dmesg | File | 110 B | 0755 |
|
rhel-domainname | File | 158 B | 0755 |
|
rhel-import-state | File | 1.03 KB | 0755 |
|
rhel-loadmodules | File | 233 B | 0755 |
|
rhel-readonly | File | 5.77 KB | 0755 |
|
systemd | File | 1.56 MB | 0755 |
|
systemd-ac-power | File | 23.41 KB | 0755 |
|
systemd-activate | File | 68.52 KB | 0755 |
|
systemd-backlight | File | 73.02 KB | 0755 |
|
systemd-binfmt | File | 60.73 KB | 0755 |
|
systemd-bootchart | File | 125.05 KB | 0755 |
|
systemd-cgroups-agent | File | 35.91 KB | 0755 |
|
systemd-coredump | File | 129.86 KB | 0755 |
|
systemd-cryptsetup | File | 101.28 KB | 0755 |
|
systemd-fsck | File | 331.23 KB | 0755 |
|
systemd-hibernate-resume | File | 39.95 KB | 0755 |
|
systemd-hostnamed | File | 367.16 KB | 0755 |
|
systemd-importd | File | 367.75 KB | 0755 |
|
systemd-initctl | File | 309.84 KB | 0755 |
|
systemd-journald | File | 338.05 KB | 0755 |
|
systemd-localed | File | 375.22 KB | 0755 |
|
systemd-logind | File | 624.84 KB | 0755 |
|
systemd-machine-id-commit | File | 52.19 KB | 0755 |
|
systemd-machined | File | 482.01 KB | 0755 |
|
systemd-modules-load | File | 64.8 KB | 0755 |
|
systemd-pull | File | 183.14 KB | 0755 |
|
systemd-quotacheck | File | 43.96 KB | 0755 |
|
systemd-random-seed | File | 48.13 KB | 0755 |
|
systemd-readahead | File | 97.51 KB | 0755 |
|
systemd-remount-fs | File | 56.52 KB | 0755 |
|
systemd-reply-password | File | 35.93 KB | 0755 |
|
systemd-rfkill | File | 60.74 KB | 0755 |
|
systemd-shutdown | File | 146.76 KB | 0755 |
|
systemd-shutdownd | File | 64.52 KB | 0755 |
|
systemd-sleep | File | 89.16 KB | 0755 |
|
systemd-socket-proxyd | File | 105.52 KB | 0755 |
|
systemd-sysctl | File | 64.83 KB | 0755 |
|
systemd-sysv-install | File | 40.22 KB | 0755 |
|
systemd-timedated | File | 375.91 KB | 0755 |
|
systemd-udevd | File | 406.45 KB | 0755 |
|
systemd-update-done | File | 44.07 KB | 0755 |
|
systemd-update-utmp | File | 309.87 KB | 0755 |
|
systemd-user-sessions | File | 44.16 KB | 0755 |
|
systemd-vconsole-setup | File | 52.2 KB | 0755 |
|