2022-05-23 13:40:46 +08:00
|
|
|
#!/usr/bin/bash
|
|
|
|
#
|
2022-07-27 13:39:17 +08:00
|
|
|
# SPDX-FileCopyrightText: 2022 Celeste Liu <coelacanthus@outlook.com>
|
2022-05-23 13:40:46 +08:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
# shellcheck disable=1091
|
|
|
|
. /usr/share/makepkg/util.sh
|
|
|
|
colorize
|
|
|
|
|
|
|
|
msg "Building rootfs..."
|
|
|
|
mkdir -p ./rootfs
|
2022-07-27 22:25:24 +08:00
|
|
|
sudo chown root:root ./rootfs
|
2022-05-23 13:40:46 +08:00
|
|
|
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)..."
|
2022-07-28 01:20:08 +08:00
|
|
|
sudo usermod --root $(realpath ./rootfs) --password $(perl -e "print crypt('archriscv','yescrypt')") root
|
2022-05-23 13:40:46 +08:00
|
|
|
|
|
|
|
msg "Compressing rootfs..."
|
|
|
|
sudo bsdtar --create --zstd --verbose --xattrs --acls -f "archriscv-$(date --rfc-3339=date).tar.zst" -C rootfs/ .
|
2022-07-27 22:27:15 +08:00
|
|
|
|
|
|
|
msg "Clean up rootfs directory..."
|
2022-07-27 22:31:08 +08:00
|
|
|
sudo rm -rf ./rootfs
|