gluon/package/gluon-authorized-keys/files/lib/gluon/upgrade/100-authorized-keys
Matthias Schiffer 9b172bbaf4 Move all upgrade scripts to a common directory
Moving the scripts to a common directory not only vastly simplifies the
zzz-gluon-upgrade script, but also allows to define an ordering of such
scripts across packages.
2015-01-24 11:27:47 +01:00

23 lines
368 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site_config'
local file = '/etc/dropbear/authorized_keys'
local keys = {}
function load_keys()
for line in io.lines(file) do
keys[line] = true
end
end
pcall(load_keys)
local f = io.open(file, 'a')
for _, key in ipairs(site.authorized_keys) do
if not keys[key] then
f:write(key .. '\n')
end
end
f:close()