aboutsummaryrefslogtreecommitdiff
path: root/update_backups.rb
blob: c5f02d00d75598a3cdd34a39bcbb8ebe9e1845c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby

require "find"

configs = [] # Array to hold list of config files to save
Find.find("etc") do |path|
  configs << path if File.basename(path) == 'run'
  configs << path if File.basename(path) == 'finish'
  configs << path if File.dirname(path).match(/\/env\//)
  configs << path if File.dirname(path).match(/\/control\//)
end

pkgbuild = File.readlines("PKGBUILD")

File.open("PKGBUILD","w") do |f|
  pkgbuild.each do |l|
    if l[0,6] == "backup"
      l = "backup=(\'#{configs.join("\' \'")}\')"
    end
    f.puts l.chomp
  end
end