Working service1
This commit is contained in:
1 parent
fe0035e40f
commit
fbcfd08e59
25 files changed
+651
-32
No files matched your search
@@ -0,0 +1,54 @@
|
||||
{stdenv, writeShellApplication, git}: writeShellApplication rec {
|
||||
name = "gitModulesFixer";
|
||||
|
||||
|
||||
#propagatedBuildInputs = [python26Packages.setuptools];
|
||||
#nativeBuildInputs = [ libxml2 libxslt ];
|
||||
#buildInputs = [ zlib ];
|
||||
runtimeInputs = [ git ];
|
||||
|
||||
#env = {
|
||||
# NIX_CFLAGS_COMPILE="-Wno-incompatible-pointer-types";
|
||||
#};
|
||||
|
||||
text = ''
|
||||
root_dir=$(pwd)
|
||||
processed_files=()
|
||||
|
||||
echo ">>> Starting recursive submodule fix & init"
|
||||
|
||||
while :; do
|
||||
found_new=false
|
||||
|
||||
while IFS= read -r gitmodules_file; do
|
||||
# Skip already processed
|
||||
echo "''${processed_files[@]}"
|
||||
if printf '%s\n' "''${processed_files[@]}" | grep -qx "$gitmodules_file"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo ">>> Patching $gitmodules_file"
|
||||
processed_files+=("$gitmodules_file")
|
||||
found_new=true
|
||||
|
||||
sed -i 's#git://#https://#g' "$gitmodules_file"
|
||||
|
||||
# Init only first-level submodules for this directory
|
||||
|
||||
mod_dir=$(dirname "$gitmodules_file")
|
||||
(
|
||||
cd "$mod_dir"
|
||||
echo "$mod_dir"
|
||||
git status
|
||||
git submodule status
|
||||
git submodule update --init
|
||||
)
|
||||
done < <(find "$root_dir" -name .gitmodules)
|
||||
|
||||
if ! $found_new; then
|
||||
echo ">>> No new submodules found. Done."
|
||||
break
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}
|
||||
Reference in new issue
Block a user