Última actividad 1771764666

Revisión cff3f77537bc565981cc091832bbe7cc17674765

after-reboot.sh Sin formato
1echo "export EDITOR=nvim" >> ~/.bash_profile
2source ~/.bash_profile
3useradd -m -G wheel -s /bin/bash frain
4passwd frain
5visudo
6
7su frain
8sudo pacman -S chezmoi
9chezmoi init [email protected]:6957efbbba2d7df023d9a849/dotfiles.git
10chezmoi apply
11
arch-install-btrfs.sh Sin formato
1#!/bin/bash
2
3# Variables
4ESP=/dev/nvme0n1p1
5ROOT=/dev/nvme0n1p2
6SWAPFILESIZE=2G
7# Optimization: Added discard=async for NVMe, removed redundant nodiratime
8MOUNT_OPTIONS="noatime,compress=zstd,space_cache=v2,discard=async,ssd"
9
10# 1. Format the partition
11mkfs.btrfs -L ROOT $ROOT -f
12
13# 2. Create Flat Subvolume Layout
14mount $ROOT /mnt
15btrfs sub create /mnt/@
16btrfs sub create /mnt/@home
17btrfs sub create /mnt/@pkg
18btrfs sub create /mnt/@snapshots
19btrfs sub create /mnt/@vm
20btrfs sub create /mnt/@log
21btrfs sub create /mnt/@swap
22umount /mnt
23
24# 3. Mount Root Subvolume
25mount -o $MOUNT_OPTIONS,subvol=@ $ROOT /mnt
26
27# 4. Create Mount Points
28mkdir -p /mnt/{boot,home,var/cache/pacman/pkg,var/log,var/lib/libvirt,.snapshots,btrfs}
29
30# 5. Mount Other Subvolumes
31mount -o $MOUNT_OPTIONS,subvol=@home $ROOT /mnt/home
32mount -o $MOUNT_OPTIONS,subvol=@pkg $ROOT /mnt/var/cache/pacman/pkg
33mount -o $MOUNT_OPTIONS,subvol=@snapshots $ROOT /mnt/.snapshots
34mount -o $MOUNT_OPTIONS,subvol=@log $ROOT /mnt/var/log
35mount -o $MOUNT_OPTIONS,subvolid=5 $ROOT /mnt/btrfs
36
37# 6. Specialized Subvolume Mounting (NoCOW for VMs)
38mount -o $MOUNT_OPTIONS,subvol=@vm $ROOT /mnt/var/lib/libvirt
39chattr +C /mnt/var/lib/libvirt # Disable Copy-on-Write for VM performance
40
41# 7. Mount ESP
42mount $ESP /mnt/boot
43
44# 8. Create Swapfile on Btrfs
45# btrfs-progs automatically handles NoCOW and compression exclusion for swapfiles
46btrfs filesystem mkswapfile --size $SWAPFILESIZE --uuid clear /mnt/btrfs/@swap/swapfile
47swapon /mnt/btrfs/@swap/swapfile
48
49pacstrap -K /mnt base linux linux-firmware intel-ucode sof-firmware networkmanager man-db man-pages neovim grub efibootmgr zsh sudo
arch-install-chroot.sh Sin formato
1# Replace hostname with the name for your host
2export HOST=hostname
3# Replace Europe/London with your Region/City
4export TZ="Asia/Shanghai"
5
6echo $HOST > /etc/hostname
7cat << EOF >> /etc/hosts
8127.0.0.1 localhost
9::1 localhost
10127.0.1.1 $HOST.localdomain $HOST
11EOF
12
13ln -sf /usr/share/zoneinfo/$TZ /etc/localtime
14# Sync system time to hardware clock
15hwclock --systohc
16
17# - set locale
18echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
19#echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen
20locale-gen
21echo 'LANG=en_US.UTF-8' > /etc/locale.conf
22
23grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
24grub-mkconfig -o /boot/grub/grub.cfg
25
26systemctl enable NetworkManager
27# enable ssh root login
28#sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
29
30passwd root
31