Gentoo/studio:修订间差异

来自OSSmedia
无编辑摘要
无编辑摘要
 
(未显示同一用户的9个中间版本)
第1行: 第1行:


== 自制脚本 ==
== chroot preparation ==
请在挂载磁盘后运行(默认位置 /mnt/gentoo)
请在挂载磁盘后运行(默认位置 /mnt/gentoo)
=== stage file and chroot ===
=== stage file and chroot ===
第32行: 第32行:
arch-chroot /mnt/gentoo
arch-chroot /mnt/gentoo
</pre>
</pre>
== target configs==
=== root passwd ===
=== root passwd ===
just do this first please, in case
just do this first please, in case
第49行: 第51行:
VIDEO_CARDS="nvidia amdgpu radeon radeonsi intel mesa"
VIDEO_CARDS="nvidia amdgpu radeon radeonsi intel mesa"
FEATURES="getbinpkg"
FEATURES="getbinpkg"
L10N="zh-CN jp en-US"
EOF
EOF


</pre>
=== cpu config ===
<pre>
# CPU
# CPU
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags
# seems useless
</pre>
=== bin host config ===
 
<pre>
# seems useless, but save your time
tee -a /etc/portage/binrepos.conf/bfsu.conf <<EOF
tee -a /etc/portage/binrepos.conf/bfsu.conf <<EOF
[binhost]
[binhost]
第59行: 第70行:
sync-uri = https://mirrors.bfsu.edu.cn/gentoo/releases/amd64/binpackages/23.0/x86-64/
sync-uri = https://mirrors.bfsu.edu.cn/gentoo/releases/amd64/binpackages/23.0/x86-64/
EOF
EOF
 
</pre>
 
=== USE config ===
<pre>
tee -a /etc/portage/package.use/01studio <<EOF
tee -a /etc/portage/package.use/01studio <<EOF
# kernel
# kernel
第78行: 第90行:
touch /etc/portage/package.use/zz-autoconfig
touch /etc/portage/package.use/zz-autoconfig
</pre>
</pre>
=== bfsu repo ===
=== bfsu gentoo repo mirror ===
<pre>
<pre>
mkdir /etc/portage/repos.conf
mkdir /etc/portage/repos.conf
第92行: 第104行:
EOF
EOF
</pre>
</pre>
=== update and installation ===
== update and installation ==
=== auto conf ===
unmask-write, install, enable and reboot
unmask-write, install, enable and reboot
<pre>
<pre>
第109行: 第122行:
cd /etc/portage/package.use
cd /etc/portage/package.use
etc-update --automode -5
etc-update --automode -5
 
</pre>
=== build softwares and bootloader ===
<pre>
emerge mirrorselect bash-completion net-misc/networkmanager \
emerge mirrorselect bash-completion net-misc/networkmanager \
app-portage/cpuid2cpuflags sudo glances app-misc/screen \
app-portage/cpuid2cpuflags sudo glances app-misc/screen \
第125行: 第140行:
  curl -fsSL "ossmedia.cn/set-ac.sh?raw" | bash
  curl -fsSL "ossmedia.cn/set-ac.sh?raw" | bash
  curl -fsSL "ossmedia.cn/set-proxy.sh?raw" | bash
  curl -fsSL "ossmedia.cn/set-proxy.sh?raw" | bash
 
=== system config before reboot ===
<pre>
systemd-machine-id-setup
systemd-firstboot --prompt
systemctl preset-all --preset-mode=enable-only
</pre>
=== install packaged after the reboot ===
=== install packaged after the reboot ===
package install
package install
第132行: 第152行:
firefox chromium media-fonts/noto-cjk \
firefox chromium media-fonts/noto-cjk \
app-editors/kile app-text/kbibtex app-text/texlive \
app-editors/kile app-text/kbibtex app-text/texlive \
fcitx mozc \
fcitx mozc fcitx-configtool fcitx-chinese-addons \
pipewire libpulse plasma-pa wireplumber
pipewire libpulse plasma-pa wireplumber genlop eix
</pre>
</pre>


第150行: 第170行:
systemctl --user enable --now pipewire.socket pipewire-pulse.socket wireplumber.service
systemctl --user enable --now pipewire.socket pipewire-pulse.socket wireplumber.service
systemctl --user enable --now pipewire.service
systemctl --user enable --now pipewire.service
</pre>
如果在安装时使用gtk2或gtk3 USE标记,<module>(下面的示例中)应是fcitx,否则应是xim。
文件 ~/.xprofile
<pre>
export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE=<module>
export GTK_IM_MODULE=<module>
</pre>
</pre>
=== add gentoo-zh ===
=== add gentoo-zh ===
sudo emerge eselect-repository
sudo eselect repository enable gentoo-zh

2025年1月11日 (六) 14:31的最新版本

chroot preparation

请在挂载磁盘后运行(默认位置 /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

target configs

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"
L10N="zh-CN jp en-US"
EOF

cpu config

# CPU
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

bin host config

# seems useless, but save your time
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

USE config

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
# audio
media-video/pipewire systemd jack-sdk pipewire-alsa sound-server
EOF

touch /etc/portage/package.use/zz-autoconfig

bfsu gentoo repo mirror

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

auto conf

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 \
pipewire libpulse plasma-pa wireplumber

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

build softwares and bootloader

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

setting up some scripts

curl -fsSL "ossmedia.cn/set-ac.sh?raw" | bash
curl -fsSL "ossmedia.cn/set-proxy.sh?raw" | bash

system config before reboot

systemd-machine-id-setup
systemd-firstboot --prompt
systemctl preset-all --preset-mode=enable-only

install packaged after the reboot

package install

emerge plasma-meta kde-apps-meta \
firefox chromium media-fonts/noto-cjk \
app-editors/kile app-text/kbibtex app-text/texlive \
fcitx mozc fcitx-configtool fcitx-chinese-addons \
pipewire libpulse plasma-pa wireplumber genlop eix

enable sddm

systemctl enable ssdm

enable cjk fonts

sudo eselect fontconfig enable 70-noto-cjk.conf

pipewire

sudo usermod -aG pipewire $USER
mkdir ~/.config/pipewire
cp /usr/share/pipewire/pipewire.conf ~/.config/pipewire/
systemctl --user disable --now pulseaudio.socket pulseaudio.service
systemctl --user enable --now pipewire.socket pipewire-pulse.socket wireplumber.service
systemctl --user enable --now pipewire.service

如果在安装时使用gtk2或gtk3 USE标记,<module>(下面的示例中)应是fcitx,否则应是xim。 文件 ~/.xprofile

export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE=<module>
export GTK_IM_MODULE=<module>

add gentoo-zh

sudo emerge eselect-repository sudo eselect repository enable gentoo-zh