summaryrefslogtreecommitdiff
path: root/pcr/openrc-core/aufs-unmount.patch
blob: 76fa5b250772d5be9cc4d4f8668a49de67fefb14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- ../init.d/localmount.in.orig	2015-02-18 19:56:50.000000000 +0100
+++ ../init.d/localmount.in	2015-02-20 01:04:45.783058606 +0100
@@ -72,19 +72,22 @@

 		local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir aufs_si_id
 		for aufs_si_dir in /sys/fs/aufs/*; do
-			aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/}
-			aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')"
-			aufs_mount_point="$(mountinfo -o ${aufs_si_id})"
-			for x in $aufs_si_dir/br[0-9][0-9][0-9]; do
-				aufs_branch=$(sed 's/=.*//g' $x)
-				eindent
-				if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then
-					ewarn "Failed to remove branch $aufs_branch from aufs \
-						$aufs_mount_point"
-				fi
-				eoutdent
-				sync
-			done
+			if [[ -d ${aufs_si_dir} ]];then
+				aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/}
+				aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')"
+				aufs_mount_point="$(mountinfo -o ${aufs_si_id})"
+
+				for x in $aufs_si_dir/br[0-9][0-9][0-9]; do
+					aufs_branch=$(sed 's/=.*//g' $x)
+					eindent
+					if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then
+						ewarn "Failed to remove branch $aufs_branch from aufs \
+							$aufs_mount_point"
+					fi
+					eoutdent
+					sync
+				done
+			fi
 		done
 	fi