mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
Add auto_get_git_submodule()
This commit is contained in:
@@ -287,3 +287,25 @@ function check_disk_space() {
|
||||
|
||||
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
|
||||
v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME
|
||||
|
||||
Reference in New Issue
Block a user