From b60777f71319a80ed17a5499bc1cdaa04f621b9d Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 22 Apr 2022 22:25:30 +0900 Subject: [PATCH] Added a script to copy the main into flathub --- flathub-pr.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 flathub-pr.sh diff --git a/flathub-pr.sh b/flathub-pr.sh new file mode 100755 index 00000000..c0560456 --- /dev/null +++ b/flathub-pr.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +cd ~ +rm -rf flathub +git clone --branch=RetroDECK --recursive https://github.com/XargonWan/flathub.git +cd ~/RetroDECK +git checkout main +git submodule init +git submodule update +rsync -rav --progress --exclude={'shared-modules/','rd-submodules/','.git/','docs','retrodeck-flatpak/','retrodeck-flatpak-cooker/','.flatpak-builder/'} ~/RetroDECK/ ~/flathub/ +cd ~/flathub +rm -rf shared-submodules +rm -rf rd-submodules + +# # 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 update --init --remote --force --recursive +# ...but the submodules would check out in detached HEAD state and I +# didn't like that, so now I do this... + +git submodule foreach --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'; +rm flathub-pr.sh +git add * +git commit -m "Updating flathub" +git push origin RetroDECK \ No newline at end of file