diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index 26dfc4a..70ca1a8 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -65,29 +65,21 @@ module Rbpkg
if ! status[name] || ! FileUtils.uptodate?(file, [subdir_file])
FileUtils.cp(subdir_file, file)
FileUtils.touch(file, mtime: File.mtime(subdir_file))
- case s = File.read(file).strip
- when "running"
- status[name] = :running
- verbose(3, "status[#{name.inspect}] = :running")
- when "ko"
- if status[name] != :running
- status[name] = :ko
- verbose(3, "status[#{name.inspect}] = :ko")
- end
- when "ok"
- if ! status[name]
- status[name] = :ok
- verbose(3, "status[#{name.inspect}] = :ok")
- end
- else
- raise "unknown status: #{s}"
- end
+ status[name] = true
end
end
end
end
- status.each do |name, status|
- File.write("#{name}.status", status)
+ status.each do |name, s|
+ sh_name = sh_quote(name)
+ s = if system("grep -q running */*/#{sh_name}.status")
+ :running
+ elsif system("grep -q ko */*/#{sh_name}.status")
+ :ko
+ else
+ :ok
+ end
+ File.write("#{name}.status", s)
end
end
log = {}