aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--initscripts.spec6
-rwxr-xr-xrc.d/init.d/functions3
-rwxr-xr-xsystemd/fedora-import-state34
3 files changed, 38 insertions, 5 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 55130165..54b7bcb4 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,6 +1,6 @@
Summary: Scripts to bring up network interfaces and legacy utilities
Name: initscripts
-Version: 9.67
+Version: 9.68
License: GPLv2
Group: System Environment/Base
Release: 1%{?dist}
@@ -177,6 +177,10 @@ fi
%{_sysconfdir}/profile.d/debug*
%changelog
+* Tue Aug 9 2016 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 9.68-1
+- fedora-import-state: skip modifying of existing folders (#1347436)
+- functions: systemctl show now returns an error when unit does not exist
+
* Tue Jul 19 2016 Lukáš Nykrýn <lnykryn@redhat.com> - 9.67-1
- import-state: restore also sensitivity part of SELinux context
- network: run after network-pre.target
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 70fe5cc3..00a4984c 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -57,7 +57,8 @@ systemctl_redirect () {
options="$options --no-block"
fi
- if systemctl show -p LoadState "$prog.service" | grep -q 'not-found' ; then
+ if ! systemctl show "$prog.service" > /dev/null 2>&1 || \
+ systemctl show -p LoadState "$prog.service" | grep -q 'not-found' ; then
action $"Reloading systemd: " /bin/systemctl daemon-reload
fi
diff --git a/systemd/fedora-import-state b/systemd/fedora-import-state
index 5ad29d41..c34ad0f8 100755
--- a/systemd/fedora-import-state
+++ b/systemd/fedora-import-state
@@ -1,11 +1,39 @@
#!/bin/bash
# fedora-import-state: import state files from initramfs (e.g. network config)
-# copy state into root
+# Copy state into root folder:
+# ============================
cd /run/initramfs/state
-find . -mindepth 1 -maxdepth 1 -exec cp -av -t / {} \;
-# run restorecon on the copied files
+IFS_backup=$IFS
+IFS=$'\n' # Process find's results line by line
+
+dirs_found=$(find . -type d)
+
+for dir in $dirs_found; do
+ pushd "$dir" > /dev/null
+
+ # Remove initial '.' char from the find's result:
+ dest_dir="${dir/\./}"
+
+ # Create destination folder if it does not exist (with the same rights):
+ if ! [[ -d "$dest_dir" ]]; then
+ mkdir -p "$dest_dir"
+ chmod --reference="$PWD" "$dest_dir"
+ chown --reference="$PWD" "$dest_dir"
+ fi
+
+ # Copy all files that are not directory:
+ find . -mindepth 1 -maxdepth 1 -not -type d -exec cp -av -t "$dest_dir" {} \; > /dev/null
+
+ popd > /dev/null
+done
+
+IFS=$IFS_backup
+
+
+# Run restorecon on the copied files:
+# ===================================
if [ -e /sys/fs/selinux/enforce -a -x /usr/sbin/restorecon ]; then
find . -mindepth 1 -print0 | { cd / && xargs --null restorecon -iF; }
fi