From a032246f888850b628ddb96ca4754fc38e11150b Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Wed, 3 Apr 2019 11:16:36 -0500
Subject: [PATCH] cleanup: seeed*.sh

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 seeed_jessie_gcp-iot_image.sh | 42 ++++++++++++---------
 seeed_jessie_image.sh         | 71 ++++++++++++++++++-----------------
 2 files changed, 61 insertions(+), 52 deletions(-)

diff --git a/seeed_jessie_gcp-iot_image.sh b/seeed_jessie_gcp-iot_image.sh
index b2cfc552f..6597d196a 100755
--- a/seeed_jessie_gcp-iot_image.sh
+++ b/seeed_jessie_gcp-iot_image.sh
@@ -9,12 +9,16 @@ debian_jessie_seeed_gcp_iot="debian-8.11-seeed-gcp-iot-armhf-${time}"
 
 archive="xz -z -8 -v"
 
-beaglebone="--dtb beaglebone \
---rootfs_label rootfs --hostname beaglebone --enable-cape-universal"
+beaglebone="--dtb beaglebone --rootfs_label rootfs --hostname beaglebone --enable-cape-universal"
+pru_rproc_v44ti="--enable-uboot-pru-rproc-44ti"
+pru_rproc_v414ti="--enable-uboot-pru-rproc-414ti"
+pru_rproc_v419ti="--enable-uboot-pru-rproc-419ti"
+pru_rproc_mainline="--enable-mainline-pru-rproc"
+pru_uio_v419="--enable-uboot-pru-uio-419"
 
-omap5_uevm="--dtb omap5-uevm --rootfs_label rootfs --hostname omap5-uevm"
-beagle_x15="--dtb am57xx-beagle-x15 --rootfs_label rootfs \
---hostname BeagleBoard-X15"
+beagle_xm="--dtb omap3-beagle-xm --rootfs_label rootfs --hostname beagleboard"
+
+beagle_x15="--dtb am57xx-beagle-x15 --rootfs_label rootfs --hostname BeagleBoard-X15"
 
 cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
 #!/bin/bash
@@ -35,17 +39,17 @@ extract_base_rootfs () {
 
         if [ -f \${base_rootfs}.tar.xz ] ; then
                 tar xf \${base_rootfs}.tar.xz
-        fi
-
-        if [ -f \${base_rootfs}.tar ] ; then
-                tar xf \${base_rootfs}.tar
+        else
+                if [ -f \${base_rootfs}.tar ] ; then
+                        tar xf \${base_rootfs}.tar
+                fi
         fi
 }
 
 archive_img () {
-	#prevent xz warning for 'Cannot set the file group: Operation not permitted'
-	sudo chown \${UID}:\${GROUPS} \${wfile}.img
         if [ -f \${wfile}.img ] ; then
+                #prevent xz warning for 'Cannot set the file group: Operation not permitted'
+                sudo chown 1000:1000 \${wfile}.img
                 if [ ! -f \${wfile}.bmap ] ; then
                         if [ -f /usr/bin/bmaptool ] ; then
                                 bmaptool create -o \${wfile}.bmap \${wfile}.img
@@ -56,16 +60,18 @@ archive_img () {
 }
 
 generate_img () {
-        if [ -d \${base_rootfs}/ ] ; then
-                cd \${base_rootfs}/
-                sudo ./setup_sdcard.sh \${options}
-                mv *.img ../ || true
-                mv *.job.txt ../ || true
-                cd ..
+        if [ ! "x\${base_rootfs}" = "x" ] ; then
+                if [ -d \${base_rootfs}/ ] ; then
+                        cd \${base_rootfs}/
+                        sudo ./setup_sdcard.sh \${options}
+                        mv *.img ../ || true
+                        mv *.job.txt ../ || true
+                        cd ..
+                fi
         fi
 }
 
-###seeed gcp iot image
+###Seeed gcp iot image (jessie):
 base_rootfs="${debian_jessie_seeed_gcp_iot}" ; blend="seeed-gcp-iot" ; extract_base_rootfs
 
 options="--img-4gb bone-\${base_rootfs}       ${beaglebone}"                ; generate_img
diff --git a/seeed_jessie_image.sh b/seeed_jessie_image.sh
index 703ead466..0ff3ce35f 100755
--- a/seeed_jessie_image.sh
+++ b/seeed_jessie_image.sh
@@ -3,19 +3,24 @@
 time=$(date +%Y-%m-%d)
 DIR="$PWD"
 
-./RootStock-NG.sh -c bb.org-debian-jessie-oemflasher
 ./RootStock-NG.sh -c seeed-debian-jessie-lxqt-4gb-v4.4
 ./RootStock-NG.sh -c seeed-debian-jessie-iot-v4.4
 
-    debian_jessie_oemflasher="debian-8.11-oemflasher-armhf-${time}"
-debian_jessie_seeed_lxqt_4gb="debian-8.11-seeed-lxqt-4gb-armhf-${time}"
      debian_jessie_seeed_iot="debian-8.11-seeed-iot-armhf-${time}"
+debian_jessie_seeed_lxqt_4gb="debian-8.11-seeed-lxqt-4gb-armhf-${time}"
 
 archive="xz -z -8 -v"
 
-beaglebone="--dtb beaglebone --hostname beaglebone"
+beaglebone="--dtb beaglebone --rootfs_label rootfs --hostname beaglebone --enable-cape-universal"
+pru_rproc_v44ti="--enable-uboot-pru-rproc-44ti"
+pru_rproc_v414ti="--enable-uboot-pru-rproc-414ti"
+pru_rproc_v419ti="--enable-uboot-pru-rproc-419ti"
+pru_rproc_mainline="--enable-mainline-pru-rproc"
+pru_uio_v419="--enable-uboot-pru-uio-419"
 
-bb_blank_flasher="--dtb bbb-blank-eeprom --hostname beaglebone"
+beagle_xm="--dtb omap3-beagle-xm --rootfs_label rootfs --hostname beagleboard"
+
+beagle_x15="--dtb am57xx-beagle-x15 --rootfs_label rootfs --hostname BeagleBoard-X15"
 
 cat > ${DIR}/deploy/gift_wrap_final_images.sh <<-__EOF__
 #!/bin/bash
@@ -37,14 +42,16 @@ extract_base_rootfs () {
         if [ -f \${base_rootfs}.tar.xz ] ; then
                 tar xf \${base_rootfs}.tar.xz
         else
-                tar xf \${base_rootfs}.tar
+                if [ -f \${base_rootfs}.tar ] ; then
+                        tar xf \${base_rootfs}.tar
+                fi
         fi
 }
 
 archive_img () {
-	#prevent xz warning for 'Cannot set the file group: Operation not permitted'
-	sudo chown \${UID}:\${GROUPS} \${wfile}.img
         if [ -f \${wfile}.img ] ; then
+                #prevent xz warning for 'Cannot set the file group: Operation not permitted'
+                sudo chown 1000:1000 \${wfile}.img
                 if [ ! -f \${wfile}.bmap ] ; then
                         if [ -f /usr/bin/bmaptool ] ; then
                                 bmaptool create -o \${wfile}.bmap \${wfile}.img
@@ -55,44 +62,40 @@ archive_img () {
 }
 
 generate_img () {
-        cd \${base_rootfs}/
-        sudo ./setup_sdcard.sh \${options}
-        mv *.img ../
-        mv *.job.txt ../
-        cd ..
+        if [ ! "x\${base_rootfs}" = "x" ] ; then
+                if [ -d \${base_rootfs}/ ] ; then
+                        cd \${base_rootfs}/
+                        sudo ./setup_sdcard.sh \${options}
+                        mv *.img ../ || true
+                        mv *.job.txt ../ || true
+                        cd ..
+                fi
+        fi
 }
 
-###oemflasher images: (also single partition)
-base_rootfs="${debian_jessie_oemflasher}" ; blend="oemflasher" ; extract_base_rootfs
+###Seeed iot image (jessie):
+base_rootfs="${debian_jessie_seeed_iot}" ; blend="seeed-iot" ; extract_base_rootfs
 
-options="--img-4gb BBB-blank-\${base_rootfs} --dtb bbb-blank-eeprom --hostname beaglebone --usb-flasher" ; generate_img
+options="--img-4gb bone-\${base_rootfs}       ${beaglebone}"                ; generate_img
 
-###Seeed lxqt-4gb image
+###Seeed lxqt-4gb image (jessie):
 base_rootfs="${debian_jessie_seeed_lxqt_4gb}" ; blend="seeed-lxqt-4gb" ; extract_base_rootfs
 
-options="--img-4gb bone-\${base_rootfs} ${beaglebone}" ; generate_img
-
-###Seeed iot image
-base_rootfs="${debian_jessie_seeed_iot}" ; blend="seeed-iot" ; extract_base_rootfs
-
-options="--img-4gb bone-\${base_rootfs} ${beaglebone}" ; generate_img
+options="--img-4gb bone-\${base_rootfs}      ${beaglebone}"                ; generate_img
 
 ###archive *.tar
-base_rootfs="${debian_jessie_oemflasher}" ; blend="oemflasher" ; archive_base_rootfs
-base_rootfs="${debian_jessie_seeed_lxqt_4gb}" ; blend="seeed-lxqt-4gb" ; archive_base_rootfs
-base_rootfs="${debian_jessie_seeed_iot}" ; blend="seeed-iot" ; archive_base_rootfs
+base_rootfs="${debian_jessie_seeed_iot}"      ; blend="seeed-iot"       ; archive_base_rootfs
+base_rootfs="${debian_jessie_seeed_lxqt_4gb}" ; blend="seeed-lxqt-4gb"  ; archive_base_rootfs
 
-#
-base_rootfs="${debian_jessie_oemflasher}" ; blend="oemflasher"
-wfile="am57xx-\${base_rootfs}-4gb" ; archive_img
+###Seeed iot image (jessie):
+base_rootfs="${debian_jessie_seeed_iot}" ; blend="seeed-iot"
+
+wfile="bone-\${base_rootfs}-4gb"       ; archive_img
 
-#
+###Seeed lxqt-4gb image (jessie):
 base_rootfs="${debian_jessie_seeed_lxqt_4gb}" ; blend="seeed-lxqt-4gb"
-wfile="bone-\${base_rootfs}-4gb" ; archive_img
 
-#
-base_rootfs="${debian_jessie_seeed_iot}" ; blend="seeed-iot"
-wfile="bone-\${base_rootfs}-4gb" ; archive_img
+wfile="bone-\${base_rootfs}-4gb"      ; archive_img
 
 __EOF__
 
-- 
GitLab