diff --git a/buildscript b/buildscript index f7889e92..9a368533 100755 --- a/buildscript +++ b/buildscript @@ -62,6 +62,11 @@ checkout_git(){ if [ -d "$DIRECTORY" ]; then if $MYGIT remote -v | grep -q "$REPO_URL" ; then echo "Right remote detected" + # Reset tracked files + $MYGIT reset --hard HEAD + # Remove untracked files + $MYGIT clean -f -d + # Select desired commit if ! $MYGIT checkout "$COMMITID" ; then echo "commitid not found trying to fetch new commits" $MYGIT pull && $MYGIT checkout "$COMMITID" @@ -82,14 +87,11 @@ checkout_git(){ } get_source() { - test -d src || mkdir src - cd src + #Get the OpenWrt main repo + checkout_git $builddir $OPENWRTURL $OPENWRTREV - #Get the OpenWrt Core Source for Firmware - checkout_git openwrt $OPENWRTURL $OPENWRTREV - - test -d packages || mkdir packages - cd packages + test -d src/packages || mkdir -p src/packages + cd src/packages #checkout needed package feeds for FEEDVAR in "${FEEDS[@]}" ; do @@ -129,21 +131,12 @@ patch_target() { prepare() { get_source - test -d $builddir || mkdir $builddir - - /bin/rm -rf "$builddir" - cp -a src/openwrt "$builddir" - patch_target # apply variant to ensure the included file "variant.mk" # exists in builddir. apply_variant - #saves ~200MB for each build - test -d ./src/dl || mkdir ./src/dl - ln -s ../src/dl "$builddir"/dl - update_feeds } @@ -197,13 +190,6 @@ prebuild() { cp -r ./bsp/default/root_file_system/* "$builddir"/files/ cp ./bsp/"$machine"/.config "$builddir"/.config - while IFS= read -r -d '' template - do - echo "Translating $template .." - $tpl_translate "$template" > "$(dirname "$template")"/"$(basename "$template" .tpl)" - /bin/rm "$template" - done < <(find "${builddir}/files" -name '*.tpl' -print0) - #insert actual firware version informations into release file variant=$(cat selected_variant) version=$(git describe --tags --dirty) @@ -346,7 +332,7 @@ buildrelease() { } clean() { - /bin/rm -rf bin $builddir src/openwrt + /bin/rm -rf bin $builddir # remove downloaded package feeds for FEEDVAR in "${FEEDS[@]}" ; do