added more codes from anylocation of script can update files in desire mirror location
This commit is contained in:
parent
a3653cad42
commit
4154b268e1
|
@ -1,11 +1,19 @@
|
|||
#written by Pardesi_Cat
|
||||
#for report or any queries contact https://pardesicat.xyz
|
||||
|
||||
|
||||
# put your choice of directrory here, where you want to store mirror files
|
||||
|
||||
dirr="/home/linuxmirror"
|
||||
|
||||
|
||||
# require things
|
||||
|
||||
mirror="https://github.com/Athena-OS/athena-repository.git"
|
||||
name="athena-repository"
|
||||
|
||||
|
||||
# custom commads
|
||||
# custom commads
|
||||
|
||||
check_git () {
|
||||
|
||||
|
@ -17,28 +25,35 @@ fi
|
|||
}
|
||||
|
||||
install_repo () {
|
||||
|
||||
echo -e "installing Mirror files 1st time,"
|
||||
|
||||
|
||||
echo "installing Mirror files 1st time,"
|
||||
mkdir -p "$dir/$name/"
|
||||
mkdir -p "$dirr/$name/$name/"
|
||||
cd "$dirr/$name/$name/"
|
||||
|
||||
if [ -e .git ]; then
|
||||
|
||||
cd "$dirr/$name/$name/"
|
||||
rm -rf .git
|
||||
git init
|
||||
git remote add origin "$mirror" &> /dev/null
|
||||
echo "syning"
|
||||
git fetch
|
||||
|
||||
else
|
||||
else
|
||||
cd "$dirr/$name/$name/"
|
||||
git init
|
||||
git remote add origin "$mirror" &> /dev/null
|
||||
echo "syncing"
|
||||
git fetch
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
update_mirror () {
|
||||
|
||||
echo "syning mirror files..."
|
||||
cd "$dirr/$name/$name/"
|
||||
git pull origin main
|
||||
echo "Syncing successfully done!"
|
||||
|
||||
|
@ -49,9 +64,9 @@ update_mirror () {
|
|||
|
||||
check_git
|
||||
|
||||
if [ -e x86_64 ]; then
|
||||
if [ -e $dirr/$name/$name/x86_64 ]; then
|
||||
|
||||
echo -e "syncing updated mirror files"
|
||||
echo "syncing updated mirror files"
|
||||
update_mirror
|
||||
git pull origin main
|
||||
echo -e "Done"
|
||||
|
@ -59,8 +74,7 @@ else
|
|||
echo "no mirror found"
|
||||
install_repo
|
||||
git pull origin main
|
||||
echo -e "Done"
|
||||
echo "Done"
|
||||
fi
|
||||
|
||||
# main work end
|
||||
|
||||
|
|
Loading…
Reference in New Issue