summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/files/init-install-efi.sh
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-15 18:47:56 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-23 11:47:28 +0100
commit68d8f6d2e4a8d3d15ddc5b5404c5f75b7bd1950c (patch)
treec2a1ad46e715eba3c6880bc0c85aa9b05f8322a3 /meta/recipes-core/initrdscripts/files/init-install-efi.sh
parent99a7c5b50dd824b4fb7fdfb77e71157ed096d8e2 (diff)
downloadpoky-68d8f6d2e4a8d3d15ddc5b5404c5f75b7bd1950c.tar.gz
init-install: code cleanup: replace /dev/$device -> $device
Shortened code by including /dev/ prefix into variable. (From OE-Core rev: f2fe5735a2d2c5a5cbadd3486aa24a4931655526) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts/files/init-install-efi.sh')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh38
1 files changed, 19 insertions, 19 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index dca1432e40..74372b0c96 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -83,7 +83,7 @@ else
83 exit 1 83 exit 1
84fi 84fi
85 85
86device=$TARGET_DEVICE_NAME 86device=/dev/$TARGET_DEVICE_NAME
87 87
88# 88#
89# The udev automounter can cause pain here, kill it 89# The udev automounter can cause pain here, kill it
@@ -94,12 +94,12 @@ rm -f /etc/udev/scripts/mount*
94# 94#
95# Unmount anything the automounter had mounted 95# Unmount anything the automounter had mounted
96# 96#
97umount /dev/${device}* 2> /dev/null || /bin/true 97umount ${device}* 2> /dev/null || /bin/true
98 98
99mkdir -p /tmp 99mkdir -p /tmp
100cat /proc/mounts > /etc/mtab 100cat /proc/mounts > /etc/mtab
101 101
102disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") 102disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
103 103
104swap_size=$((disk_size*swap_ratio/100)) 104swap_size=$((disk_size*swap_ratio/100))
105rootfs_size=$((disk_size-boot_size-swap_size)) 105rootfs_size=$((disk_size-boot_size-swap_size))
@@ -117,32 +117,32 @@ if [ ! "${device#mmcblk}" = "${device}" ]; then
117 part_prefix="p" 117 part_prefix="p"
118 rootwait="rootwait" 118 rootwait="rootwait"
119fi 119fi
120bootfs=/dev/${device}${part_prefix}1 120bootfs=${device}${part_prefix}1
121rootfs=/dev/${device}${part_prefix}2 121rootfs=${device}${part_prefix}2
122swap=/dev/${device}${part_prefix}3 122swap=${device}${part_prefix}3
123 123
124echo "*****************" 124echo "*****************"
125echo "Boot partition size: $boot_size MB ($bootfs)" 125echo "Boot partition size: $boot_size MB ($bootfs)"
126echo "Rootfs partition size: $rootfs_size MB ($rootfs)" 126echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
127echo "Swap partition size: $swap_size MB ($swap)" 127echo "Swap partition size: $swap_size MB ($swap)"
128echo "*****************" 128echo "*****************"
129echo "Deleting partition table on /dev/${device} ..." 129echo "Deleting partition table on ${device} ..."
130dd if=/dev/zero of=/dev/${device} bs=512 count=2 130dd if=/dev/zero of=${device} bs=512 count=2
131 131
132echo "Creating new partition table on /dev/${device} ..." 132echo "Creating new partition table on ${device} ..."
133parted /dev/${device} mklabel gpt 133parted ${device} mklabel gpt
134 134
135echo "Creating boot partition on $bootfs" 135echo "Creating boot partition on $bootfs"
136parted /dev/${device} mkpart boot fat32 0% $boot_size 136parted ${device} mkpart boot fat32 0% $boot_size
137parted /dev/${device} set 1 boot on 137parted ${device} set 1 boot on
138 138
139echo "Creating rootfs partition on $rootfs" 139echo "Creating rootfs partition on $rootfs"
140parted /dev/${device} mkpart root ext3 $rootfs_start $rootfs_end 140parted ${device} mkpart root ext3 $rootfs_start $rootfs_end
141 141
142echo "Creating swap partition on $swap" 142echo "Creating swap partition on $swap"
143parted /dev/${device} mkpart swap linux-swap $swap_start 100% 143parted ${device} mkpart swap linux-swap $swap_start 100%
144 144
145parted /dev/${device} print 145parted ${device} print
146 146
147echo "Formatting $bootfs to vfat..." 147echo "Formatting $bootfs to vfat..."
148mkfs.vfat $bootfs 148mkfs.vfat $bootfs
@@ -163,13 +163,13 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
163echo "Copying rootfs files..." 163echo "Copying rootfs files..."
164cp -a /src_root/* /tgt_root 164cp -a /src_root/* /tgt_root
165if [ -d /tgt_root/etc/ ] ; then 165if [ -d /tgt_root/etc/ ] ; then
166 boot_uuid=$(blkid -o value -s UUID /dev/${device}1) 166 boot_uuid=$(blkid -o value -s UUID ${device}1)
167 swap_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}3) 167 swap_part_uuid=$(blkid -o value -s PARTUUID ${device}3)
168 echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab 168 echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab
169 echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab 169 echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab
170 # We dont want udev to mount our root device while we're booting... 170 # We dont want udev to mount our root device while we're booting...
171 if [ -d /tgt_root/etc/udev/ ] ; then 171 if [ -d /tgt_root/etc/udev/ ] ; then
172 echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist 172 echo "${device}" >> /tgt_root/etc/udev/mount.blacklist
173 fi 173 fi
174fi 174fi
175 175
@@ -185,7 +185,7 @@ mkdir -p $EFIDIR
185cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR 185cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
186 186
187if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then 187if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
188 root_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}2) 188 root_part_uuid=$(blkid -o value -s PARTUUID ${device}2)
189 GRUBCFG="$EFIDIR/grub.cfg" 189 GRUBCFG="$EFIDIR/grub.cfg"
190 cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG 190 cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
191 # Update grub config for the installed image 191 # Update grub config for the installed image