1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-07-16 10:55:40 +03:00
openwrt-xburst/package/block-mount/files/mount.sh
cshore 848953efdf [package] base/block-extroot, base/block-mount: Modified preinit and block-extroot and
block-mount so that use of block-mount and block-extroot do not require that block-extroot,
block-mount, nor the kernel modules they depend, on are required to included in the image.
That is block-extroot and dependencies may now be installed as modules onto the jffs2 part of
a squashfs system and it will work. 
In addition packages which are installed into the jffs2 of a squashfs system may now affect
preinit, so long as they do not require execution of commands that occur before the merging of
the jffs2 and built-in (squashfs) preinit scripts is done.

Thanks jow for the preinit merge stuff!



git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23110 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-09-23 13:58:05 +00:00

88 lines
2.2 KiB
Bash

#!/bin/sh
# Copyright 2010 Vertical Communications
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
pi_include /lib/functions/block.sh
pi_include /lib/functions/fsck.sh
config_mount_by_section() {
local cfg="$1"
local find_rootfs="$2"
mount_cb() {
local cfg="$1"
local device="$2"
shift
local target="$2"
local cfgdevice="$3"
local fstype="$4"
local options="$5"
local enabled="$6"
local enabled_fsck="$7"
local uuid="$8"
local label="$9"
shift
local is_rootfs="$9"
shift
local found_device=""
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
if [ -n "$found_device" ]; then
if [ -z "$find_rootfs" ] || [ "$find_rootfs" -eq 0 ] || [ "$is_rootfs" -eq 1 ]; then
[ "$enabled_fsck" -eq 1 ] && {
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
libmount_fsck "$found_device" "$fstype" "$enabled_fsck"
}
}
[ "$is_rootfs" -eq 1 ] && [ "$find_rootfs" -eq 1 ] && {
target=/overlay
}
config_create_mount_fstab_entry "$found_device" "$target" "$fstype" "$options" "$enabled"
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
[ "$enabled" -eq 1 ] && mkdir -p "$target" && mount "$target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
}
fi
fi
[ "$is_rootfs" -eq 1 ] && [ "$find_rootfs" -eq 1 ] && {
rootfs_found=1
}
return 0
}
config_get_mount "$cfg"
reset_block_cb
}
config_swapon_by_section() {
local cfg="$1"
swap_cb() {
local cfg="$1"
local device="$2"
local cfgdevice="$3"
local enabled="$4"
local uuid="$5"
local label="$6"
local uuid
local label
local found_device=""
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
if [ -n "$found_device" ]; then
config_create_swap_fstab_entry "$found_device" "$enabled"
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
[ "$enabled" -eq 1 ] && swapon "$found_device" | tee /proc/self/fd/2 | logger -t 'fstab'
}
fi
return 0
}
config_get_swap "$cfg"
reset_block_cb
}