Optimizing directory creation.

Optimized the creation of directories by using the Brace expansion mechanism.

And corrected the dirname resolution to follow correct convention.

Change-Id: I048c04385d2706c4e38f8548555a59b0437e1fcd
This commit is contained in:
AzherKhan 2014-07-02 11:21:01 -07:00
parent 451e571753
commit a22305de05
2 changed files with 5 additions and 19 deletions

View File

@ -27,13 +27,7 @@ source /init-func
PATH=/sbin:/bin:/usr/bin:/usr/sbin PATH=/sbin:/bin:/usr/bin:/usr/sbin
export PATH export PATH
mkdir -p /proc mkdir -p /proc /sys /dev /boot /etc /mnt /lib/modules
mkdir -p /sys
mkdir -p /dev
mkdir -p /boot
mkdir -p /etc
mkdir -p /mnt
mkdir -p /lib/modules
mount -t proc proc /proc mount -t proc proc /proc
@ -70,8 +64,7 @@ if [ "$UDEVD_VERSION" != "" -a $UDEVD_VERSION -gt 175 ]; then
mount -t devtmpfs none /dev mount -t devtmpfs none /dev
mkdir -p /run mkdir -p /run
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
mkdir -p /run/lock mkdir -p /run/{lock,udev}
mkdir -p /run/udev
else else
echo "Using old-style udevd setup" echo "Using old-style udevd setup"
mount -t tmpfs none /dev mount -t tmpfs none /dev
@ -93,7 +86,6 @@ else
mknod /dev/tty c 5 0 mknod /dev/tty c 5 0
mknod -m 0600 /dev/console c 5 1 mknod -m 0600 /dev/console c 5 1
mknod -m 0666 /dev/ptmx c 5 2 mknod -m 0666 /dev/ptmx c 5 2
mkdir -p /dev/.udev
mkdir -p /dev/.udev/data mkdir -p /dev/.udev/data
fi fi

View File

@ -39,16 +39,10 @@ function cleanup () {
function create_ramdisk_base () { function create_ramdisk_base () {
echo "Creating base system" echo "Creating base system"
mkdir -p "$TMP_MOUNT_PATH/bin" mkdir -p "${TMP_MOUNT_PATH}/"{bin,lib/modules,etc/udev}
ln -s bin "$TMP_MOUNT_PATH/sbin" ln -s bin "$TMP_MOUNT_PATH/sbin"
mkdir -p "$TMP_MOUNT_PATH/lib"
mkdir -p "$TMP_MOUNT_PATH/lib/modules"
mkdir -p "$TMP_MOUNT_PATH/etc"
mkdir -p "$TMP_MOUNT_PATH/etc/udev"
# cjk adding for discovery support # cjk adding for discovery support
mkdir -p "$TMP_MOUNT_PATH/var/lib/dhcp" mkdir -p "${TMP_MOUNT_PATH}/"{lib/udev/rules.d,var/{lib/dhcp,run}}
mkdir -p "$TMP_MOUNT_PATH/var/run"
mkdir -p "$TMP_MOUNT_PATH/lib/udev/rules.d"
DISTRO=`lsb_release -si` || true DISTRO=`lsb_release -si` || true
@ -132,7 +126,7 @@ function copy_required_libs() {
if [ "$ref" != "$dest" ]; then if [ "$ref" != "$dest" ]; then
local link_path=$TMP_MOUNT_PATH/$ref local link_path=$TMP_MOUNT_PATH/$ref
if ! [ -e "$link_path" -o -L "$link_path" ]; then if ! [ -e "$link_path" -o -L "$link_path" ]; then
mkdir -p `dirname "$link_path"` mkdir -p $(dirname "$link_path")
ln -s "$dest" "$link_path" ln -s "$dest" "$link_path"
fi fi
fi fi