RetroDECK/flathub-push.sh

77 lines
2.9 KiB
Bash
Raw Normal View History

2022-07-07 18:41:28 +00:00
#!/bin/bash
2022-07-17 19:33:29 +00:00
branch="main-"$(date +%d%m%y.%H%M)
2022-09-04 12:31:10 +00:00
#gits_folder=~/gits
gits_folder="/home/public-folder/gits" # without last /
2022-07-10 09:17:46 +00:00
2022-09-04 12:31:10 +00:00
cd $gits_folder
2022-07-07 18:41:28 +00:00
rm -rf flathub
git clone --recursive https://github.com/flathub/net.retrodeck.retrodeck.git flathub
2022-09-04 12:31:10 +00:00
cd $gits_folder/RetroDECK
2022-07-07 18:41:28 +00:00
git checkout main
git submodule init
git submodule update
# NOTE: the only linked submodules are: rd-submodules/retroarch
# these must be included in the exclusion list as they must be redownloaded
#sync -rav --progress --exclude={'res/screenshots/','shared-modules/','rd-submodules/retroarch','.git/','docs','retrodeck-flatpak/','retrodeck-flatpak-cooker/','.flatpak-builder/'} ~/RetroDECK/ ~/flathub/
2022-09-04 12:31:10 +00:00
cd $gits_folder/flathub
2022-07-10 09:17:46 +00:00
git checkout -b $branch
2022-07-07 18:41:28 +00:00
git rm -rf *
git clean -fxd # restroing git index
2022-09-04 12:31:10 +00:00
# Copying only a few files as the others are cloned by git in retrodeck.sh
cd $gits_folder/RetroDECK
2022-07-07 18:41:28 +00:00
cp -rf \
'rd-submodules' \
'flathub.json' \
'LICENSE' \
'net.retrodeck.retrodeck.appdata.xml' \
'net.retrodeck.retrodeck.desktop' \
'net.retrodeck.retrodeck.yml' \
'README.md' \
2022-09-04 12:31:10 +00:00
$gits_folder/flathub/
cd $gits_folder/flathub
2022-07-07 18:41:28 +00:00
# #rebuilding submodules
# git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
# while read path_key path
# do
# url_key=$(echo $path_key | sed 's/\.path/.url/');
# branch_key=$(echo $path_key | sed 's/\.path/.branch/');
# # If the url_key doesn't yet exist then backup up the existing
# # directory if necessary and add the submodule
# if [ ! $(git config --get "$url_key") ]; then
# if [ -d "$path" ] && [ ! $(git config --get "$url_key") ]; then
# mv "$path" "$path""_backup_""$(date +'%Y%m%d%H%M%S')";
# fi;
# url=$(git config -f .gitmodules --get "$url_key");
# # If a branch is specified then use that one, otherwise
# # default to master
# branch=$(git config -f .gitmodules --get "$branch_key");
# if [ ! "$branch" ]; then branch="master"; fi;
# git submodule add -f -b "$branch" "$url" "$path";
# fi;
# done;
# # In case the submodule exists in .git/config but the url is out of date
# git submodule sync
# # Now actually pull all the modules. I used to use this...
# git submodule foreach --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)';
rm -rf .git/modules/*
# Adding the real submodules, please update this every time a submodule is added
git rm -rf shared-modules
git submodule add https://github.com/flathub/shared-modules.git shared-modules
git rm -rf rd-submodules/retroarch
git submodule add https://github.com/flathub/org.libretro.RetroArch.git rd-submodules/retroarch
# unbinds all submodules
git submodule deinit -f .
# checkout again
git submodule update --init --recursive
git add *
git commit -m "Updated flathub/net.retrodeck.retrodeck from RetroDECK/main"
2022-07-10 09:17:46 +00:00
git push origin $branch