0

I have a node.js application that I've developed for our custom Arm/Debian board, currently running on an SD card. For production, I will be deploying this on our board's eMMC. We've written a script to copy our OS/filesystem/device tree to the eMMC, so we can successfully boot and run our system - but it lacks node and any custom code. From the base OS, I currently manually build node and copy the necessary source files - so I could write the script for this.

But I am wondering if there is a way to automate the building of node and my application, so I can overcome the manual/script effort and time to set-up a production system? To reduce the time to building node and copying files (important if we have to mass produce), is it possible to copy/clone or tar/un-tar node and the associated app? Is there a best method for this type of problem?

HiDefLoLife
  • 495
  • 7
  • 25

1 Answers1

0

I ended up writing a script that copies node and my node application to the eMMC. Between Dominic Tancredi's answer here: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) and just general sleuthing, I was able to determine the directories I need to copy:

echo "Mounting eMMC for copying node.js and node app"
mkdir mnt
mount ${EMMCPARTITION} mnt || error_mount_emmc

echo "Copying node.js to eMMC partition"
cp -av /usr/local/lib/node_modules                  mnt/usr/local/lib/
cp -av /usr/local/include/node                      mnt/usr/local/include/
cp -av /usr/local/bin/node                          mnt/usr/local/bin/
cp -av /usr/local/bin/npm                           mnt/usr/local/bin/
mkdir -v mnt/usr/local/share/systemtap
mkdir -v mnt/usr/local/share/systemtap/tapset
cp -av /usr/local/share/systemtap/tapset/node.stp        
mnt/usr/local/share/systemtap/tapset/

echo "Copying node app to eMMC partition"
cp -av /home/debian/app                             mnt/home/debian/

echo "Release mnount of eMMC"
umount ${EMMCPARTITION}         || error_cp_emmc
rmdir mnt

I wish there was a documented way, but in the absence of that, I hope this is useful to others.

Community
  • 1
  • 1
HiDefLoLife
  • 495
  • 7
  • 25