#!/bin/sh global SRC_DIR := $[pwd] echo "Cleaning up the overlay work area. This may take a while..." rm -rf work/overlay mkdir -p work/overlay # Just in case we execute the overlay software generation script before we # execute the main build script. mkdir -p work/src/minimal_overlay # -p stops errors if the directory already exists mkdir -p source/overlay cd minimal_overlay for dir in [$[ls -d */ !2 >/dev/null]] { rm -rf $dir echo "Overlay folder '$dir' has been removed." } echo "Ready to continue with the overlay software." cd $SRC_DIR (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SRC_DIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: spids: [5 7] ) } spids: [4] ) ] spids: [4] ) (C {(echo)} {(DQ ("Cleaning up the overlay work area. This may take a while..."))}) (C {(rm)} {(-rf)} {(work/overlay)}) (C {(mkdir)} {(-p)} {(work/overlay)}) (C {(mkdir)} {(-p)} {(work/src/minimal_overlay)}) (C {(mkdir)} {(-p)} {(source/overlay)}) (C {(cd)} {(minimal_overlay)}) (ForEach iter_name: dir iter_words: [ { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(ls)} {(-d)} {(Lit_Other "*") (/)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[71])] ) ] ) left_token: spids: [63 73] ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(rm)} {(-rf)} {($ VSub_Name "$dir")}) (C {(echo)} {(DQ ("Overlay folder '") ($ VSub_Name "$dir") ("' has been removed."))}) ] spids: [77 95] ) spids: [62 75] ) (C {(echo)} {(DQ ("Ready to continue with the overlay software."))}) (C {(cd)} {($ VSub_Name "$SRC_DIR")}) ] )