mirror of
https://github.com/BioArchLinux/Rosa.git
synced 2025-03-10 12:02:43 +00:00
30 lines
729 B
Lua
30 lines
729 B
Lua
#!/usr/bin/lua
|
|
|
|
local lfs = require("lfs")
|
|
|
|
local rosalua = "/usr/share/lilac/Rosa/rosa.lua"
|
|
local filepath = "/usr/share/lilac/Repo/x86_64/bioarchlinux.files" -- what I watch
|
|
local last_modified = nil
|
|
local attr = lfs.attributes(filepath)
|
|
last_modified = attr.modification
|
|
|
|
--watch file--
|
|
local function check_changes()
|
|
-- current time
|
|
local attr = lfs.attributes(filepath)
|
|
local current_modified = attr.modification
|
|
-- if different
|
|
if current_modified ~= last_modified then
|
|
-- update info
|
|
last_modified = current_modified
|
|
-- run script
|
|
print("Executing Rosa Lua")
|
|
dofile(rosalua)
|
|
end
|
|
end
|
|
|
|
--2 min sync--
|
|
while true do
|
|
check_changes()
|
|
os.execute("sleep " .. tonumber(120)) -- 120s = 2min
|
|
end
|