Compare commits

...

5 Commits

Author SHA1 Message Date
b68b682b55 fix(update_child_repos.sh): add file existence check for file processing.
All checks were successful
Update Child Repos / update (push) Successful in 11s
- if file does not exist do NOT continue (hence process this file)
- three way merging still works as before
2026-02-04 13:58:29 +01:00
24e45d728d variabilized app name
All checks were successful
Update Child Repos / update (push) Successful in 9s
2026-01-02 15:14:48 +01:00
75769dcff6 finally fixed the permissions thingamagic for the shit script
All checks were successful
Update Child Repos / update (push) Successful in 5s
2026-01-02 15:07:02 +01:00
f306f887a8 added permissions
All checks were successful
Update Child Repos / update (push) Successful in 6s
2026-01-02 14:26:57 +01:00
49b7863bfc removed permissions
All checks were successful
Update Child Repos / update (push) Successful in 6s
2026-01-02 14:26:28 +01:00
4 changed files with 20 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
---
app_name: Go Template Container Web Server
listen:
address: 0.0.0.0
port: 80

View File

@@ -11,6 +11,7 @@ import (
type WebServer struct {
HTTPServer *http.Server
AppName string `yaml:"app_name"`
Listen WSListen `yaml:"listen"`
}
@@ -25,6 +26,7 @@ func (s *WebServer) Initialize() {
Address: "0.0.0.0",
Port: "80",
}
s.AppName = "Go Template Container Web Server"
// Attempt to read the config file
configFile, err := os.ReadFile("config.yml")

View File

@@ -18,29 +18,20 @@ PREVIOUS_COMMIT_ID=$(git log --format="%H" -n 2 HEAD | tail -n 1)
if [ "${PREVIOUS_COMMIT_ID}" = "${CURRENT_COMMIT_ID}" ]; then
FILES_CHANGED=""
FILES_PERMISSION_CHANGED=""
else
FILES_CHANGED=$(git diff --name-only "${PREVIOUS_COMMIT_ID}" "${CURRENT_COMMIT_ID}" | tr '\n' ' ')
FILES_PERMISSION_CHANGED=$(git diff --summary "${PREVIOUS_COMMIT_ID}" "${CURRENT_COMMIT_ID}" | (grep "mode change" || true) | sed -E 's/.*mode change [0-9]+ => [0-9]+ (.*)/\1/' | tr '\n' ' ')
fi
is_file_changed() {
local file_to_check="$1"
if [ -z "${FILES_CHANGED}" ] && [ -z "${FILES_PERMISSION_CHANGED}" ]; then
if [ -z "${FILES_CHANGED}" ]; then
return 1
fi
for changed_file in ${FILES_CHANGED}; do
if [ "${changed_file}" = "${file_to_check}" ]; then
return 0
fi
done
for changed_file in ${FILES_PERMISSION_CHANGED}; do
if [ "${changed_file}" = "${file_to_check}" ]; then
return 0
fi
done
return 1
}
@@ -97,7 +88,7 @@ while IFS= read -r clone_url; do
conflicted_files=()
for file in ${FILES_TO_UPDATE}; do
if ! is_file_changed "${file}"; then
if ! is_file_changed "${file}" && [ -f "${file}" ]; then
continue
fi
@@ -109,8 +100,10 @@ while IFS= read -r clone_url; do
if [ -f "${file}" ]; then
current_content=$(cat "${file}" 2>/dev/null || true)
current_permissions=$(stat -c "%a" "${file}" 2>/dev/null || echo "644")
template_permissions=$(pushd "${TEMPLATE_REPO_DIR}" >/dev/null && stat -c "%a" "${file}" 2>/dev/null || echo "644" && popd >/dev/null)
if [ "${current_content}" = "${template_content}" ]; then
if [ "${current_content}" = "${template_content}" ] && [ "${current_permissions}" = "${template_permissions}" ]; then
continue
fi
@@ -127,9 +120,7 @@ while IFS= read -r clone_url; do
patched_content=$(cat "${tmp_current}")
if [ "${current_content}" != "${patched_content}" ]; then
template_permissions=$(pushd "${TEMPLATE_REPO_DIR}" >/dev/null && stat -c "%a" "${file}" 2>/dev/null || echo "644" && popd >/dev/null)
echo "${patched_content}" > "${file}"
chmod "${template_permissions}" "${file}" 2>/dev/null || true
git add "${file}"
files_changed=true
echo "Merged updates for ${file} in ${repo_name}"
@@ -138,12 +129,21 @@ while IFS= read -r clone_url; do
echo "Merge conflict detected in ${repo_name}:${file} - preserving local changes"
conflicted_files+=("${file}")
fi
rm -f "${tmp_current}" "${tmp_diff}"
else
echo "File ${file} has local changes in ${repo_name} - preserving local changes"
conflicted_files+=("${file}")
fi
template_permissions=$(pushd "${TEMPLATE_REPO_DIR}" >/dev/null && stat -c "%a" "${file}" 2>/dev/null || echo "644" && popd >/dev/null)
current_permissions=$(stat -c "%a" "${file}" 2>/dev/null || echo "644")
if [ "${current_permissions}" != "${template_permissions}" ]; then
chmod "${template_permissions}" "${file}" 2>/dev/null || true
git add "${file}"
files_changed=true
echo "Updated permissions for ${file} in ${repo_name}"
fi
else
echo "Adding new file ${file} from template to ${repo_name}"
mkdir -p "$(dirname "${file}")"

View File

@@ -20,7 +20,7 @@ func handleVersion(w http.ResponseWriter, r *http.Request) {
// Return (write) the version to the response body
tmpl.Execute(w, SiteInfo{
CommitId: COMMIT_ID,
Name: "YASKM",
Name: ws.AppName,
Version: APP_VERSION,
})
}