diff options
author | Bill Nottingham <notting@redhat.com> | 2010-10-26 15:21:05 -0400 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2010-10-26 15:33:00 -0400 |
commit | 7577c483e62806140a278d2eb9147ce835893f7c (patch) | |
tree | 306a9ee579c677b7ab91c6a2e82a13ea9cc85968 | |
parent | b6788fc6a4089bbf538664bb814d81475c4ffa96 (diff) | |
download | initscripts-7577c483e62806140a278d2eb9147ce835893f7c.tar initscripts-7577c483e62806140a278d2eb9147ce835893f7c.tar.gz initscripts-7577c483e62806140a278d2eb9147ce835893f7c.tar.bz2 initscripts-7577c483e62806140a278d2eb9147ce835893f7c.tar.xz initscripts-7577c483e62806140a278d2eb9147ce835893f7c.zip |
Drop fedora-mountall, fedora-cleanup. Adjust other services accordingly.
systemd can do mount & fsck & quota, etc. now.
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | systemd/fedora-cleanup | 58 | ||||
-rwxr-xr-x | systemd/fedora-mountall | 243 | ||||
-rw-r--r-- | systemd/system/fedora-autoswap.service | 4 | ||||
-rw-r--r-- | systemd/system/fedora-cleanup.service | 13 | ||||
-rw-r--r-- | systemd/system/fedora-mountall.service | 14 | ||||
-rw-r--r-- | systemd/system/fedora-readonly.service | 5 |
7 files changed, 4 insertions, 335 deletions
@@ -129,8 +129,6 @@ install: ln -s ../fedora-loadmodules.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-autoswap.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-sysinit-hack.service $(ROOT)/lib/systemd/system/basic.target.wants - ln -s ../fedora-cleanup.service $(ROOT)/lib/systemd/system/local-fs.target.wants - ln -s ../fedora-mountall.service $(ROOT)/lib/systemd/system/local-fs.target.wants ln -s ../fedora-readonly.service $(ROOT)/lib/systemd/system/local-fs.target.wants ln -s ../fedora-storage-init.service $(ROOT)/lib/systemd/system/local-fs.target.wants ln -s ../fedora-wait-storage.service $(ROOT)/lib/systemd/system/local-fs.target.wants diff --git a/systemd/fedora-cleanup b/systemd/fedora-cleanup deleted file mode 100755 index 4f6b8c0d..00000000 --- a/systemd/fedora-cleanup +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# Clean out various old state. -# - -SELINUX_STATE= -if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then - if [ -r "/selinux/enforce" ] ; then - SELINUX_STATE=$(cat "/selinux/enforce") - else - # assume enforcing if you can't read it - SELINUX_STATE=1 - fi -fi - -# Clean out /. -rm -f /fastboot /fsckoptions /forcefsck /.autofsck /forcequotacheck /halt \ - /poweroff /.suspended &> /dev/null - -# Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might... -_NEED_XFILES= -[ -f /var/run/utmpx ] || [ -f /var/log/wtmpx ] && _NEED_XFILES=1 - -# Clean up /var. -rm -rf /var/lock/cvs/* /var/run/screen/* -find /var/lock /var/run ! -type d -exec rm -f {} \; -rm -f /var/lib/rpm/__db* &> /dev/null -rm -f /var/gdm/.gdmfifo &> /dev/null - -# Clean up utmp/wtmp -> /var/run/utmp -touch /var/log/wtmp /var/log/btmp -chgrp utmp /var/run/utmp /var/log/wtmp /var/log/btmp -chmod 0664 /var/run/utmp /var/log/wtmp -chmod 0600 /var/log/btmp -if [ -n "$_NEED_XFILES" ]; then - > /var/run/utmpx - touch /var/log/wtmpx - chgrp utmp /var/run/utmpx /var/log/wtmpx - chmod 0664 /var/run/utmpx /var/log/wtmpx -fi -[ -n "$SELINUX_STATE" ] && restorecon /var/run/utmp* /var/log/wtmp* >/dev/null 2>&1 - -# Clean up various /tmp bits -[ -n "$SELINUX_STATE" ] && restorecon /tmp -rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* -rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \ - /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \ - /tmp/scrollkeeper-* /tmp/ssh-* \ - /dev/.in_sysinit - -# Make ICE directory -mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1 -chown root:root /tmp/.ICE-unix -[ -n "$SELINUX_STATE" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1 - -# create the crash indicator flag to warn on crashes, offer fsck with timeout -touch /.autofsck &> /dev/null diff --git a/systemd/fedora-mountall b/systemd/fedora-mountall deleted file mode 100755 index e66c0b2b..00000000 --- a/systemd/fedora-mountall +++ /dev/null @@ -1,243 +0,0 @@ -#!/bin/bash -# -# fsck, mount, set quotas, and relabel filesystems. -# - -. /etc/init.d/functions - -PLYMOUTH= -[ -x /usr/bin/plymouth ] && PLYMOUTH=yes - -# Check SELinux status -SELINUX_STATE= -if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then - if [ -r "/selinux/enforce" ] ; then - SELINUX_STATE=$(cat "/selinux/enforce") - else - # assume enforcing if you can't read it - SELINUX_STATE=1 - fi -fi - -disable_selinux() { - echo $"*** Warning -- SELinux is active" - echo $"*** Disabling security enforcement for system recovery." - echo $"*** Run 'setenforce 1' to reenable." - echo "0" > "/selinux/enforce" -} - -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" > /selinux/enforce - [ -n "$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." - - /sbin/fixfiles -F restore > /dev/null 2>&1 - fi - rm -f /.autorelabel - echo $"Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo $"Automatic reboot in progress." - reboot -f -} - -[ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline) - -if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then - fastboot=yes -fi - -if [ -f /fsckoptions ]; then - fsckoptions=$(cat /fsckoptions) -fi - -if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then - fsckoptions="-f $fsckoptions" -elif [ -f /.autofsck ]; then - [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck - if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then - AUTOFSCK_OPT="$AUTOFSCK_OPT -f" - fi - if [ -n "$AUTOFSCK_SINGLEUSER" ]; then - [ -n "$PLYMOUTH" ] && plymouth --hide-splash - echo - echo $"*** Warning -- the system did not shut down cleanly. " - echo $"*** Dropping you to a shell; the system will continue" - echo $"*** when you leave the shell." - [ -n "$SELINUX_STATE" ] && echo "0" > /selinux/enforce - sulogin - [ -n "$SELINUX_STATE" ] && echo "1" > /selinux/enforce - [ -n "$PLYMOUTH" ] && plymouth --show-splash - fi - fsckoptions="$AUTOFSCK_OPT $fsckoptions" -fi - -if [ "$BOOTUP" = "color" ]; then - fsckoptions="-C $fsckoptions" -else - fsckoptions="-V $fsckoptions" -fi - -READONLY= -if [ -f /etc/sysconfig/readonly-root ]; then - . /etc/sysconfig/readonly-root -fi -if strstr "$cmdline" readonlyroot ; then - READONLY=yes - [ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable - [ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state -fi -if strstr "$cmdline" noreadonlyroot ; then - READONLY=no -fi - -if [[ " $fsckoptions" != *" -y"* ]]; then - fsckoptions="-a $fsckoptions" -fi - -_RUN_QUOTACHECK=0 -if strstr "$cmdline" forcequotacheck || [ -f /forcequotacheck ] ; then - _RUN_QUOTACHECK=1 -fi -if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then - - STRING=$"Checking filesystems" - echo $STRING - fsck -T -t noopts=_netdev -A $fsckoptions - rc=$? - - if [ "$rc" -eq "0" ]; then - success "$STRING" - echo - elif [ "$rc" -eq "1" ]; then - passed "$STRING" - echo - elif [ "$rc" -eq "2" -o "$rc" -eq "3" ]; then - echo $"Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo $"Automatic reboot in progress." - reboot -f - fi - - # A return of 4 or higher means there were serious problems. - if [ $rc -gt 1 ]; then - [ -n "$PLYMOUTH" ] && plymouth --hide-splash - - failure "$STRING" - echo - echo - echo $"*** An error occurred during the file system check." - echo $"*** Dropping you to a shell; the system will reboot" - echo $"*** when you leave the shell." - - str=$"(Repair filesystem)" - PS1="$str \# # "; export PS1 - [ "$SELINUX_STATE" = "1" ] && disable_selinux - sulogin - - echo $"Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo $"Automatic reboot in progress." - reboot -f - elif [ "$rc" -eq "1" ]; then - _RUN_QUOTACHECK=1 - fi -fi - -remount_needed() { - local state oldifs - [ "$READONLY" = "yes" ] && return 1 - state=$(LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts) - oldifs=$IFS - IFS="," - for opt in $state ; do - if [ "$opt" = "rw" ]; then - IFS=$oldifs - return 1 - fi - done - IFS=$oldifs - return 0 -} - -# Remount the root filesystem read-write. -update_boot_stage RCmountfs -if remount_needed ; then - action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw / -fi - -# Clean up SELinux labels -if [ -n "$SELINUX_STATE" ]; then - restorecon /etc/mtab /etc/ld.so.cache /etc/blkid/blkid.tab /etc/resolv.conf >/dev/null 2>&1 -fi - -# If relabeling, relabel mount points. -if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then - if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then - restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1 - fi -fi - -if [ "$READONLY" != "yes" ] ; then - # Clear mtab - (> /etc/mtab) &> /dev/null - - # Remove stale backups - rm -f /etc/mtab~ /etc/mtab~~ - - # Enter mounted filesystems into /etc/mtab - mount -f / - mount -f /proc >/dev/null 2>&1 - mount -f /sys >/dev/null 2>&1 - mount -f /dev/pts >/dev/null 2>&1 - mount -f /dev/shm >/dev/null 2>&1 - mount -f /proc/bus/usb >/dev/null 2>&1 -fi - -# Mount all other filesystems (except for NFS and /proc, which is already -# mounted). Contrary to standard usage, -# filesystems are NOT unmounted in single user mode. -if [ "$READONLY" != "yes" ] ; then - action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev -else - action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev -fi - -# Update quotas if necessary -if [ X"$_RUN_QUOTACHECK" = X1 ] && [ -x /sbin/quotacheck ]; then - action $"Checking local filesystem quotas: " /sbin/quotacheck -anug -fi - -if [ -x /sbin/quotaon ]; then - action $"Enabling local filesystem quotas: " /sbin/quotaon -aug -fi - -# Check to see if a full relabel is needed -if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then - if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then - relabel_selinux - fi -else - if [ "$READONLY" != "yes" ] && [ -d /etc/selinux ]; then - [ -f /.autorelabel ] || touch /.autorelabel - fi -fi diff --git a/systemd/system/fedora-autoswap.service b/systemd/system/fedora-autoswap.service index c5087967..8cd881d9 100644 --- a/systemd/system/fedora-autoswap.service +++ b/systemd/system/fedora-autoswap.service @@ -3,8 +3,8 @@ Description=Enable all detected swap partitions DefaultDependencies=no Conflicts=shutdown.target Before=shutdown.target emergency.service emergency.target -After=fedora-mountall.service fedora-init-crypto-3.service -Requires=fedora-mountall.service fedora-init-crypto-3.service +After=local-fs.target fedora-init-crypto-3.service +Requires=local-fs.target fedora-init-crypto-3.service [Service] ExecStart=/lib/systemd/fedora-autoswap diff --git a/systemd/system/fedora-cleanup.service b/systemd/system/fedora-cleanup.service deleted file mode 100644 index 3bbb12df..00000000 --- a/systemd/system/fedora-cleanup.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Clean out assorted temporary files -DefaultDependencies=no -Conflicts=shutdown.target -Before=shutdown.target emergency.service emergency.target local-fs.target -After=fedora-mountall.service fedora-readonly.service -Requires=fedora-mountall.service - -[Service] -ExecStart=/lib/systemd/fedora-cleanup -Type=oneshot -TimeoutSec=0 -RemainAfterExit=yes diff --git a/systemd/system/fedora-mountall.service b/systemd/system/fedora-mountall.service deleted file mode 100644 index af5cf79b..00000000 --- a/systemd/system/fedora-mountall.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Check, mount, and relabel all filesystems -DefaultDependencies=no -Conflicts=shutdown.target -Before=shutdown.target emergency.service emergency.target remount-rootfs.service -After=fedora-storage-init.service fedora-init-crypto-2.service -Requires=fedora-storage-init.service fedora-init-crypto-2.service - -[Service] -ExecStart=/lib/systemd/fedora-mountall -Type=oneshot -TimeoutSec=0 -RemainAfterExit=yes -StandardInput=tty diff --git a/systemd/system/fedora-readonly.service b/systemd/system/fedora-readonly.service index c1e42367..eca197f0 100644 --- a/systemd/system/fedora-readonly.service +++ b/systemd/system/fedora-readonly.service @@ -2,9 +2,8 @@ Description=Configure read-only root support DefaultDependencies=no Conflicts=shutdown.target -Before=shutdown.target emergency.service emergency.target fedora-cleanup.service -After=fedora-mountall.service -Requires=fedora-mountall.service +Before=shutdown.target emergency.service emergency.target systemd-tmpfiles-setup.service +After=remount-rootfs.service [Service] ExecStart=/lib/systemd/fedora-readonly |