375fc509c5
- Mark all scripts as executable (bnc#887010) * Remove: 0116-81cio_ignore-Mark-scripts-as-executable * Add: 0116-Mark-scripts-as-executable.patch - 95dasd_rules: Enable device before checking type * Add: 0117-95dasd_rules-Enable-the-device-before-checking-devic.patch - 95zfcp_rules: Enable device before checking type * Add: 0118-95zfcp_rules-Enable-the-device-before-checking-devic.patch - Reset IFS variable * Add: 0119-Reset-IFS-variable.patch - Handle module alias properly (bnc#886839) * Add: 0115-Handle-module-alias-properly.patch - 81cio_ignore: Mark scripts as executable (bnc#887010) * Add: 0116-81cio_ignore-Mark-scripts-as-executable.patch - 91zipl: Translate 'ext2' into 'ext4' module * Add: 0114-91zipl-Translate-ext2-3-into-ext4.patch - Enable converting of directory /var/run /var/lock to symlinks (bnc#877680) * Add: 0106-dracut-Enable-converting-of-directory-var-run-var-lo.patch - Fixup typo 'firmare' instead of 'firmware' * Add: 0107-Fixup-typo-firmare-instead-of-firmware.patch - 91zipl: Store commandline correctly * Add: 0108-91zipl-Store-commandline-correctly.patch - 95dasd_rules: Store all devices in commandline * 0109-95dasd_rules-Store-all-devices-in-commandline.patch - 95zfcp_rules: Store all devices in commandline * Add: 0110-95zfcp_rules-Store-all-devices-in-commandline.patch - 90mdraid: Remove line for 'offroot' detection OBS-URL: https://build.opensuse.org/request/show/240885 OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=171
164 lines
4.6 KiB
Diff
164 lines
4.6 KiB
Diff
From 6cadece6089ef4d4efbfebeb6b23ca3f2429b36c Mon Sep 17 00:00:00 2001
|
|
From: Thomas Renninger <trenn@suse.de>
|
|
Date: Tue, 8 Jul 2014 17:34:08 +0200
|
|
Subject: dracut: Enable converting of directory /var/run /var/lock to symlinks
|
|
to /run
|
|
|
|
If /var/run is a directory this module will be added.
|
|
After reboot /var/run and /var/lock will be symlinks.
|
|
Another initrd re-creation will not include convertfs module anymore.
|
|
|
|
bnc#877680
|
|
|
|
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
|
---
|
|
modules.d/30convertfs/convertfs.sh | 9 ------
|
|
modules.d/30convertfs/convertrunfs.sh | 54 +++++++++++++++++++++++++++++++++++
|
|
modules.d/30convertfs/do-convertfs.sh | 17 +++++++++++
|
|
modules.d/30convertfs/module-setup.sh | 10 +++++--
|
|
4 files changed, 79 insertions(+), 11 deletions(-)
|
|
create mode 100755 modules.d/30convertfs/convertrunfs.sh
|
|
|
|
diff --git a/modules.d/30convertfs/convertfs.sh b/modules.d/30convertfs/convertfs.sh
|
|
index d717c69..525b1e7 100755
|
|
--- a/modules.d/30convertfs/convertfs.sh
|
|
+++ b/modules.d/30convertfs/convertfs.sh
|
|
@@ -64,15 +64,6 @@ if [[ ! -e "$testfile" ]]; then
|
|
fi
|
|
rm -f -- "$testfile"
|
|
|
|
-testfile="$ROOT/usr/.usrmovecheck$$"
|
|
-rm -f -- "$testfile"
|
|
-> "$testfile"
|
|
-if [[ ! -e "$testfile" ]]; then
|
|
- echo "Cannot write to $ROOT/usr/"
|
|
- exit 1
|
|
-fi
|
|
-rm -f -- "$testfile"
|
|
-
|
|
find_mount() {
|
|
local dev mnt etc wanted_dev
|
|
wanted_dev="$(readlink -e -q $1)"
|
|
diff --git a/modules.d/30convertfs/convertrunfs.sh b/modules.d/30convertfs/convertrunfs.sh
|
|
new file mode 100755
|
|
index 0000000..52700cd
|
|
--- /dev/null
|
|
+++ b/modules.d/30convertfs/convertrunfs.sh
|
|
@@ -0,0 +1,54 @@
|
|
+#!/bin/bash
|
|
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
+
|
|
+ROOT="$1"
|
|
+
|
|
+if [[ ! -d "$ROOT" ]]; then
|
|
+ echo "Usage: $0 <rootdir>"
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+if [[ "$ROOT" -ef / ]]; then
|
|
+ echo "Can't convert the running system."
|
|
+ echo "Please boot with 'rd.convertfs' on the kernel command line,"
|
|
+ echo "to update with the help of the initramfs,"
|
|
+ echo "or run this script from a rescue system."
|
|
+ exit 1
|
|
+fi
|
|
+
|
|
+while [[ "$ROOT" != "${ROOT%/}" ]]; do
|
|
+ ROOT=${ROOT%/}
|
|
+done
|
|
+
|
|
+if findmnt "$ROOT" -O ro;then
|
|
+ WAS_RO=1
|
|
+ mount $ROOT -o remount,rw
|
|
+else
|
|
+ WAS_RO=0
|
|
+fi
|
|
+
|
|
+testfile="$ROOT/.usrmovecheck$$"
|
|
+rm -f -- "$testfile"
|
|
+> "$testfile"
|
|
+if [[ ! -e "$testfile" ]]; then
|
|
+ echo "Cannot write to $ROOT/"
|
|
+ exit 1
|
|
+fi
|
|
+rm -f -- "$testfile"
|
|
+
|
|
+if [ ! -L $ROOT/var/run -a -e $ROOT/var/run ]; then
|
|
+ echo "Converting /var/run to symlink"
|
|
+ mv -f $ROOT/var/run $ROOT/var/run.runmove~
|
|
+ ln -sfn ../run $ROOT/var/run
|
|
+fi
|
|
+
|
|
+if [ ! -L $ROOT/var/lock -a -e $ROOT/var/lock ]; then
|
|
+ echo "Converting /var/lock to symlink"
|
|
+ mv -f $ROOT/var/lock $ROOT/var/lock.lockmove~
|
|
+ ln -sfn ../run/lock $ROOT/var/lock
|
|
+fi
|
|
+
|
|
+if [ $WAR_RO -eq 1 ];then
|
|
+ mount $ROOT -o remount,ro
|
|
+fi
|
|
diff --git a/modules.d/30convertfs/do-convertfs.sh b/modules.d/30convertfs/do-convertfs.sh
|
|
index 99738e3..ef05a06 100755
|
|
--- a/modules.d/30convertfs/do-convertfs.sh
|
|
+++ b/modules.d/30convertfs/do-convertfs.sh
|
|
@@ -2,10 +2,27 @@
|
|
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
|
+# This converts all, /usr/bin -> /bin, ... and /var/run -> /run
|
|
+# Do not enable by default!
|
|
if getargbool 0 rd.convertfs; then
|
|
+ info "Converting both /var/run to /run tmpfs and /usr/bin -> /bin"
|
|
if getargbool 0 rd.debug; then
|
|
bash -x convertfs "$NEWROOT" 2>&1 | vinfo
|
|
+ exit 0
|
|
else
|
|
convertfs "$NEWROOT" 2>&1 | vinfo
|
|
+ exit 0
|
|
+ fi
|
|
+fi
|
|
+
|
|
+# This only converts /var/run -> /run as tmpfs
|
|
+if ! test -L "$NEWROOT"/var/run;then
|
|
+ info "Converting /var/run to /run tmpfs"
|
|
+ if getargbool 0 rd.debug; then
|
|
+ bash -x convertrunfs "$NEWROOT" 2>&1 | vinfo
|
|
+ exit 0
|
|
+ else
|
|
+ convertrunfs "$NEWROOT" 2>&1 | vinfo
|
|
+ exit 0
|
|
fi
|
|
fi
|
|
diff --git a/modules.d/30convertfs/module-setup.sh b/modules.d/30convertfs/module-setup.sh
|
|
index 1e73455..5fead45 100755
|
|
--- a/modules.d/30convertfs/module-setup.sh
|
|
+++ b/modules.d/30convertfs/module-setup.sh
|
|
@@ -4,8 +4,13 @@
|
|
|
|
# called by dracut
|
|
check() {
|
|
- [[ $mount_needs ]] && return 1
|
|
- return 255
|
|
+ # Only check for /var/run
|
|
+ if test -L /var/run;then
|
|
+ return 255
|
|
+ else
|
|
+ require_binaries bash find ldconfig mv rm cp ln || return 1
|
|
+ return 0
|
|
+ fi
|
|
}
|
|
|
|
# called by dracut
|
|
@@ -18,5 +23,6 @@ install() {
|
|
inst_multiple bash find ldconfig mv rm cp ln
|
|
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
|
|
inst_script "$moddir/convertfs.sh" /usr/bin/convertfs
|
|
+ inst_script "$moddir/convertrunfs.sh" /usr/bin/convertrunfs
|
|
}
|
|
|
|
--
|
|
1.8.4.5
|
|
|