Usar sudo en vez de doas
Para que sea más compatible
This commit is contained in:
parent
0299e7a08b
commit
860aeb26f5
2 changed files with 9 additions and 9 deletions
16
alpine.lua
16
alpine.lua
|
@ -5,7 +5,7 @@ local t = require("utils/templater")
|
|||
|
||||
-- Returns nil when no failure, otherwise apk's status code
|
||||
function alpine.init_rootfs(path, alpine_base_version, alpine_version)
|
||||
local status = os.execute(t("doas rm -rf {{path}} && mkdir -p {{path}}", {path = path}))
|
||||
local status = os.execute(t("sudo rm -rf {{path}} && mkdir -p {{path}}", {path = path}))
|
||||
if not (status == 0) then return status end
|
||||
local url = t("https://dl-cdn.alpinelinux.org/alpine/v{{base_version}}/releases/x86_64/alpine-minirootfs-{{version}}-x86_64.tar.gz", {
|
||||
base_version = alpine_base_version,
|
||||
|
@ -16,14 +16,14 @@ function alpine.init_rootfs(path, alpine_base_version, alpine_version)
|
|||
end
|
||||
|
||||
function alpine.move_boot(path)
|
||||
local status = os.execute(t("doas rm -rf {{path}}/../boot && doas mv {{path}}/boot {{path}}/../ && doas mkdir {{path}}/boot", {
|
||||
local status = os.execute(t("sudo rm -rf {{path}}/../boot && sudo mv {{path}}/boot {{path}}/../ && sudo mkdir {{path}}/boot", {
|
||||
path = path,
|
||||
}))
|
||||
if not (status == 0) then return status end
|
||||
end
|
||||
|
||||
function alpine.make_squashfs(path, output_path)
|
||||
local status = os.execute(t("doas mksquashfs {{path}} {{output_path}} -comp zstd -noappend -quiet && doas chown $(id -u):$(id -g) {{output_path}}", {
|
||||
local status = os.execute(t("sudo mksquashfs {{path}} {{output_path}} -comp zstd -noappend -quiet && sudo chown $(id -u):$(id -g) {{output_path}}", {
|
||||
path = path,
|
||||
output_path = output_path,
|
||||
}))
|
||||
|
@ -49,7 +49,7 @@ end
|
|||
function alpine.write_file(rootfs_path, path, content)
|
||||
local real_path = rootfs_path..path
|
||||
|
||||
local cmd = t("mkdir -p {{real_dirname}} && test -f {{real_path}} || exit 0 && doas chown $(id -u) {{real_path}}", {
|
||||
local cmd = t("mkdir -p {{real_dirname}} && test -f {{real_path}} || exit 0 && sudo chown $(id -u) {{real_path}}", {
|
||||
real_path = real_path,
|
||||
real_dirname = utils.dirname(real_path),
|
||||
})
|
||||
|
@ -99,17 +99,17 @@ function alpine.make_world(rootfs_path, packages)
|
|||
utils.join_table(packages, "\n"))
|
||||
if err then return err end
|
||||
|
||||
local status = os.execute("doas apk update --no-cache --root "..rootfs_path)
|
||||
local status = os.execute("sudo apk update --no-cache --root "..rootfs_path)
|
||||
if not (status == 0) then return status end
|
||||
local status = os.execute("doas apk upgrade --clean-protected --no-cache --root "..rootfs_path)
|
||||
local status = os.execute("sudo apk upgrade --clean-protected --no-cache --root "..rootfs_path)
|
||||
if not (status == 0) then return status end
|
||||
local status = os.execute("doas apk add --clean-protected --no-cache --root "..rootfs_path)
|
||||
local status = os.execute("sudo apk add --clean-protected --no-cache --root "..rootfs_path)
|
||||
if not (status == 0) then return status end
|
||||
end
|
||||
|
||||
-- Returns nil when no failure, otherwise status code
|
||||
function alpine.set_password(rootfs_path, user, password)
|
||||
local status = os.execute(t("echo '{{password}}\n{{password}}' | doas chroot {{rootfs_path}} passwd {{user}}", {
|
||||
local status = os.execute(t("echo '{{password}}\n{{password}}' | sudo chroot {{rootfs_path}} passwd {{user}}", {
|
||||
password = password,
|
||||
rootfs_path = rootfs_path,
|
||||
user = user,
|
||||
|
|
2
qemu.sh
2
qemu.sh
|
@ -5,7 +5,7 @@ if test "$NOGRAPHIC" = true; then
|
|||
qemuappend="-nographic"
|
||||
fi
|
||||
|
||||
doas chown root:$(id -u) -R boot/ && doas chmod g+rw -R boot/
|
||||
sudo chown root:$(id -u) -R boot/ && sudo chmod g+rw -R boot/
|
||||
qemu-system-x86_64 -enable-kvm -m 2048 \
|
||||
-drive file=image.squashfs,media=disk \
|
||||
-kernel boot/vmlinuz-virt -initrd boot/initramfs-virt \
|
||||
|
|
Loading…
Reference in a new issue