1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-05 04:07:10 +01:00

Add pygos specific overlay fs setup

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-04-06 22:18:02 +02:00
parent 4f4a377d7a
commit d0764e77b2
9 changed files with 48 additions and 2 deletions

3
.gitignore vendored
View file

@ -35,6 +35,9 @@ services/procfs
services/sysfs
services/tmpfs
services/tmpfsrun
services/tmpfsvar
services/rootusr
scripts/devfs.sh
scripts/overlay.sh
scripts/trymount.sh

View file

@ -28,6 +28,8 @@ install-data-local:
$(LN_S) $(TEMPLATEDIR)/devfs $(DESTDIR)$(SVCDIR)/devfs
$(LN_S) $(TEMPLATEDIR)/tmpfs $(DESTDIR)$(SVCDIR)/tmpfs
$(LN_S) $(TEMPLATEDIR)/tmpfsrun $(DESTDIR)$(SVCDIR)/tmpfsrun
$(LN_S) $(TEMPLATEDIR)/tmpfsvar $(DESTDIR)$(SVCDIR)/tmpfsvar
$(LN_S) $(TEMPLATEDIR)/rootusr $(DESTDIR)$(SVCDIR)/rootusr
$(LN_S) $(TEMPLATEDIR)/vfs $(DESTDIR)$(SVCDIR)/vfs
$(LN_S) $(TEMPLATEDIR)/shutdown $(DESTDIR)$(SVCDIR)/shutdown
$(LN_S) $(TEMPLATEDIR)/reboot $(DESTDIR)$(SVCDIR)/reboot

View file

@ -34,7 +34,10 @@ AC_CONFIG_FILES([services/devfs])
AC_CONFIG_FILES([services/procfs])
AC_CONFIG_FILES([services/tmpfs])
AC_CONFIG_FILES([services/tmpfsrun])
AC_CONFIG_FILES([services/tmpfsvar])
AC_CONFIG_FILES([services/rootusr])
AC_CONFIG_FILES([scripts/devfs.sh])
AC_CONFIG_FILES([scripts/overlay.sh])
AC_CONFIG_FILES([scripts/trymount.sh])
AC_OUTPUT([Makefile])

View file

@ -1,2 +1,2 @@
scriptdir = @SCRIPTDIR@
script_SCRIPTS = scripts/devfs.sh scripts/trymount.sh
script_SCRIPTS = scripts/devfs.sh scripts/trymount.sh scripts/overlay.sh

21
scripts/overlay.sh.in Normal file
View file

@ -0,0 +1,21 @@
#!/bin/sh
lower=/cfg/preserve/${1}
upper=/cfg/overlay/${1}
work=/cfg/overlay/${1}_work
target=${2}
if [ ! -d "$target" ]; then
exit
fi
if [ -d "$lower" ]; then
if [ -d "$upper" ]; then
@BINPATH@/mkdir -p "$work"
@SBINPATH@/mount -t overlay overlay \
-olowerdir=${lower},upperdir=${upper},workdir=${work} \
${target}
else
@SBINPATH@/mount --bind "$lower" "$target"
fi
fi

View file

@ -4,6 +4,7 @@ init_DATA += services/sysctl services/hwclock services/sysinit
init_DATA += services/reboot services/shutdown services/sigkill
init_DATA += services/sigterm services/sync services/devfs
init_DATA += services/sysfs services/procfs services/tmpfs
init_DATA += services/tmpfsrun services/vfs
init_DATA += services/tmpfsrun services/tmpfsvar services/vfs
init_DATA += services/rootusr
EXTRA_DIST += services/sysinit services/vfs

5
services/rootusr.in Normal file
View file

@ -0,0 +1,5 @@
description "mount /root"
type wait
target boot
before vfs
exec "@SCRIPTDIR@/overlay.sh" root /root

View file

@ -2,6 +2,7 @@ description "mount /run"
type wait
target boot
before vfs
after tmpfsvar
exec "@SBINPATH@/mount" -t tmpfs none /run
exec "@BINPATH@/mkdir" /run/lock -m 0755
exec "@BINPATH@/ln" -s /run /var/run

10
services/tmpfsvar.in Normal file
View file

@ -0,0 +1,10 @@
description "mount /var"
type wait
target boot
before vfs
exec "@SBINPATH@/mount" -t tmpfs none /var
exec "@BINPATH@/mkdir" /var/log -m 0755
exec "@BINPATH@/mkdir" /var/spool -m 0755
exec "@BINPATH@/mkdir" /var/lib -m 0755
exec "@BINPATH@/mkdir" /var/tmp -m 0755
exec "@SCRIPTDIR@/overlay.sh" var_lib /var/lib