Modified to work with populate-var and allow per target (nfs,disk...) definition...
authorccsmart <ccsmart@smartpal.de>
Sat, 16 Jul 2005 19:30:48 +0000 (19:30 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Sat, 16 Jul 2005 19:30:48 +0000 (19:30 +0000)
packages/openslug-init/openslug-init-0.10/turnup
packages/openslug-init/openslug-init_0.10.bb

index 80afac7..977fa1f 100644 (file)
@@ -4,6 +4,10 @@
 #
 . /etc/default/functions
 
+INRAM_MEMSTICK="/var/cache /var/lock /var/log /var/run /var/tmp /var/lib/ipkg"
+INRAM_NFS="/var/cache /var/run"
+INRAM_DISK=""
+
 #
 # force: override certain checks
 force=
@@ -169,29 +173,29 @@ setup_var() {
        }
        case "$2" in
        disk|nfs|memstick);;
-       *)      echo "turnup: setup_var($1,$2): expected 'disk' or 'nfs'" >&2
+       *)      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-var.sh || {
+       chroot "$1" /bin/busybox sh /etc/init.d/populate-volatile.sh || {
                echo "turnup: /var: could not populate directory" >&2
                return 1
        }
 
        case "$2" in
-       nfs|memstick)
-               for d in "cache" "lock" "log" "run" "tmp" "lib/ipkg"; do
-                 RAMDIR="/media/ram/${d}"
-                 VARDIR="/var/${d}"
-                 rm -rf "${1}/${VARDIR}"
-                 ln -s "${RAMDIR}" "${1}/${VARDIR}"
-                 sed -i "s@ ${VARDIR}@ ${RAMDIR}@" "$1"/etc/init.d/populate-var.sh
-                 done
-               echo "mkdir -p /media/ram/lib/ipkg" >>"$1"/etc/init.d/populate-var.sh
-               ;;
+       disk) RAMTARGETS=${INRAM_DISK};;
+       nfs) RAMTARGETS=${INRAM_NFS};;
+       memstick) RAMTARGETS=${INRAM_MEMSTICK};;
        esac
+
+       for d in ${RAMTARGETS}; do
+         RAMDIR="/media/ram${d}"
+         REALDIR="${d}"
+         rm -rf "${1}${REALDIR}"
+         ln -s "${RAMDIR}" "${1}${REALDIR}"
+         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
index 0fa2da7..e55d0f0 100644 (file)
@@ -3,7 +3,7 @@ SECTION = "console/network"
 LICENSE = "GPL"
 DEPENDS = "base-files devio"
 RDEPENDS = "busybox devio"
-PR = "r35"
+PR = "r36"
 
 SRC_URI = "file://linuxrc \
           file://boot/flash \