[PATCH f17-branch 2/4] dracut: add copytree, rename dev_is_mounted->find_mount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



copytree() is a function for copying/merging directory trees - useful
for stuff like updates images.

dev_is_mounted is confusingly similar to dracut-lib's 'ismounted', so
it's been renamed for clarity.
---
 dracut/anaconda-lib.sh      |    8 +++++++-
 dracut/fetch-kickstart-disk |    2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 115456d..476c6c8 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -80,6 +80,12 @@ anaconda_live_root_dir() {
 
 # These could probably be in dracut-lib or similar
 
+copytree() {
+    local src="$1" dest="$2"
+    mkdir -p "$dest"; dest=$(readlink -f -q "$dest")
+    ( cd "$src"; cp -a . -t "$dest" )
+}
+
 disk_to_dev_path() {
     case "$1" in
         CDLABEL=*|LABEL=*) echo "/dev/disk/by-label/${1#*LABEL=}" ;;
@@ -89,7 +95,7 @@ disk_to_dev_path() {
     esac
 }
 
-dev_is_mounted() {
+find_mount() {
     local dev mnt etc wanted_dev="$(readlink -e -q $1)"
     while read dev mnt etc; do
         [ "$dev" = "$wanted_dev" ] && echo $mnt && return 0
diff --git a/dracut/fetch-kickstart-disk b/dracut/fetch-kickstart-disk
index 9650241..3172049 100755
--- a/dracut/fetch-kickstart-disk
+++ b/dracut/fetch-kickstart-disk
@@ -11,7 +11,7 @@ path="${2:-/ks.cfg}"
 [ -b "$dev" ] || exit 1
 
 info "anaconda: fetching kickstart from $dev:$path"
-mnt="$(dev_is_mounted $dev)"
+mnt="$(find_mount $dev)"
 
 if [ -n "$mnt" ]; then
     cp $mnt$path /tmp/ks.cfg
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux