diff options
author | Philipp Engel <philipp@filzip.com> | 2015-02-20 20:19:00 +0300 |
---|---|---|
committer | Philipp Engel <philipp@filzip.com> | 2015-02-20 20:19:00 +0300 |
commit | 528777bf01772f057450acc0569fc159e5e2f971 (patch) | |
tree | 3889b73cf06faa087d43171ce81dfee634da6bbb /src/octopi | |
parent | 6e9132c8f7b0a94d8ea3627271f553fd09c09320 (diff) |
changed code to support variants and flavors. Flavors are supposed to be slightly different configurations of the same variant, where as variants can be very different from the default OctoPi release:
* added a variants directory with an example
* moved common functions to util.sh
Diffstat (limited to 'src/octopi')
-rwxr-xr-x | src/octopi | 38 |
1 files changed, 26 insertions, 12 deletions
@@ -3,6 +3,26 @@ # This script takes a Raspbian image and adds to it octoprint and verions addons # Written by Guy Sheffer <guysoft at gmail dot com> # GPL V3 + +function execute_chroot_script() { + #move OctoPi filesystem files + cp -av $1/filesystem . + + #black magic of qemu-arm-static + cp `which qemu-arm-static` usr/bin + + cp $2 chroot_script + chmod 755 chroot_script + cp $SCRIPT_PATH/util.sh util.sh + chmod 755 util.sh + + chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script + + #cleanup + rm chroot_script + rm -rfv filesystem +} + mkdir -p $OCTOPI_WORKSPACE mkdir -p $MOUNT_PATH @@ -21,19 +41,13 @@ pushd $OCTOPI_WORKSPACE #make QEMU boot (remember to return) #sed -i 's@include /etc/ld.so.conf.d/\*.conf@\#include /etc/ld.so.conf.d/\*.conf@' etc/ld.so.conf - #move OctoPi filesystem files - cp -av $SCRIPT_PATH/filesystem . - - #black magic of qemu-arm-static - cp `which qemu-arm-static` usr/bin - cp $CHROOT_SCRIPT_PATH chroot_script - chmod 755 chroot_script - - chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script + # execute the base chroot script + #execute_chroot_script $SCRIPT_PATH $CHROOT_SCRIPT_PATH - #cleanup - rm chroot_script - rm -rfv filesystem + # if building a variant, execute its chroot script + if [ -n $VARIANT_BASE ]; then + execute_chroot_script $VARIANT_BASE $VARIANT_BASE/chroot_script + fi popd # unmount first boot, then root partition |