这是一个夜间写出的shell脚本,有待进一步调试,我只进行了调试安装,可以安装成功 Archlinux + DDE V20 环境。
#!/bin/bash
################ README INFO ##################
Purpose: Install Arch Linux OS From Live CD
Made By: PomanTeng
E-mail: [email protected]
WeChat: 1807479153
Version Identification Number:V0.00
Procedure Identification Number:20200817
###############################################
Declare User-Variables
deviceName=fdisk -l | grep "^Disk /dev/[sh]d[a-z]" | awk -F: '{print $1}'
targetDisk=$(echo $deviceName | awk -F " " '{print $2}')
preRootPartition=$(fdisk -l | grep "^/dev/[sh]d[a-z]" | awk -F " " '{print $1}' | awk 'NR==1{print}')
preSWAPPartition=$(fdisk -l | grep "^/dev/[sh]d[a-z]" | awk -F " " '{print $1}' | awk 'NR==2{print}')
Pre-Check
timedatectl set-ntp true
ping -c 5 archlinux.org
Partitioning the Disk
fdisk $targetDisk
o
n
p
+116G
n
p
t
2
L
82
a
1
w
Format Partitions
mkfs -t ext4 -c $preRootPartition
mkswap $preSWAPPartition
Mount Partitions
mount $preRootPartition /mnt
Install the Base OS
pacstrap /mnt base base-devel linux linux-firmware amd-ucode intel-ucode bash-completion nano vim gedit dhcpcd xfsprogs openssh networkmanager pacman-contrib sudo netctl wget curl grub yaourt yay systemd-swap unrar file-roller unzip p7zip ntfs-3g dosfstools create_ap
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc --utc
cp /etc/locale.gen{,.original}
cat > /etc/locale.gen << EOF
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
EOF
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
read -p "请输入需创建的用户名:" $1
useradd $1
read -p "请设置$1用户密码:" $2
echo "$2" | passwd --stdin $1 > /dev/null
pacman -S os-prober
Configure image source
cat >> /etc/pacman.conf <<-'EOF'
[archlinuxcn]
#Server = https://repo.archlinuxcn.org/$arch
Server = https://mirrors.aliyun.com/archlinuxcn/$arch
[multilib]
Include = /etc/pacman.d/mirrorlist
EOF
pacman -S archlinuxcn-keyring
pacman -S archlinuxcn-keyring
pacman -Sy
pacman -Syy
pacman -Syu
pacman -Syyu
#Install DDE GUI
pacman -S --noconfirm xorg xorg-xinit ttf-dejavu wqy-microhei ttf-liberation ttf-dejavu ttf-roboto ttf-droid adobe-source-han-sans-otc-fonts adobe-source-han-serif-otc-fonts adobe-source-code-pro-fonts adobe-source-sans-pro-fonts adobe-source-serif-pro-fonts noto-fonts noto-fonts-extra noto-fonts-emoji ttf-fira-code
pacman -S --noconfirm deepin deepin-extra lightdm lightdm-deepin-greeter
pacman -S --noconfirm xf86-input-libinput xf86-input-synaptics iw iwd wpa_supplicant dialog dhcpcd networkmanager
pacman -S --noconfirm fcitx-im fcitx-configtool fcitx-rime fcitx-gtk2 fcitx-googlepinyin fcitx-libpinyin
pacman -S --noconfirm cpupower bluedevil bluez bluez-utils pulseaudio-bluetooth alsa-utils pulseaudio-alsa
systemctl enable cpupower
systemctl enable NetworkManager.service
systemctl enable iwd
systemctl enable dhcpcd
systemctl restart sshd
systemctl enable sshd
systemctl enable lightdm.service
systemctl enable bluetooth.service
echo "exec startdde" >> ~/.xinitrc
locale-gen
cp /etc/locale.conf{,.original}
cat > /etc/locale.conf << EOF
#LANG=en_US.UTF-8
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:en_US
EOF
grub-install --target=i386-pc $targetDisk
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot