From 1a21a198d2778d3537145e308ea0bed8bae68c95 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Tue, 1 Jan 2019 18:37:15 +0000
Subject: [PATCH] emmc directory variable

---
 src/freedombone-image-hardware-setup | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/freedombone-image-hardware-setup b/src/freedombone-image-hardware-setup
index aab96934e..9220500d8 100755
--- a/src/freedombone-image-hardware-setup
+++ b/src/freedombone-image-hardware-setup
@@ -30,6 +30,7 @@ export TEXTDOMAIN=${PROJECT_NAME}-image-hardware-setup
 export TEXTDOMAINDIR="/usr/share/locale"
 
 INSTALL_PACKAGES='apt-get -yq install'
+EMMC_DIR=/opt/scripts/tools/eMMC
 
 enable_serial_console() {
     # By default, spawn a console on the serial port
@@ -60,20 +61,20 @@ beaglebone_flasher() {
         return
     fi
 
-    if [ ! -d /boot/eMMC ]; then
-        mkdir /boot/eMMC
+    if [ ! -d "$EMMC_DIR" ]; then
+        mkdir -p "$EMMC_DIR"
     fi
 
     $INSTALL_PACKAGES wget rsync
-    wget "https://code.freedombone.net/bashrc/${PROJECT_NAME}/raw/master/image_build/emmc_functions.sh" -O /boot/eMMC/functions.sh
-    if [ ! -f /boot/eMMC/functions.sh ]; then
+    wget "https://code.freedombone.net/bashrc/${PROJECT_NAME}/raw/master/image_build/emmc_functions.sh" -O "$EMMC_DIR/functions.sh"
+    if [ ! -f "$EMMC_DIR/functions.sh" ]; then
         exit 62
     fi
-    chmod +x /boot/eMMC/functions.sh
+    chmod +x "$EMMC_DIR/functions.sh"
 
-    cat >> /boot/eMMC/flasher.sh <<EOF
+    cat >> "$EMMC_DIR/flasher.sh" <<EOF
 #!/bin/bash -e
-source /boot/eMMC/functions.sh
+source $EMMC_DIR/functions.sh
 mkfs_options=""
 device_eeprom="$device_eeprom"
 check_if_run_as_root
@@ -86,7 +87,7 @@ activate_cylon_leds
 prepare_drive
 EOF
 
-    chmod +x /boot/eMMC/flasher.sh
+    chmod +x "$EMMC_DIR/flasher.sh"
 }
 
 beaglebone_setup_boot() {
@@ -135,7 +136,6 @@ loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
 
 loadfiles=run loadkernel; run loadinitrd; run loadfdt
 mmcargs=setenv bootargs init=/lib/systemd/systemd console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags} ifnames=0 slub_debug=FZP slab_nomerge page_poison=1
-#mmcargs=setenv bootargs init=/boot/eMMC/flasher.sh
 
 uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
 EOF
-- 
GitLab