2020-10-31 14:18:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
2023-08-08 22:53:42 +02:00
|
|
|
NODEJS_VERSION=16
|
2020-10-31 14:18:46 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2024-02-28 12:03:57 +01:00
|
|
|
_git_clone_or_pull() {
|
|
|
|
repo_dir="$1"
|
|
|
|
|
2024-02-28 13:12:21 +01:00
|
|
|
upstream_repository=$(ynh_read_manifest --manifest_key='upstream.code')
|
|
|
|
upstream_url=$(ynh_read_manifest --manifest_key='resources.sources.main.url')
|
2024-02-28 12:03:57 +01:00
|
|
|
upstream_commit=$(echo "$upstream_url" | sed -e "s|^${upstream_repository}/-/archive/\([^/]*\)/.*|\1|")
|
|
|
|
|
|
|
|
if [ -d "$repo_dir" ]; then
|
|
|
|
ynh_exec_as "$app" git -C "$repo_dir" fetch --quiet
|
|
|
|
else
|
|
|
|
ynh_exec_as "$app" git clone "$upstream_repository" "$repo_dir" --quiet
|
|
|
|
fi
|
|
|
|
ynh_exec_as "$app" git -C "$repo_dir" checkout "$upstream_commit"
|
|
|
|
ynh_exec_as "$app" git -C "$repo_dir" submodule update --init --recursive
|
|
|
|
}
|
|
|
|
|
2020-10-31 14:18:46 +01:00
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|