mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] fake-overlayfs
@ 2020-10-07 22:38 Ladislav Michl
  2020-10-09 13:06 ` Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Ladislav Michl @ 2020-10-07 22:38 UTC (permalink / raw)
  To: ptxdist

Hi there,

fake-overlayfs help text reads:
 'fake an overlay filesystem like unionfs by copying the original
  content to a tmpfs.'

However it does not seem to do so. Bellow is attempt to fix that.
1) /usr/sbin/fake-overlayfs does not seem to mount tmpfs
2) with MountFlags=private is tmpfs mount invisible for the rest of system
3) perhaps use /run only with systemd?

Comments welcome,
	ladis

diff --git a/projectroot/usr/lib/systemd/system/fake-overlayfs.service b/projectroot/usr/lib/systemd/system/fake-overlayfs.service
index daa6fd03f..818d624b9 100644
--- a/projectroot/usr/lib/systemd/system/fake-overlayfs.service
+++ b/projectroot/usr/lib/systemd/system/fake-overlayfs.service
@@ -1,11 +1,10 @@
 [Unit]
 Description=Fake Overlay Filesystem
 DefaultDependencies=no
-After=local-fs.target
+Before=local-fs.target
 Requires=local-fs.target
 
 [Service]
 Type=oneshot
-RemainAfterExit=no
+RemainAfterExit=yes
 ExecStart=/usr/sbin/fake-overlayfs
-MountFlags=private
diff --git a/projectroot/usr/sbin/fake-overlayfs b/projectroot/usr/sbin/fake-overlayfs
index b6692c578..de852b520 100644
--- a/projectroot/usr/sbin/fake-overlayfs
+++ b/projectroot/usr/sbin/fake-overlayfs
@@ -2,7 +2,7 @@
 
 OVERLAY_DIRS="@OVERLAY_DIRLIST@"
 
-bdir=/tmp/.fake-overlay-root
+bdir=/run/.fake-overlay-root
 
 mkdir $bdir
 mount -o bind,private / $bdir
@@ -14,10 +14,9 @@ while [ $# -gt 0 ]; do
 		shift
 		continue
 	fi
-	echo $1
 	src="$bdir$1"
-	dst="$1/"
-	test -e "$dst" || mkdir $dst
+	dst=$1
+	mount -t tmpfs tmpfs $dst
 	cp -a "$src/"* "$src/".[^.]* "$src/"..?* $dst 2> /dev/null
 	shift
 done

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] fake-overlayfs
  2020-10-07 22:38 [ptxdist] fake-overlayfs Ladislav Michl
@ 2020-10-09 13:06 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2020-10-09 13:06 UTC (permalink / raw)
  To: ptxdist

Hi,

On Thu, Oct 08, 2020 at 12:38:40AM +0200, Ladislav Michl wrote:
> fake-overlayfs help text reads:
>  'fake an overlay filesystem like unionfs by copying the original
>   content to a tmpfs.'
> 
> However it does not seem to do so. Bellow is attempt to fix that.
> 1) /usr/sbin/fake-overlayfs does not seem to mount tmpfs
> 2) with MountFlags=private is tmpfs mount invisible for the rest of system
> 3) perhaps use /run only with systemd?

So I haven't tested this in a while but what is supposed to happen is this:

You add the tmpfs to the fstab for any directory that should be writable.
Then fake-overlayfs will fill that tmpfs with the content that is hidden
by the tmpfs.

Michael


> Comments welcome,
> 	ladis
> 
> diff --git a/projectroot/usr/lib/systemd/system/fake-overlayfs.service b/projectroot/usr/lib/systemd/system/fake-overlayfs.service
> index daa6fd03f..818d624b9 100644
> --- a/projectroot/usr/lib/systemd/system/fake-overlayfs.service
> +++ b/projectroot/usr/lib/systemd/system/fake-overlayfs.service
> @@ -1,11 +1,10 @@
>  [Unit]
>  Description=Fake Overlay Filesystem
>  DefaultDependencies=no
> -After=local-fs.target
> +Before=local-fs.target
>  Requires=local-fs.target
>  
>  [Service]
>  Type=oneshot
> -RemainAfterExit=no
> +RemainAfterExit=yes
>  ExecStart=/usr/sbin/fake-overlayfs
> -MountFlags=private
> diff --git a/projectroot/usr/sbin/fake-overlayfs b/projectroot/usr/sbin/fake-overlayfs
> index b6692c578..de852b520 100644
> --- a/projectroot/usr/sbin/fake-overlayfs
> +++ b/projectroot/usr/sbin/fake-overlayfs
> @@ -2,7 +2,7 @@
>  
>  OVERLAY_DIRS="@OVERLAY_DIRLIST@"
>  
> -bdir=/tmp/.fake-overlay-root
> +bdir=/run/.fake-overlay-root
>  
>  mkdir $bdir
>  mount -o bind,private / $bdir
> @@ -14,10 +14,9 @@ while [ $# -gt 0 ]; do
>  		shift
>  		continue
>  	fi
> -	echo $1
>  	src="$bdir$1"
> -	dst="$1/"
> -	test -e "$dst" || mkdir $dst
> +	dst=$1
> +	mount -t tmpfs tmpfs $dst
>  	cp -a "$src/"* "$src/".[^.]* "$src/"..?* $dst 2> /dev/null
>  	shift
>  done
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-09 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 22:38 [ptxdist] fake-overlayfs Ladislav Michl
2020-10-09 13:06 ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox