Commit 4767ba24 authored by Chaoting Liu's avatar Chaoting Liu 😖

Merge with upstream master

parent 351fa0f5
......@@ -108,17 +108,27 @@ install_packages() {
create_chroot() {
status_start "Configuring system..."
# the network has two approach:
# 1. use system network
# 1. use host network
# 2. use systemd's way and set up host-guest virtual ethernet set up
##
# 1. diverge into 2 catagories
# 1-1. installing to systemd machine dir, we want it be 2.
# 1-1. installing to systemd machine dir, we'd like it be 2.
# 1-2. installing to $PWD/chroots/, is done via enter_chroot.sh
##
# 1-1.
# check if a machine install.
if [[ $basedir -ne '/var/lib/machines' ]]; then
sudo cp /etc/resolv.conf "${chroot_dir}/etc" &>/dev/null
elif [[ $basedir -eq '/var/lib/machines' ]]; then
# the 2. way
# Setting up virtual ethernet for machine install
status_start "Setting up chroot network"
sudo systemd-nspawn -qjD "$chroot_dir" \
systemctl enable systemd-networkd; \
systemctl enable systemd-resolvd; \
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
status_done
fi
if [[ ! -f "${chroot_dir}/etc/${pacman_conf}.bak" ]]; then
sudo mv "${chroot_dir}/etc/pacman.conf"{,.bak}
......@@ -135,7 +145,7 @@ create_chroot() {
if [ "$(grep "^${USER}:" "${chroot_dir}/etc/passwd" | cut -d ":" -f1)" != "${USER}" ] ; then
title "User setup"
status_start "Adding user: ${USER}..."
sudo systemd-nspawn -qjD $chroot_dir \
sudo systemd-nspawn -qjD "$chroot_dir" \
/usr/sbin/useradd -g users -u "$(id -u)" --home-dir "/$chakrafolder" --create-home "$USER"
status_done
......@@ -145,16 +155,6 @@ create_chroot() {
else
msg "Found user: ${USER}"
fi
# Setting up virtual ethernet for machine install
if [[ $basedir -eq '/var/lib/machines' ]]; then
status_start "Setting up chroot network"
sudo systemd-nspawn -qjD "$chroot_dir" \
systemctl enable systemd-networkd \
systemctl enable systemd-resolvd \
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
status_done
fi
}
clone_repositories() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment