Enhance build-upload script to temporarily move README files during build process and restore them afterward; add README for uconsole-rotate package.

This commit is contained in:
2025-08-08 21:08:48 -03:00
parent 18ddff2167
commit 1ce2ddddc4
4 changed files with 48 additions and 0 deletions
+21
View File
@@ -29,7 +29,28 @@ read -s -p "Enter your password: " pass
echo
mkdir -p builds
# Temporarily move top-level README files out during build, then restore
backup_dir=$(mktemp -d)
moved_readmes=()
restore_readmes() {
for f in "${moved_readmes[@]}"; do
[ -f "$backup_dir/$f" ] && mv "$backup_dir/$f" "$pkg_path/$f"
done
}
# Always clean up backup dir; README files are restored immediately after build
trap 'rm -rf "$backup_dir"' EXIT
for f in README.md readme.md README Readme.md; do
if [ -f "$pkg_path/$f" ]; then
mv "$pkg_path/$f" "$backup_dir/$f"
moved_readmes+=("$f")
fi
done
dpkg-deb --build "$pkg_path" "$output_path"
# Restore README files now so the repo looks unchanged for the rest of the script
restore_readmes
response=$(curl --silent --show-error --user "$user:$pass" --upload-file "$output_path" "$remote_url" 2>&1)
if echo "$response" | grep -q "package file already exists"; then
echo "Upload skipped: package file already exists on the server. You might have forgot to update the version number in the control file"