-
Notifications
You must be signed in to change notification settings - Fork 661
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 all 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 |
---|---|---|
|
@@ -13,7 +13,11 @@ 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 | ||
read -p "[Phhusson magic-wand] Do you have a reference path? " refchoice | ||
if [[ $refchoice == *"y"* ]];then | ||
read -p "[Phhusson magic-wand] Insert your path including the home path, eg. /home/user/dirtoreference " refpath | ||
fi | ||
|
||
function help() { | ||
cat <<EOF | ||
|
@@ -100,14 +104,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) | ||
|
@@ -225,6 +228,10 @@ function init_main_repo() { | |
repo init -u "$mainrepo" -b "$mainbranch" | ||
} | ||
|
||
function init_main_repo_ref() { | ||
repo init -u "$mainrepo" -b "$mainbranch" --reference=$refpath | ||
} | ||
|
||
function clone_or_checkout() { | ||
local dir="$1" | ||
local repo="$2" | ||
|
@@ -300,6 +307,23 @@ function jack_env() { | |
fi | ||
} | ||
|
||
function save_the_dev() { | ||
if [ -d device/phh/treble ];then | ||
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;then | ||
stashstatus=empty | ||
fi | ||
|
||
fi | ||
} | ||
|
||
function restore_the_dev() { | ||
if [ -d device/phh/treble ] && [ -z "$stashstatus" ];then | ||
cd device/phh/treble | ||
git stash apply | ||
fi | ||
} | ||
|
||
parse_options "$@" | ||
get_rom_type "$@" | ||
get_variants "$@" | ||
|
@@ -311,10 +335,16 @@ fi | |
|
||
if [[ $choice == *"y"* ]];then | ||
init_release | ||
if [[ -z "$refpath" ]];then | ||
init_main_repo | ||
else | ||
init_main_repo_ref | ||
fi | ||
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.
Please invert this to reduce indentation and for better clarity
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.
invert?
What do you mean ?
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.
something like
[ -d device/phh/treble] && return