Gentoo/studio

来自OSSmedia
Brucekomike讨论 | 贡献2025年1月7日 (二) 15:19的版本 (创建页面,内容为“ == 自制脚本 == 请在挂载磁盘后运行(默认位置 /mnt/gentoo) === stage file and chroot === download <pre> # URL of the Gentoo mirror MIRROR_URL="https://mirrors.bfsu.edu.cn/" # Fetch the latest signed file SIGNED_FILE=$(curl -s "${MIRROR_URL}gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/latest-stage3-amd64-desktop-systemd.txt") # Extract the stage file name STAGE_FILE=$(echo "$SIGNED_FILE" | grep -oP '^stage3-[^ ]+\.tar\…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

自制脚本

请在挂载磁盘后运行(默认位置 /mnt/gentoo)

stage file and chroot

download

# URL of the Gentoo mirror
MIRROR_URL="https://mirrors.bfsu.edu.cn/"

# Fetch the latest signed file
SIGNED_FILE=$(curl -s "${MIRROR_URL}gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/latest-stage3-amd64-desktop-systemd.txt")

# Extract the stage file name
STAGE_FILE=$(echo "$SIGNED_FILE" | grep -oP '^stage3-[^ ]+\.tar\.xz')

# Download the stage file
if [ -n "$STAGE_FILE" ]; then
    DOWNLOAD_URL="${MIRROR_URL}gentoo/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/${STAGE_FILE}"
    echo "Downloading ${STAGE_FILE}..."
    curl -O "$DOWNLOAD_URL"
    echo "Download complete."
else
    echo "Stage file not found."
    exit 1
fi

extranct and chroot

tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo

cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
arch-chroot /mnt/gentoo

root passwd

just do this first please, in case

passwd

portage config

do check make.conf after run this

# add config to make.conf
echo 'RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"' >> /etc/portage/make.conf
sed -i '/^COMMON_FLAGS=/ s/"$/ -march=native"/' /etc/portage/make.conf
tee -a /etc/portage/make.conf <<EOF

GRUB_PLATFORMS="emu efi-32 efi-64 pc"
USE="X fcitx5 tkip kcm cjk"
ACCEPT_LICENSE="* -@EULA"
VIDEO_CARDS="nvidia amdgpu radeon radeonsi intel mesa"
FEATURES="getbinpkg"
EOF

# CPU
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags
# seems useless
tee -a /etc/portage/binrepos.conf/bfsu.conf <<EOF
[binhost]
priority = 9999
sync-uri = https://mirrors.bfsu.edu.cn/gentoo/releases/amd64/binpackages/23.0/x86-64/
EOF


tee -a /etc/portage/package.use/01studio <<EOF
# kernel
sys-kernel/installkernel dracut grub
# kde
kde-plasma/plasma-meta networkmanager kwallet display-manager sddm wacom systemd sdk rdp plymouth oxygen-theme gtk grub discover bluetooth smart
kde-plasma/kde-apps-meta admin education games graphics multimedia network pim sdk utils
# latex
app-text/texlive X cjk context extra games graphics humanities luatex metapost music pdfannotextractor png pstricks publishers science tex4ht texi2html truetype xetex xml
# im
# app-i18n/fcitx 
app-i18n/mozc fcitx5
EOF
touch /etc/portage/package.use/zz-autoconfig

mkdir /etc/portage/repos.conf
cp /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf
sed -i 's|rsync://rsync.gentoo.org/gentoo-portage|rsync://mirrors.bfsu.edu.cn/gentoo-portage|' /etc/portage/repos.conf/gentoo.conf

enable testing flag(optional)

# ~AMD64
tee -a /etc/portage/package.accept_keywords/01studio <<EOF
# testing 
*/* ~amd64
EOF

update and installation

unmask-write, install, enable and reboot

emerge --sync
#eselect profile list | grep plasma
#eselect profile set 
emerge --ask --verbose --update --deep --changed-use @world
emerge --autounmask-write mirrorselect bash-completion net-misc/networkmanager \
app-portage/cpuid2cpuflags sudo glances app-misc/screen \
sys-kernel/installkernel sys-kernel/linux-firmware sys-kernel/gentoo-kernel \
plasma-meta kde-apps-meta \
firefox chromium \
app-editors/kile app-text/texlive

cd /etc/portage/package.use
etc-update --automode -5

emerge mirrorselect bash-completion net-misc/networkmanager \
app-portage/cpuid2cpuflags sudo glances app-misc/screen \
sys-kernel/installkernel sys-kernel/linux-firmware sys-kernel/gentoo-kernel 

grub-install --efi-directoy=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl enable bluetooth
systemctl enable NetwrokManager

install packaged after the reboot

emerge plasma-meta kde-apps-meta \
firefox chromium \
app-editors/kile app-text/texlive
systemctl enable ssdm