Skip to content

Commit

Permalink
yupdate - update also the YAML product files
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Dec 4, 2023
1 parent 7903c82 commit 33e0d22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .yupdate.post
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function restart_service() {

if [ -n "$SERVICE_START" ]; then
SERVICE_START_UNIX_TIME=$(date -d "$SERVICE_START" +"%s")
# find the date of the latest file in the gem
NEWEST_FILE_TIME=$(find /usr/lib*/ruby/gems/*/gems/$SERVICE_NAME-* -exec stat --format %Y "{}" \; | sort -nr | head -n 1)
# find the date of the latest file in the product configuration or in the gem
NEWEST_FILE_TIME=$(find /usr/share/agama/products.d /usr/lib*/ruby/gems/*/gems/$SERVICE_NAME-* -exec stat --format %Y "{}" \; | sort -nr | head -n 1)

# when a file is newer than the start time then restart the service
if [ -n "$NEWEST_FILE_TIME" ] && [ "$SERVICE_START_UNIX_TIME" -lt "$NEWEST_FILE_TIME" ]; then
Expand Down
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,21 @@ if ENV["YUPDATE_FORCE"] == "1" || File.exist?("/.packages.initrd") || live_iso?
FileUtils.mkdir_p(File.join(destdir, "/usr/share"))
FileUtils.cp_r("playwright/.", File.join(destdir, "/usr/share/agama-playwright"))
end

if ENV["YUPDATE_SKIP_PRODUCTS"] != "1"
files = Dir.glob("products.d/*.y{a}ml")
files.each do |f|
# the sources contain several products, update only the existing files
oldfile = File.join("/usr/share/agama/", f)
if File.exist?(oldfile)
target = File.join(destdir, "/usr/share/agama/", f)
FileUtils.mkdir_p(File.dirname(target))
FileUtils.cp(f, target)
else
# if there is a new product file it needs to be copied manually
puts "Skipping product file: #{f}"
end
end
end
end
end

0 comments on commit 33e0d22

Please sign in to comment.