-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
53 lines (42 loc) · 1.24 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
# locale
sed -i \
-e "s/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" \
-e "s/^#zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/" \
/etc/locale.gen
locale-gen
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
# pacman
sed -i \
-e "s/^#DisableSandbox/DisableSandbox/" \
/etc/pacman.conf
echo 'Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
pacman-key --init && pacman-key --populate
pacman -Sy --noconfirm archlinux-keyring && pacman -Su --noconfirm
# uninstall packages
pacman -R --noconfirm arch-install-scripts
# install packages
pacman -S --needed --noconfirm vim sudo wget man base-devel pacman-contrib
# create user
read -p "Please enter your username: " username
sed -i -e "s/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/" /etc/sudoers
useradd $username -m -G wheel -s /bin/bash
echo "password for $username"
passwd $username
# default user, enable systemd
echo -e "[user]\ndefault=$username\n[boot]\nsystemd=true" > /etc/wsl.conf
# docker
pacman -S --needed --noconfirm docker
usermod -aG docker $username
mkdir /etc/docker
MIRROR=http://hub-mirror.c.163.com
cat << EOF > /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"registry-mirrors": ["$MIRROR"]
}
EOF