-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script: double change #89
base: master
Are you sure you want to change the base?
Changes from 5 commits
5eb5179
731c13c
e9dfb1e
74bff4e
76e7665
f53536c
e631b31
1f2ec8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ set -e | |
## set defaults | ||
|
||
rom_fp="$(date +%y%m%d)" | ||
curpath=$PWD | ||
|
||
myname="$(basename "$0")" | ||
if [[ $(uname -s) = "Darwin" ]];then | ||
|
@@ -13,7 +14,7 @@ elif [[ $(uname -s) = "Linux" ]];then | |
fi | ||
|
||
## handle command line arguments | ||
read -p "Do you want to sync? " choice | ||
read -p "[Phhusson magic-wand] Do you want to sync the whole jazz? " choice | ||
|
||
function help() { | ||
cat <<EOF | ||
|
@@ -100,14 +101,13 @@ function get_rom_type() { | |
mainrepo="https://github.com/PixelExperience/manifest" | ||
mainbranch="oreo-mr1" | ||
localManifestBranch="android-8.1" | ||
treble_generate="pixel" | ||
extra_make_options="WITHOUT_CHECK_API=true" | ||
treble_generate="" | ||
;; | ||
crdroid) | ||
mainrepo="https://github.com/crdroidandroid/android" | ||
mainbranch="8.1" | ||
localManifestBranch="android-8.1" | ||
treble_generate="crdroid" | ||
treble_generate="lineage" | ||
extra_make_options="WITHOUT_CHECK_API=true" | ||
;; | ||
mokee) | ||
|
@@ -300,6 +300,25 @@ function jack_env() { | |
fi | ||
} | ||
|
||
function save_the_dev() { | ||
if [ -d device/phh/treble ];then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please invert this to reduce indentation and for better clarity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. invert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. something like |
||
cd device/phh/treble | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use a subshell, instead of cd xxx; .... ; cd $curpath which is error prone There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a function doesn't automatically assume to execute stuff in subshell? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if that's the case, you can just drop the cd $oldpwd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stuff is, the execution of this script is in the root of sync, if I drop the cd it will stash on the whole rom files and not only on DT |
||
if git stash -u | grep -q 'No local changes to save';then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. broken indentation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would make more sense to if ! git stash -u;then instead |
||
stashstatus=blank | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "blank" when you're later checking for "empty" is weird -_-' |
||
fi | ||
cd $curpath | ||
|
||
fi | ||
} | ||
|
||
function restore_the_dev() { | ||
if [ -d device/phh/trble ] && [ -z "$stashstatus" ];then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo, trble => treble |
||
cd device/phh/treble | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use a subshell, instead of cd xxx; .... ; cd $curpath which is error prone There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as said earlier, should be already in subshell since this is a function |
||
git stash apply | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering this might/will fail, some error handling should be done here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this fails due to |
||
cd $curpath | ||
fi | ||
} | ||
|
||
parse_options "$@" | ||
get_rom_type "$@" | ||
get_variants "$@" | ||
|
@@ -314,7 +333,9 @@ init_release | |
init_main_repo | ||
init_local_manifest | ||
init_patches | ||
save_the_dev | ||
sync_repo | ||
restore_the_dev | ||
fi | ||
patch_things | ||
jack_env | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it really matters, but I guess they don't need extra_make_options either