ArcoLinux -D -B 19.5 iso's have been released

[QUESTION] Help with a git pull script

A place to share tips, guides, application configurations and scripts about all elements of ArcoLinux, all of your personal configurations to make ArcoLinux awesome
Post Reply
User avatar
bobo5290461
Crewman
Posts: 32
Joined: Mon Dec 11, 2017 1:52 pm
Location: Lochristi
Contact:
Belgium
[QUESTION] Help with a git pull script

Post by bobo5290461 » Wed Jan 09, 2019 10:08 am

Hello,
Happy newyear everyone , good health and much arcolinuxF (Fun).

Because i'm not that strong in scripts but growing here's my question.

I have a directory ArcoLinuxB
Inside that directory I have Xfce and Cinnamon and Budgie and so on
Then in each one i have Max and Min where i put my Githubs
/ArcoinuxB/Xfce/Max
/ArcoliuxB/Xfce/Min
/ArcoLinuxB/Cinnamon/Max
/ArcolinuxB/Cinnamon/Min
and so on for every desktop
Now i have to go in each directory , open a terminal and do a git pull (26 iso's and counting....)

Can someone get me started to make 1 script that does it all in one time?
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.

User avatar
erikdubois
Captain
Posts: 2114
Joined: Tue Nov 07, 2017 3:45 pm
Location: Belgium
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by erikdubois » Wed Jan 09, 2019 10:50 am

This is what I use.

Code: Select all

count=0

count=$[count+1]
tput setaf 1;echo "Github "$count;tput sgr0;
# if there is no folder then make one
[ -d $HOME"/ARCOLINUX/arcolinux-applications" ] || git clone https://github.com/arcolinux/arcolinux-applications
cd arcolinux-applications
git pull
echo "#################################################"
echo "################  "$(basename `pwd`)" done"
echo "#################################################"
cd ..

count=$[count+1]
tput setaf 1;echo "Github "$count;tput sgr0;
# if there is no folder then make one
[ -d $HOME"/ARCOLINUX/arcolinux-arc-themes" ] || git clone https://github.com/arcolinux/arcolinux-arc-themes
cd arcolinux-arc-themes
git pull
echo "#################################################"
echo "################  "$(basename `pwd`)" done"
echo "#################################################"
cd ..

count=$[count+1]
tput setaf 1;echo "Github "$count;tput sgr0;
# if there is no folder then make one
[ -d $HOME"/ARCOLINUX/arcolinux-awesome" ] || git clone https://github.com/arcolinux/arcolinux-awesome.git
cd arcolinux-awesome
git pull
echo "#################################################"
echo "################  "$(basename `pwd`)" done"
echo "#################################################"
cd ..
You can make it smaller with case structures or for loop but this does the job.

With copy/paste and search/replace it can be done very quickly.
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
then use the power of our moderators.

User avatar
bobo5290461
Crewman
Posts: 32
Joined: Mon Dec 11, 2017 1:52 pm
Location: Lochristi
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by bobo5290461 » Wed Jan 09, 2019 10:52 am

So after good search, i found this.

Code: Select all

where="/mnt/7796ED7F6111804C/ARCOLINUX GIT/ArcoLinuxB/"

repos=( 
  "${where}/AWESOME/MAX/arco-awesome"
  "${where}/AWESOME/MIN/arco-awesome-minimal"
  "${where}/BSPWM/MAX/arco-bspwm/"
  "${where}/BSPWM/MIN/arco-bspwm-minimal/"
  "${where}/BUDGIE/MAX/arco-budgie"
  "${where}/BUDGIE/MIN/arco-budgie-minimal"
  "${where}CINNAMON/MAX/arco-cinnamon"
)

echo ""
echo "Getting latest for" ${#repos[@]} "repositories using pull --rebase"

for repo in "${repos[@]}"
do
  echo ""
  echo "****** Getting latest for" ${repo} "******"
  cd "${repo}"
  git pull --rebase
  echo "******************************************"
done
And it does the trick. I have no idea if it's proper writen but it works.
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.

User avatar
erikdubois
Captain
Posts: 2114
Joined: Tue Nov 07, 2017 3:45 pm
Location: Belgium
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by erikdubois » Wed Jan 09, 2019 10:54 am

great share
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
then use the power of our moderators.

User avatar
erikdubois
Captain
Posts: 2114
Joined: Tue Nov 07, 2017 3:45 pm
Location: Belgium
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by erikdubois » Wed Jan 09, 2019 10:55 am

Code: Select all

git pull --rebase
I would read up on this command.
Do you need it? Do you want?
I do not use it.
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
then use the power of our moderators.

User avatar
bobo5290461
Crewman
Posts: 32
Joined: Mon Dec 11, 2017 1:52 pm
Location: Lochristi
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by bobo5290461 » Wed Jan 09, 2019 11:10 am

Indeed, i removed it.

I just a FULL PULL and it works great! So now i can spend more time for the fun stuff!!!!!!!!!!!!!!
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.

User avatar
erikdubois
Captain
Posts: 2114
Joined: Tue Nov 07, 2017 3:45 pm
Location: Belgium
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by erikdubois » Wed Jan 09, 2019 12:11 pm

Leave the boring part to the scripts
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
then use the power of our moderators.

User avatar
bobo5290461
Crewman
Posts: 32
Joined: Mon Dec 11, 2017 1:52 pm
Location: Lochristi
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by bobo5290461 » Sat Feb 02, 2019 7:08 pm

Little update ,

in .bashrc-personal i made an alias

alias gitpull="find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull"

So now in one move i can update all my directories and sub directories !!!
I know, i'm lazy. :evil: :evil: :evil:
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.

User avatar
erikdubois
Captain
Posts: 2114
Joined: Tue Nov 07, 2017 3:45 pm
Location: Belgium
Contact:
Belgium
Re: [QUESTION] Help with a git pull script

Post by erikdubois » Sat Feb 02, 2019 8:18 pm

Yes you are
You can do anything with scripting
you gotta love it
:geek: :ugeek:
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
then use the power of our moderators.


Post Reply

Return to “Configs, Scripts”