The script is to update a group of repos and archives .bz2 of each repo. That uses git fetch to check if git pull is needed, then after each git pull the script backs up the old archive and creates a new one.
I have got it working to a point. Currently it makes new archives, even if git pull has not run. I want it to stop if git pull isn’t needed and move onto next repo.
Below is the first 2 out of 25 repo’s to update, PKGNAM s the beginning of each part of the script.
<code>#!/bin/bash
# update-sources.sh script
SRCDIR=/home/darkside/Downloads/slack64-xfce4-source/xfce-master-build
LOG=$PKGNAM-updated.log
PKGNAM=exo-master
# git clone https://gitlab.xfce.org/xfce/exo.gi
cd $SRCDIR/exo/exo-master
fetch=$(git fetch)
if [[ -z "$fetch" ]]
then
echo "$PKGNAM-Local Repo up to date, no git pull needed"
else
git pull || echo "git pull required" || true | 2>&1 | tee $PKGNAM-$LOG
fi
cont=$(true)
if [[ -z "$cont" ]]
then
cd ..
mv *-master.tar.bz2 old-src-pkgs
tar -cjf exo-master.tar.bz2 exo-master
cd ..
fi
PKGNAM=garcon-master
# git clone https://gitlab.xfce.org/xfce/garcon.git
cd $SRCDIR/garcon/garcon-master
fetch=$(git fetch)
if [[ -z "$fetch" ]]
then
echo "$PKGNAM-Local Repo up to date, no git pull needed"
else
git pull || echo "git pull required" || true | 2>&1 | tee $PKGNAM-$LOG
fi
cont=$(true)
if [[ -z "$cont" ]]
then
cd ..
mv *-master.tar.bz2 old-src-pkgs
tar -cjf garcon-master.tar.bz2 garcon-master
cd ..
fi
</code>
<code>#!/bin/bash
# update-sources.sh script
SRCDIR=/home/darkside/Downloads/slack64-xfce4-source/xfce-master-build
LOG=$PKGNAM-updated.log
PKGNAM=exo-master
# git clone https://gitlab.xfce.org/xfce/exo.gi
cd $SRCDIR/exo/exo-master
fetch=$(git fetch)
if [[ -z "$fetch" ]]
then
echo "$PKGNAM-Local Repo up to date, no git pull needed"
else
git pull || echo "git pull required" || true | 2>&1 | tee $PKGNAM-$LOG
fi
cont=$(true)
if [[ -z "$cont" ]]
then
cd ..
mv *-master.tar.bz2 old-src-pkgs
tar -cjf exo-master.tar.bz2 exo-master
cd ..
fi
PKGNAM=garcon-master
# git clone https://gitlab.xfce.org/xfce/garcon.git
cd $SRCDIR/garcon/garcon-master
fetch=$(git fetch)
if [[ -z "$fetch" ]]
then
echo "$PKGNAM-Local Repo up to date, no git pull needed"
else
git pull || echo "git pull required" || true | 2>&1 | tee $PKGNAM-$LOG
fi
cont=$(true)
if [[ -z "$cont" ]]
then
cd ..
mv *-master.tar.bz2 old-src-pkgs
tar -cjf garcon-master.tar.bz2 garcon-master
cd ..
fi
</code>
#!/bin/bash
# update-sources.sh script
SRCDIR=/home/darkside/Downloads/slack64-xfce4-source/xfce-master-build
LOG=$PKGNAM-updated.log
PKGNAM=exo-master
# git clone https://gitlab.xfce.org/xfce/exo.gi
cd $SRCDIR/exo/exo-master
fetch=$(git fetch)
if [[ -z "$fetch" ]]
then
echo "$PKGNAM-Local Repo up to date, no git pull needed"
else
git pull || echo "git pull required" || true | 2>&1 | tee $PKGNAM-$LOG
fi
cont=$(true)
if [[ -z "$cont" ]]
then
cd ..
mv *-master.tar.bz2 old-src-pkgs
tar -cjf exo-master.tar.bz2 exo-master
cd ..
fi
PKGNAM=garcon-master
# git clone https://gitlab.xfce.org/xfce/garcon.git
cd $SRCDIR/garcon/garcon-master
fetch=$(git fetch)
if [[ -z "$fetch" ]]
then
echo "$PKGNAM-Local Repo up to date, no git pull needed"
else
git pull || echo "git pull required" || true | 2>&1 | tee $PKGNAM-$LOG
fi
cont=$(true)
if [[ -z "$cont" ]]
then
cd ..
mv *-master.tar.bz2 old-src-pkgs
tar -cjf garcon-master.tar.bz2 garcon-master
cd ..
fi
3