define-alpine/setup.lua

61 lines
1.4 KiB
Lua
Raw Permalink Normal View History

2022-06-18 00:06:19 +00:00
local utils = require("utils")
local alpine = require("alpine")
local alpine_base_version = "3.16"
2022-06-18 00:06:19 +00:00
local alpine_version = alpine_base_version..".0"
local packages = {
"alpine-baselayout",
-- "alpine-conf",
"busybox",
"libc-utils",
"alpine-keys",
}
modules = {}
local root = "./root"
function add_packages(new_packages)
utils.table_concat(packages, new_packages)
end
function add_file(path, content)
utils.expect_nil(alpine.write_file(root, path, content))
end
function add_symlink(path, target)
utils.expect_nil(alpine.symlink(root, path, target))
end
function chmod(path, perms)
utils.expect_nil(alpine.chmod(root, path, perms))
end
function mkdir(path)
utils.expect_nil(alpine.mkdir(root, path))
end
2022-06-18 15:05:18 +00:00
function touch(path)
utils.expect_nil(alpine.touch(root, path))
end
2022-06-18 00:06:19 +00:00
print("=> Initializing rootfs...")
utils.expect_nil(alpine.init_rootfs(root, alpine_base_version, alpine_version))
2022-06-18 01:18:59 +00:00
local function module(name)
print("=> Module: " .. name)
require("modules/" .. name)
end
2022-06-18 02:34:30 +00:00
module "fstab"
2022-06-18 15:05:18 +00:00
module "data"
2022-06-18 01:18:59 +00:00
module "kernel"
module "runit"
2022-06-19 00:29:00 +00:00
module "socklog"
2022-06-18 01:19:09 +00:00
module "hostname"
2022-06-18 01:57:10 +00:00
module "dhcpcd"
2022-09-26 22:32:55 +00:00
module "ntpsec"
2022-06-18 15:05:42 +00:00
module "nginx"
2022-06-18 00:06:19 +00:00
print("=> Installing and upgrading packages...")
utils.expect_nil(alpine.make_world(root, packages))
print("=> Setting password...")
2022-06-18 00:12:34 +00:00
utils.expect_nil(alpine.set_password(root, "root", "1"))
2022-06-18 00:06:19 +00:00
print("=> Moving boot...")
utils.expect_nil(alpine.move_boot(root))
print("=> Making image...")
utils.expect_nil(alpine.make_squashfs(root, "image.squashfs"))