Last active
November 9, 2024 07:15
-
-
Save MaxLHy0424/4254cfd932485a93b3b0b73274858bc9 to your computer and use it in GitHub Desktop.
方便地配置 Arch WSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo pacman -S sed nano --needed --noconfirm | |
echo 'bind ^X cut main | |
bind ^C copy main | |
bind ^V paste all | |
bind ^Q exit all | |
bind ^S savefile main | |
bind ^W writeout main | |
bind ^O insert main | |
bind ^H help all | |
bind ^H exit help | |
bind ^F whereis all | |
bind ^G findnext all | |
bind ^B wherewas all | |
bind ^D findprevious all | |
bind ^R replace main | |
unbind ^U all | |
unbind ^N main | |
unbind ^Y all | |
unbind M-J main | |
unbind M-T main | |
bind ^A mark main | |
bind ^P location main | |
bind ^T gotoline main | |
bind ^T gotodir browser | |
bind ^T cutrestoffile execute | |
bind ^L linter execute | |
bind ^E execute main | |
bind ^K "{mark}{end}{zap}" main | |
bind ^U "{mark}{home}{zap}" main | |
bind ^Z undo main | |
bind ^Y redo main | |
set tabsize 4 | |
set autoindent | |
set noconvert | |
set smarthome | |
set tabstospaces | |
set mouse | |
set linenumbers | |
set casesensitive | |
set multibuffer | |
set nonewlines | |
set magic | |
set softwrap | |
set wordbounds | |
set constantshow | |
include /usr/share/nano/*.*' | sudo tee -a /etc/nanorc | |
sudo sed -i '1iServer = https:\/\/mirrors.tuna.tsinghua.edu.cn\/archlinux\/\$repo\/os\/\$arch' /etc/pacman.d/mirrorlist | |
sudo sed -i 's/#UseSyslog/UseSyslog/g' /etc/pacman.conf | |
sudo sed -i 's/#Color/Color/g' /etc/pacman.conf | |
sudo sed -i 's/NoProgressBar/#NoProgressBar/g' /etc/pacman.conf | |
sudo sed -i 's/ParallelDownloads = 5/ParallelDownloads = 100/g' /etc/pacman.conf | |
sudo sed -i '68,$d' /etc/pacman.conf | |
echo '[testing] | |
Include = /etc/pacman.d/mirrorlist | |
[staging] | |
Include = /etc/pacman.d/mirrorlist | |
[core-testing] | |
Include = /etc/pacman.d/mirrorlist | |
[core-staging] | |
Include = /etc/pacman.d/mirrorlist | |
[core] | |
Include = /etc/pacman.d/mirrorlist | |
[extra-testing] | |
Include = /etc/pacman.d/mirrorlist | |
[extra-staging] | |
Include = /etc/pacman.d/mirrorlist | |
[extra] | |
Include = /etc/pacman.d/mirrorlist | |
[community-testing] | |
Include = /etc/pacman.d/mirrorlist | |
[community-staging] | |
Include = /etc/pacman.d/mirrorlist | |
[community] | |
Include = /etc/pacman.d/mirrorlist | |
[multilib-testing] | |
Include = /etc/pacman.d/mirrorlist | |
[multilib-staging] | |
Include = /etc/pacman.d/mirrorlist | |
[multilib] | |
Include = /etc/pacman.d/mirrorlist | |
[kde-unstable] | |
Include = /etc/pacman.d/mirrorlist | |
[gnome-unstable] | |
Include = /etc/pacman.d/mirrorlist | |
[archlinuxcn] | |
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch | |
[blackarch] | |
SigLevel = Never | |
Server = https://mirrors.tuna.tsinghua.edu.cn/blackarch/$repo/os/$arch' | sudo tee -a /etc/pacman.conf | |
sudo pacman-key --init | |
sudo pacman-key --lsign-key 'farseerfc@archlinux.org' | |
sudo pacman -Sy archlinuxcn-keyring blackarch-keyring --noconfirm | |
sudo pacman -S paru vifm --noconfirm | |
echo '# | |
# $PARU_CONF | |
# /etc/paru.conf | |
# ~/.config/paru/paru.conf | |
# | |
# See the paru.conf(5) manpage for options | |
# | |
# GENERAL OPTIONS | |
# | |
[options] | |
PgpFetch | |
Devel | |
Provides | |
DevelSuffixes = -git -cvs -svn -bzr -darcs -always -hg -fossil | |
#AurOnly | |
BottomUp | |
RemoveMake | |
SudoLoop | |
#UseAsk | |
SaveChanges | |
#CombinedUpgrade | |
CleanAfter | |
UpgradeMenu | |
NewsOnUpgrade | |
#LocalRepo | |
#Chroot | |
#Sign | |
#SignDb | |
#KeepRepoCache | |
# | |
# Binary OPTIONS | |
# | |
[bin] | |
FileManager = vifm | |
MFlags = --skipinteg | |
#Sudo = doas' | sudo tee /etc/paru.conf | |
sudo sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen | |
sudo sed -i 's/#zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/g' /etc/locale.gen | |
echo 'LANG=en_US.UTF-8' | sudo tee /etc/locale.conf | |
echo 'export LC_ALL=zh_CN.UTF-8 | |
export LANG=zh_CN.UTF-8 | |
export LANGUAGE=zh_CN:en_US' | sudo tee -a /etc/profile | |
sudo pacman -S adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts wqy-microhei wqy-microhei-lite ttf-hannom wqy-zenhei wqy-bitmapfont ttf-arphic-ukai ttf-arphic-uming ttf-hannom noto-fonts opendesktop-fonts noto-fonts-emoji --noconfirm | |
sudo locale-gen | |
echo '# Type Path Mode UID GID Age Argument | |
L+ /tmp/.X11-unix - - - - /mnt/wslg/.X11-unix' | sudo tee /etc/tmpfiles.d/wslg.conf | |
echo '[boot] | |
systemd=true' | sudo tee /etc/wsl.conf | |
sudo pacman -Syyu base base-devel git zip unzip net-tools tree python wget btop fastfetch --needed --noconfirm | |
sudo pacman -Rcns $(pacman -Qtdq) --noconfirm | |
sudo pacman -Scc --noconfirm | |
sudo sed -i '38a\DownloadUser = alpm\n#DisableSandbox' /etc/pacman.conf | |
echo '#!/hint/bash | |
# shellcheck disable=2034 | |
# | |
# /etc/makepkg.conf.d/rust.conf | |
# | |
######################################################################### | |
# RUST LANGUAGE SUPPORT | |
######################################################################### | |
# Flags used for the Rust compiler, similar in spirit to CFLAGS. Read | |
# linkman:rustc[1] for more details on the available flags. | |
RUSTFLAGS="-Cforce-frame-pointers=yes" | |
# Additional compiler flags appended to `RUSTFLAGS` for use in debugging. | |
# Usually this would include: ``-C debuginfo=2''. Read linkman:rustc[1] for | |
# more details on the available flags. | |
DEBUG_RUSTFLAGS="-C debuginfo=2"' | sudo tee /etc/makepkg.conf.d/rust.conf | |
sudo rm -rf /etc/pacman.conf.pacnew /etc/makepkg.conf.d/rust.conf.pacnew /etc/nanorc.pacnew /etc/sudoers.pacnew | |
sudo rm -rf /tmp/* | |
for i in {font,ICE,X11,XIM}; do sudo rm -rf /tmp/.${i}-unix; done | |
for i in {cache,log,tmp}; do sudo rm -rf /var/${i}/*; done | |
echo ' | |
本 Shell 脚本已经帮助您: | |
1. 配置 GNU Nano; | |
2. 配置清华镜像源; | |
3. 配置 pacman; | |
4. 添加 archlinuxcn 和 blackarch 仓库; | |
5. 启用所有测试仓库; | |
6. 汉化系统, 安装常用字体; | |
7. 启用 WSLg 和 Systemd; | |
8. 安装必要软件包, paru, vifm, btop, fastfetch; | |
9. 更新所有软件包; | |
10. 清理无用软件包依赖和临时文件. | |
如果只有 root 用户, 建议您再创建一个普通用户. | |
如果不知道 root 用户密码, 请尽快使用命令 sudo passwd 修改. | |
请尽快重启 Arch WSL.' |
Note
已于 2024/08/27 合入脚本.
最近由于 core-testing 仓库内 pacman 更新至 v7.0.0, 导致新的配置文件未被合并. 主要是[options]
出现不同, 需要手动调整.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note
已于 2024/08/27 合入脚本, 2024/09/15 移除.
最近由于 core-testing 仓库内 pacman 更新至 v7.0.0, 导致 paru 报错:
目前的临时解决方案是, 创建一个名为 libalpm.so.14 的硬链接指向 libalpm.so.15.
具体命令如下:
顺带一提, yay 也存在类似的问题, 解决方法相同.
之后也可以通过类似的方法解决这类问题. 不过终究是临时方法, 等 paru 适配后, 建议删掉创建的硬链接.