forked from Shinonome/dots-hyprland
Add auto_get_git_submodule()
This commit is contained in:
@@ -287,3 +287,25 @@ function check_disk_space() {
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function auto_get_git_submodule(){
|
||||||
|
local git_submodules_list=()
|
||||||
|
|
||||||
|
while IFS= read -r path; do
|
||||||
|
[ -z "$path" ] && continue
|
||||||
|
git_submodules_list+=("$path")
|
||||||
|
done < <(git submodule status --recursive 2>/dev/null | awk '{print $2}')
|
||||||
|
|
||||||
|
local missing=0
|
||||||
|
|
||||||
|
for p in "${git_submodules_list[@]}"; do
|
||||||
|
if [ ! -d "$p" ] || [ -z "$(ls -A "$p" 2>/dev/null)" ]; then
|
||||||
|
missing=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$missing" -eq 1 ]; then
|
||||||
|
x git submodule update --init --recursive
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ function auto_backup_configs(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
showfun auto_get_git_submodule
|
||||||
|
v auto_get_git_submodule
|
||||||
|
|
||||||
# In case some dirs does not exists
|
# In case some dirs does not exists
|
||||||
v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME
|
v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME
|
||||||
|
|||||||
Reference in New Issue
Block a user