Skip to content

Commit e64c70f

Browse files
committed
add ArchLinux base system install script version 1.0
1 parent c9c10de commit e64c70f

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

chroot.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
echo configure language
3+
echo "LANG=en_US.UTF-8" > /etc/locale.conf
4+
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
5+
echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen
6+
echo "zh_CN.GBK GBK" >> /etc/locale.gen
7+
echo "zh_CN GB2312" >> /etc/locale.gen
8+
locale-gen
9+
10+
echo set time zone info
11+
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
12+
hwclock --systohc --local
13+
14+
echo change hostname and root password
15+
echo "ArchLinux" > /etc/hostname
16+
echo root:rootpasswd | chpasswd
17+
18+
echo Install base softwares and configure grub
19+
pacman -S vim net-tools dnsutils git grub os-prober ntfs-3g dialog wpa_supplicant --noconfirm
20+
grub-install --target=i386-pc --recheck /dev/sda
21+
grub-mkconfig -o /boot/grub/grub.cfg
22+
23+
systemctl enable dhcpcd
24+
exit

installArch.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
Continue ()
4+
{
5+
sleep 2
6+
read -p "sure ?" queren
7+
if [ ${queren:0:1} = 'n' ]; then
8+
exit 1
9+
fi
10+
}
11+
12+
echo "please make sure you have parted and mounted already!!!"
13+
mount | grep sda
14+
if [ $? -ne 0 ]; then
15+
echo "please mount before!!!"
16+
exit 0
17+
fi
18+
19+
echo "add ArchLinuxcn source to pacman's conf, and change /etc/pacman.d/mirrorlist"
20+
# pacman.conf
21+
cat /etc/pacman.conf | grep archlinuxcn
22+
if [ $? -ne 0 ]; then
23+
pacman_conf="/etc/pacman.conf"
24+
pacman_mirrorlist="/etc/pacman.d/mirrorlist"
25+
# pacman.conf
26+
echo "[archlinuxcn]" >> $pacman_conf
27+
echo "SigLevel = Optional TrustAll" >> $pacman_conf
28+
echo 'Server = http://mirrors.ustc.edu.cn/archlinuxcn/$arch' >> $pacman_conf
29+
fi
30+
# mirrorlist
31+
echo 'Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' > $pacman_mirrorlist
32+
33+
34+
echo update source and install base system
35+
echo please make sure you have a good network!!!
36+
pacman -Syy
37+
pacstrap /mnt base base-devel
38+
39+
40+
echo generate fstab and chroot
41+
genfstab -U -p /mnt >> /mnt/etc/fstab
42+
wget https://raw.githubusercontent.com/nxmup/AutoInstall/master/chroot.sh
43+
cp chroot.sh /mnt
44+
chmod +x /mnt/chroot.sh
45+
arch-chroot /mnt /bin/bash -c "./chroot.sh"
46+
47+
48+
echo "Root password is: rootpasswd, please use command: passwd root change your password immediately!!!!"
49+
echo "Default language is en_US, please change it from /etc/locale.conf if u want."
50+
echo "Default timezone is Asia/Shanghai, change it if u want."

0 commit comments

Comments
 (0)