diff --git a/common.sh b/common.sh index 49ed0740d7..5614eb6380 100644 --- a/common.sh +++ b/common.sh @@ -392,19 +392,27 @@ userpatch_create() # create commit to start from clean source git add . git -c user.name='Armbian User' -c user.email='user@example.org' commit -q -m "Cleaning working copy" + + local patch="$SRC/userpatches/patch/$1-$LINUXFAMILY-$BRANCH.patch" + + # apply previous user debug mode created patches + [[ -f "$patch" && $1 == "u-boot" ]] && display_alert "Applying existing u-boot patch" "$patch" "wrn" && patch --batch --silent -p1 -N < $patch + [[ -f "$patch" && $1 == "kernel" ]] && display_alert "Applying existing kernel patch" "$patch" "wrn" && patch --batch --silent -p1 -N < $patch # prompt to alter source display_alert "Make your changes in this directory:" "$(pwd)" "wrn" - read -p 'Press after you are done with changes to the source' + display_alert "Press after you are done" "waiting" "wrn" + read + tput cuu1 git add . # create patch out of changes - if ! git diff-index --quiet --cached HEAD; then - #if [[ "$(git status --porcelain)" ]]; then - git diff --staged > $SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y_%H_%M_%S').patch - display_alert "You will find your patch here:" "$SRC/userpatches/patch/$1-$LINUXFAMILY-$(date +'%d.%m.%Y').patch" "info" + if ! git diff-index --quiet --cached HEAD; then + git diff --staged > $patch + display_alert "You will find your patch here:" "$patch" "info" else display_alert "No changes found, skipping patch creation" "" "wrn" fi git reset --soft HEAD~ + for i in {3..1..1};do echo -n "$i." && sleep 1; done fi -} +} \ No newline at end of file diff --git a/general.sh b/general.sh index ffd80f8806..98cdcb67db 100644 --- a/general.sh +++ b/general.sh @@ -132,19 +132,21 @@ if [ -d "$SOURCES/$2/$GITHUBSUBDIR" ]; then if [[ "$3" != "" ]] && [[ "$bar_1" == "$localbar" || "$bar_2" == "$localbar" ]] || [[ "$3" == "" && "$bar_3" == "$localbar" ]] || [[ $bar_1 == "" && $bar_2 == "" ]]; then display_alert "... you have latest sources" "$2 $3" "info" else - display_alert "... your sources are outdated - creating new shallow clone" "$2 $3" "info" - if [[ -z "$GITHUBSUBDIR" ]]; then - rm -rf $SOURCES/$2".old" - mv $SOURCES/$2 $SOURCES/$2".old" - else - rm -rf $SOURCES/$2/$GITHUBSUBDIR".old" - mv $SOURCES/$2/$GITHUBSUBDIR $SOURCES/$2/$GITHUBSUBDIR".old" - fi - - if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then - git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1 || git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 - else - git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR --depth 1 + if [ $DEBUG_MODE != yes ]; then + display_alert "... your sources are outdated - creating new shallow clone" "$2 $3" "info" + if [[ -z "$GITHUBSUBDIR" ]]; then + rm -rf $SOURCES/$2".old" + mv $SOURCES/$2 $SOURCES/$2".old" + else + rm -rf $SOURCES/$2/$GITHUBSUBDIR".old" + mv $SOURCES/$2/$GITHUBSUBDIR $SOURCES/$2/$GITHUBSUBDIR".old" + fi + + if [[ -n $3 && -n "$(git ls-remote $1 | grep "$tag")" ]]; then + git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 --depth 1 || git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR -b $3 + else + git clone -n $1 $SOURCES/$2/$GITHUBSUBDIR --depth 1 + fi fi cd $SOURCES/$2/$GITHUBSUBDIR git checkout -q