From a538cce55d2703592142317a224500daef884929 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Mon, 9 Apr 2012 10:13:47 -0500 Subject: [PATCH] no reason to use sudo, just check for root Signed-off-by: Robert Nelson --- mk_mmc.sh | 57 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/mk_mmc.sh b/mk_mmc.sh index dc26e03..4f6ea51 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -1260,35 +1260,40 @@ script_readme cat > ${TEMPDIR}/update_boot_files.sh <<-__EOF__ #!/bin/sh - cd /boot/uboot - sudo mount -o remount,rw /boot/uboot + if ! id | grep -q root; then + echo "must be run as root" + exit + fi - if [ ! -f /boot/initrd.img-\$(uname -r) ] ; then - sudo update-initramfs -c -k \$(uname -r) - else - sudo update-initramfs -u -k \$(uname -r) - fi + cd /boot/uboot + mount -o remount,rw /boot/uboot - if [ -f /boot/initrd.img-\$(uname -r) ] ; then - sudo cp -v /boot/initrd.img-\$(uname -r) /boot/uboot/initrd.img - fi + if [ ! -f /boot/initrd.img-\$(uname -r) ] ; then + update-initramfs -c -k \$(uname -r) + else + update-initramfs -u -k \$(uname -r) + fi - #legacy uImage support: - if [ -f /boot/uboot/uImage ] ; then - if [ -f /boot/initrd.img-\$(uname -r) ] ; then - sudo mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-\$(uname -r) /boot/uboot/uInitrd - fi - if [ -f /boot/uboot/boot.cmd ] ; then - sudo mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot Script" -d /boot/uboot/boot.cmd /boot/uboot/boot.scr - sudo cp /boot/uboot/boot.scr /boot/uboot/boot.ini - fi - if [ -f /boot/uboot/serial.cmd ] ; then - sudo mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot Script" -d /boot/uboot/serial.cmd /boot/uboot/boot.scr - fi - if [ -f /boot/uboot/user.cmd ] ; then - sudo mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Reset Nand" -d /boot/uboot/user.cmd /boot/uboot/user.scr - fi - fi + if [ -f /boot/initrd.img-\$(uname -r) ] ; then + cp -v /boot/initrd.img-\$(uname -r) /boot/uboot/initrd.img + fi + + #legacy uImage support: + if [ -f /boot/uboot/uImage ] ; then + if [ -f /boot/initrd.img-\$(uname -r) ] ; then + mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-\$(uname -r) /boot/uboot/uInitrd + fi + if [ -f /boot/uboot/boot.cmd ] ; then + mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot Script" -d /boot/uboot/boot.cmd /boot/uboot/boot.scr + cp -v /boot/uboot/boot.scr /boot/uboot/boot.ini + fi + if [ -f /boot/uboot/serial.cmd ] ; then + mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot Script" -d /boot/uboot/serial.cmd /boot/uboot/boot.scr + fi + if [ -f /boot/uboot/user.cmd ] ; then + mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Reset Nand" -d /boot/uboot/user.cmd /boot/uboot/user.scr + fi + fi __EOF__