Build scripts for cobox-os. VM and ARM.

cobox.blend 958B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env zsh
  2. # /../ because $R is the root of *-sdk
  3. source "$R/../cobox.config"
  4. blend_preinst() {
  5. cat <<EOF | sudo tee "$strapdir/blend-preinst"
  6. #!/bin/sh
  7. wget -O - ${node_repo_key} | apt-key add -
  8. echo "${node_repo_apt}" >> /etc/apt/sources.list
  9. apt update
  10. apt --yes --force-yes install nodejs
  11. # Credentials for unprivileged user
  12. useradd -m -s /bin/bash cobox
  13. echo "cobox:cobox" | chpasswd
  14. gpasswd -a cobox sudo
  15. rm -f /blend-preinst
  16. EOF
  17. sudo chmod +x "$strapdir/blend-preinst"
  18. chroot-script -d blend-preinst
  19. }
  20. blend_postinst() {
  21. cat <<EOF | sudo tee "$strapdir/npm-pkg-inst"
  22. #!/bin/sh
  23. for i in ${cobox_sw_npm}; do
  24. sudo -u cobox npm install ${i} || exit 1
  25. done
  26. ln -s /home/cobox/node_modules/cobox-group/bin.js /usr/local/bin/cobox-group
  27. rm -f npm-pkg-inst
  28. EOF
  29. sudo chmod +x "$strapdir/npm-pkg-inst"
  30. chroot-script -d npm-pkg-inst
  31. notice "copying rootfs overlay"
  32. sudo rsync -vraX --chown=root:root "$R/../rootfs-overlay/" "${strapdir}"
  33. }