feat: add mkrootfs script

Signed-off-by: Coelacanthus <coelacanthus@outlook.com>
This commit is contained in:
Coelacanthus 2022-05-23 13:40:46 +08:00
commit 527749ef8d
No known key found for this signature in database
GPG key ID: E35C89E45867AE35
2 changed files with 31 additions and 0 deletions

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
archriscv-*.tar.*
archriscv-*.qcow2
dracut-hook/
rootfs/
qcow2/

26
mkrootfs.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
# shellcheck disable=1091
. /usr/share/makepkg/util.sh
colorize
msg "Building rootfs..."
mkdir -p ./rootfs
sudo pacstrap \
-C /usr/share/devtools/pacman-extra-riscv64.conf \
-M \
./rootfs \
base
msg "Clean up pacman package cache..."
yes y | sudo pacman \
--sysroot ./rootfs \
--sync --clean --clean
msg "Set root password (Default: archriscv)..."
usermod --root ./rootfs --password archriscv root
msg "Compressing rootfs..."
sudo bsdtar --create --zstd --verbose --xattrs --acls -f "archriscv-$(date --rfc-3339=date).tar.zst" -C rootfs/ .