commit d3580aae0606029ef64113c73a7611a029354e39 parent 5334de8765621fb161dc50249cd433f237c2c422 Author: parazyd <parazyd@dyne.org> Date: Fri, 30 Sep 2016 18:38:30 +0200 add helper functions Diffstat:
M | lib/helpers | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 56 insertions(+), 0 deletions(-)
diff --git a/lib/helpers b/lib/helpers @@ -25,6 +25,25 @@ build-image() { bootstrap $arch } +get-kernel-sources() { + fn get-kernel-sources + req=(R device_name gitkernel gitbranch) + ckreq || return 1 + + notice "grabbing kernel sources" + + if [[ -d $R/tmp/kernels/$device_name/${device_name}-linux ]]; then + pushd $R/tmp/kernels/$device_name/${device_name}-linux + git pull + popd + else + git clone --depth 1 \ + $gitkernel \ + -b $gitbranch \ + $R/tmp/kernels/$device_name/${device_name}-linux + fi +} + get-kernel-firmware() { fn get-kernel-firmware @@ -39,3 +58,40 @@ get-kernel-firmware() { git clone $gitsource $R/tmp/linux-firmware fi } + +clone-git() { + fn clone-git "$@" + req=(giturl gitbranch clonepath) + local giturl="$1" + local gitbranch="$2" + local clonepath="$3" + ckreq || return 1 + + notice "grabbing $(basename $clonepath)" + + if [[ -d $clonepath ]]; then + pushd $clonepath + git pull + popd + else + git clone --depth 1 \ + $giturl \ + -b $gitbranch \ + $clonepath + fi +} + +write-fstab() { + fn write-fstab + cat <<EOF | sudo tee ${strapdir}/etc/fstab +## <file system> <mount point> <type> <options> <dump><pass> +## proc +proc /proc proc nodev,noexec,nosuid 0 0 + +## rootfs +/dev/mmcblk0p2 / ext4 errors=remount-ro 0 1 + +## bootfs +/dev/mmcblk0p1 /boot vfat noauto 0 0 +EOF +}