Browse Source

feat[clean_and_recreate_all]: update 'clean/restore' part ; create 'repo_initialized' check

master
Dennis Buchhorn 2 years ago
parent
commit
efd750f1ee
1 changed files with 28 additions and 11 deletions
  1. +28
    -11
      clean_and_recreate_all

+ 28
- 11
clean_and_recreate_all View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
NO_PROMPT="false" NO_PROMPT="false"
CLEAN_ALL="false"
RESTORE_MODIFIED="false"
START_VITIS="false" START_VITIS="false"
IMPORT_HW_PLATFORM_ONLY="false" IMPORT_HW_PLATFORM_ONLY="false"
@ -9,6 +11,10 @@ REPO_INITIALIZED_FILE_EXISTS="false"
for arg in "$@"; do for arg in "$@"; do
if [ $arg == "--no-prompt" ]; then if [ $arg == "--no-prompt" ]; then
NO_PROMPT="true" NO_PROMPT="true"
elif [ $arg == "--clean-all" ]; then
CLEAN_ALL="true"
elif [ $arg == "--restore-modified" ]; then
RESTORE_MODIFIED="true"
elif [ $arg == "--start-vitis" ]; then elif [ $arg == "--start-vitis" ]; then
START_VITIS="true" START_VITIS="true"
elif [ $arg == "--import-hw-platform-only" ]; then elif [ $arg == "--import-hw-platform-only" ]; then
@ -16,23 +22,32 @@ for arg in "$@"; do
fi fi
done done
if ! [ -f ".repo_initialized" ]; then
echo "!!! INFO !!! It seems that you have not executed the 'init_after_clone' script. Please run it first!"
exit 1
fi
if [ $NO_PROMPT == "false" ]; then if [ $NO_PROMPT == "false" ]; then
read -p "!!! WARNING !!! All unstaged and untracked files will be deleted! Press ENTER to continue or CTRL+C to abort..." read -p "!!! WARNING !!! All unstaged and untracked files will be deleted! Press ENTER to continue or CTRL+C to abort..."
fi fi
echo "############################################################" echo "############################################################"
echo "# Delete all unstaged and untracked files ..."
echo "# Delete all untracked files ..."
echo "############################################################" echo "############################################################"
if [ -f ".repo_initialized" ]; then
REPO_INITIALIZED_FILE_EXISTS="true"
rm -f .repo_initialized
if [ $CLEAN_ALL == "true" ]; then
git clean -dfx -e "/.repo_initialized"
else
git clean -dfx -e "/.repo_initialized" -e "/.metadata/.plugins/org.eclipse.core.runtime" -e "/.metadata/.plugins/org.eclipse.debug.core" -e "/.metadata/.plugins/org.eclipse.tcf.debug"
fi fi
git clean -dfx
if [ $RESTORE_MODIFIED == "true" ]; then
echo "############################################################"
echo "# Restore all unstaged files ..."
echo "############################################################"
if [ $REPO_INITIALIZED_FILE_EXISTS == "true" ]; then
touch .repo_initialized
echo "This file is checked by the 'init_after_clone' script." >> .repo_initialized
git restore .
git submodule update --recursive
fi fi
echo "############################################################" echo "############################################################"
@ -59,9 +74,11 @@ fi
# Disable Vitis welcome screen # Disable Vitis welcome screen
FILE=".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs" FILE=".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs"
touch $FILE
echo "eclipse.preferences.version=1" >> $FILE
echo "showIntro=false" >> $FILE
if ! [ -f $FILE ]; then
touch $FILE
echo "eclipse.preferences.version=1" >> $FILE
echo "showIntro=false" >> $FILE
fi
echo "############################################################" echo "############################################################"
echo "# ... finished!" echo "# ... finished!"


Loading…
Cancel
Save