Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
dracut.4406
0106-dracut-Enable-converting-of-directory-var-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0106-dracut-Enable-converting-of-directory-var-run-var-lo.patch of Package dracut.4406
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 Index: dracut-037/modules.d/30convertfs/convertfs.sh =================================================================== --- dracut-037.orig/modules.d/30convertfs/convertfs.sh 2014-03-19 17:16:08.000000000 +0100 +++ dracut-037/modules.d/30convertfs/convertfs.sh 2015-09-07 15:04:11.725094073 +0200 @@ -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)" Index: dracut-037/modules.d/30convertfs/convertrunfs.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ dracut-037/modules.d/30convertfs/convertrunfs.sh 2015-09-07 15:33:14.023428576 +0200 @@ -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 -a -d $ROOT/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 -a -d $ROOT/run ]; 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 [ $WAS_RO -eq 1 ];then + mount $ROOT -o remount,ro +fi Index: dracut-037/modules.d/30convertfs/do-convertfs.sh =================================================================== --- dracut-037.orig/modules.d/30convertfs/do-convertfs.sh 2014-03-19 17:16:08.000000000 +0100 +++ dracut-037/modules.d/30convertfs/do-convertfs.sh 2015-09-07 15:31:05.468173518 +0200 @@ -2,10 +2,21 @@ # -*- 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 else convertfs "$NEWROOT" 2>&1 | vinfo fi +elif ! test -L "$NEWROOT"/var/run; then + # This only converts /var/run -> /run as tmpfs + info "Converting /var/run to /run tmpfs" + if getargbool 0 rd.debug; then + bash -x convertrunfs "$NEWROOT" 2>&1 | vinfo + else + convertrunfs "$NEWROOT" 2>&1 | vinfo + fi fi Index: dracut-037/modules.d/30convertfs/module-setup.sh =================================================================== --- dracut-037.orig/modules.d/30convertfs/module-setup.sh 2014-03-19 17:16:08.000000000 +0100 +++ dracut-037/modules.d/30convertfs/module-setup.sh 2015-09-07 15:04:11.729094299 +0200 @@ -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 }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor