[oe-commits] org.oe.dev turnup: updated to use the populate-volatile mechanism to manage /var

mwester commit openembedded-commits at lists.openembedded.org
Mon Jun 4 01:58:26 UTC 2007


turnup: updated to use the populate-volatile mechanism to manage /var
when initializing a rootfs on disk, memstick, or nfs.

Author: mwester at openembedded.org
Branch: org.openembedded.dev
Revision: 10e786af85352eddbd902f7905d892f9e4ea4ad3
ViewMTN: http://monotone.openembedded.org/revision.psp?id=10e786af85352eddbd902f7905d892f9e4ea4ad3
Files:
1
packages/slugos-init/files/turnup
packages/slugos-init/slugos-init_0.10.bb
Diffs:

#
# mt diff -r1148519cf275bdcfec2316943f619ee01b72ad0c -r10e786af85352eddbd902f7905d892f9e4ea4ad3
#
# 
# 
# patch "packages/slugos-init/files/turnup"
#  from [263b71d35ea2cbef39dcb15638db45ac0ce27ea8]
#    to [2e05239eaf5a32bbf9737fb1febffb5bde474362]
# 
# patch "packages/slugos-init/slugos-init_0.10.bb"
#  from [aa68d65a96235652257f8f37678f8e5ef264258d]
#    to [9415d4ba5a133d97c91c0528720853e763cd539b]
# 
============================================================
--- packages/slugos-init/files/turnup	263b71d35ea2cbef39dcb15638db45ac0ce27ea8
+++ packages/slugos-init/files/turnup	2e05239eaf5a32bbf9737fb1febffb5bde474362
@@ -8,11 +8,95 @@
 # configuration
 #  The following variables control which directories in /var end
 #  up on the rootfs and which end up in a temporary file system.
-INRAM_MEMSTICK="/var/cache /var/lock /var/log /var/run /var/tmp /var/lib/ipkg"
-INRAM_NFS="/var/cache /var/lock /var/run /var/tmp"
-INRAM_DISK=""
+INRAM_MEMSTICK="\
+### SlugOS from-memory-stick boot.
+d root root 0755 /var/backups none
+d root root 0755 /var/volatile/cache none
+l root root 0755 /var/cache /var/volatile/cache
+d root root 0755 /var/lib none
+d root root 2755 /var/local none
+d root root 1777 /var/volatile/lock none
+l root root 1777 /var/lock /var/volatile/lock
+d root root 0755 /var/volatile/log none
+l root root 0755 /var/log /var/volatile/log
+d root root 0755 /var/volatile/run none
+l root root 0755 /var/run /var/volatile/run
+d root root 0755 /var/spool none
+d root root 1777 /var/volatile/tmp none
+l root root 1777 /var/tmp /var/volatile/tmp
+d root root 0755 /var/lock/subsys none
+d root root 0755 /var/lib/dropbear none
+d root root 0755 /var/lib/misc none
+f root root 0664 /var/log/wtmp none
+f root root 0664 /var/run/utmp none"
 
+INRAM_NFS="\
+### SlugOS from-NFS boot.
+d root root 0755 /var/backups none
+d root root 0755 /var/volatile/cache none
+l root root 0755 /var/cache /var/volatile/cache
+d root root 0755 /var/lib none
+d root root 2755 /var/local none
+d root root 1777 /var/volatile/lock none
+l root root 1777 /var/lock /var/volatile/lock
+d root root 0755 /var/log none
+d root root 0755 /var/volatile/run none
+l root root 0755 /var/run /var/volatile/run
+d root root 0755 /var/spool none
+d root root 1777 /var/volatile/tmp none
+l root root 1777 /var/tmp /var/volatile/tmp
+d root root 0755 /var/lock/subsys none
+d root root 0755 /var/lib/dropbear none
+d root root 0755 /var/lib/misc none
+d root root 0755 /var/lib/ipkg none
+f root root 0664 /var/log/wtmp none
+f root root 0664 /var/run/utmp none"
+
+INRAM_DISK="\
+### SlugOS from-disk boot.
+d root root 0755 /var/backups none
+d root root 0755 /var/cache none
+d root root 0755 /var/lib none
+d root root 2755 /var/local none
+d root root 1777 /var/lock none
+d root root 0755 /var/log none
+d root root 0755 /var/run none
+d root root 0755 /var/spool none
+d root root 1777 /var/tmp none
+d root root 0755 /var/lock/subsys none
+d root root 0755 /var/lib/dropbear none
+d root root 0755 /var/lib/misc none
+d root root 0755 /var/lib/ipkg none
+f root root 0664 /var/log/wtmp none
+f root root 0664 /var/run/utmp none"
+
+INRAM_HEADER="\
+# This configuration file lists filesystem objects that should get verified
+# during startup and be created if missing.
 #
+# Every line must either be a comment starting with #
+# or a definition of format:
+# <type> <owner> <group> <mode> <path> <linksource>
+# where the items are separated by whitespace !
+#
+# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
+#
+# A linking example:
+# l root root 0777 /var/test /tmp/testfile
+# f root root 0644 /var/test none
+#
+# Understanding links:
+# When populate-volatile is to verify/create a directory or file, it will first
+# check it's existence. If a link is found to exist in the place of the target,
+# the path of the target is replaced with the target the link points to.
+# Thus, if a link is in the place to be verified, the object will be created
+# in the place the link points to instead.
+# This explains the order of \"link before object\" as in the example above, where
+# a link will be created at /var/test pointing to /tmp/testfile and due to this
+# link the file defined as /var/test will actually be created as /tmp/testfile.
+#"
+
+#
 # force: override certain checks
 force=
 
@@ -209,7 +293,6 @@ setup_var() {
 #  Removes the /var tmpfs entry from /etc/fstab.
 #  Creates links from /var into /media/ram for NFS and Memstick.
 setup_var() {
-	local ram_targets directory
 
 	test -n "$1" -a -d "$1"/var || {
 		echo "turnup: setup_var($1,$2): expected a directory" >&2
@@ -220,35 +303,30 @@ setup_var() {
 	*)	echo "turnup: setup_var($1,$2): expected 'disk', 'nfs' or 'memstick'" >&2
 		return 1;;
 	esac
-	#
-	# populate /var, there is a shell script to do this, but it uses
-	# absolute path names
-	chroot "$1" /bin/busybox sh /etc/init.d/populate-volatile.sh || {
-		echo "turnup: /var: could not populate directory" >&2
-		return 1
-	}
 
+	# populate /var.  We just need to create the /var/volatile mount
+	# point, the populate-volatile script does the work at boot time.
+	echo "turnup: ensuring /var/volatile mountpoint exists"
+	test -d "$1"/var/volatile || mkdir "$1"/var/volatile
+
+	# we need to put in place the correct configuration file for
+	# the populate-volatile script to use at boot time.  The config
+	# file is already in place for the flash boot, and it's the same
+	# file for the ram boot.
 	case "$2" in
-	disk)	ram_targets="$INRAM_DISK";;
-	nfs)	ram_targets="$INRAM_NFS";;
-	memstick)
-		ram_targets="$INRAM_MEMSTICK";;
+	disk)	  echo "$INRAM_HEADER"   > "$1"/etc/default/volatiles/00_core
+		  echo "$INRAM_DISK"     >>"$1"/etc/default/volatiles/00_core;;
+	nfs)	  echo "$INRAM_HEADER"   > "$1"/etc/default/volatiles/00_core
+		  echo "$INRAM_NFS"      >>"$1"/etc/default/volatiles/00_core;;
+	memstick) echo "$INRAM_HEADER"   > "$1"/etc/default/volatiles/00_core
+	          echo "$INRAM_MEMSTICK" >>"$1"/etc/default/volatiles/00_core;;
 	esac
 
-	for directory in $ram_targets
-	do
-		rm -rf "$1/$directory"
-		ln -s "/media/ram/$directory" "$1/$directory"
-	done
-	# the startup link is left for the moment, this seems safer
-	#rm "$1"/etc/rc?.d/[KS]??populate-var.sh
-	# remove the /var tmpfs entry from the new /etc/fstab
+	# remove the /var tmpfs entry from the new /etc/fstab, if it is
+	# present in the first place.
 	sed -i '\@[ 	]/var[ 	][ 	]*tmpfs[ 	]@d' "$1"/etc/fstab
-	echo "turnup: tmpfs will no longer be mounted on /var" >&2
+	echo "turnup: ensuring tmpfs will not be mounted on /var" >&2
 	#
-	# Previous versions of turnup removed populate-var.sh from the
-	# startup links, this one doesn't, so /var can be made back into
-	# a tmpfs just by a change to /etc/fstab.
 	return 0
 }
 
============================================================
--- packages/slugos-init/slugos-init_0.10.bb	aa68d65a96235652257f8f37678f8e5ef264258d
+++ packages/slugos-init/slugos-init_0.10.bb	9415d4ba5a133d97c91c0528720853e763cd539b
@@ -1,10 +1,10 @@ RDEPENDS = "busybox devio"
 DESCRIPTION = "SlugOS initial network config via sysconf"
 SECTION = "base"
 PRIORITY = "required"
 LICENSE = "GPL"
 DEPENDS = "base-files devio"
 RDEPENDS = "busybox devio"
-PR = "r83"
+PR = "r84"
 
 SRC_URI = "file://boot/flash \
 	   file://boot/disk \






More information about the Openembedded-commits mailing list