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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
| #!/bin/bash
prepare() { DISK=/dev/nvme0n1 ESP=/dev/nvme0n1p1 ROOT=/dev/nvme0n1p2 parted $DISK mklabel gpt parted $DISK mkpart primary 1 512M parted $DISK mkpart primary '512M -1' parted $DISK set 1 boot on
mkfs.fat -F32 $ESP mkfs.ext4 $ROOT
mount $ROOT /mnt mkdir -p /mnt/boot/efi mount $ESP /mnt/boot/efi
echo 'Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/x86_64' > /etc/pacman.d/mirrorlist
pacstrap /mnt base base-devel bash-completion grub efibootmgr genfstab -U -p /mnt > /mnt/etc/fstab
arch-chroot /mnt grub-install --efi-directory=/boot/efi --bootloader-id=Arch arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg arch-chroot /mnt sed '/set timeout=5/{s/5/0/}' -i /boot/grub/grub.cfg
cp install.sh /mnt/root
umount /mnt/boot/efi umount /mnt reboot -f }
pgk=( adobe-source-han-sans-cn-fonts adobe-source-han-sans-jp-fonts adobe-source-han-sans-kr-fonts android-apktool android-emulator android-file-transfer android-platform android-sdk-build-tools android-studio android-support android-support-repository android-tools apache-tools ark chromium deepin-screenshot deepin-screen-recorder docker docker-compose dolphin fcitx-im fcitx-sogoupinyin filelight filezilla git gwenview gradle intellij-idea-ultimate-edition intellij-idea-ultimate-edition-jre jdk8 jq kate kcm-fcitx kdialog kinfocenter konsole libreoffice-still libsodium lrzsz maven metasploit mlocate netease-cloud-music net-tools nodejs noto-fonts noto-fonts-emoji npm ntfs-3g okteta okular openssh pepper-flash phonon-qt5-vlc plasma-desktop plasma-nm plasma-pa powerdevil privoxy proxychains-ng python-pip redis-desktop-manager rsync sddm shadowsocks sublime-text-dev teamviewer typora unrar unzip user-manager virtualbox-ext-oracle virtualbox-guest-iso virtualbox-host-modules-arch vokoscreen-git wewechat wireshark-qt xorg-server xorg-xkill yakuake youtube-dl zip zsh )
aur=( android-google-repository android-sources-28 android-x86-64-system-image-28 archlinux-themes-sddm burpsuite deepin-wine-thunderspeed dex2jar dirbuster maltego python-genpac )
aur() { yaourt -S --noconfirm --needed ${aur[@]} }
setup() { HOSTNAME='主机名' USERNAME='用户名' PASSWORD='密码' SS_CONFIG_NAME='SS配置文件名' SS_SERVER='SS服务器地址' SS_PORT='SS端口' SS_PASSWORD='SS密码' SS_METHOD='SS加密方式'
sed '/#Color\|#TotalDownload\|#\[multilib\]/{s/#//}' -i /etc/pacman.conf sed 's/Required DatabaseOptional/Never/g' -i /etc/pacman.conf sed '94s/#//' -i /etc/pacman.conf echo -e '\n[archlinuxcn]\nServer = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/x86_64' >> /etc/pacman.conf pacman -Syy --noconfirm archlinuxcn-keyring yaourt
useradd -m $USERNAME echo -e "\n$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers echo $USERNAME:$PASSWORD | chpasswd
pacman -S --noconfirm --needed ${pgk[@]}
mv /etc/shadowsocks/example.json /etc/shadowsocks/$SS_CONFIG_NAME.json sed "s/my_server_ip/$SS_SERVER/g" -i /etc/shadowsocks/$SS_CONFIG_NAME.json sed "s/8388/$SS_PORT/g" -i /etc/shadowsocks/$SS_CONFIG_NAME.json sed "s/mypassword/$SS_PASSWORD/g" -i /etc/shadowsocks/$SS_CONFIG_NAME.json sed "s/aes-256-cfb/$SS_METHOD/g" -i /etc/shadowsocks/$SS_CONFIG_NAME.json systemctl enable shadowsocks@$SS_CONFIG_NAME.service systemctl start shadowsocks@$SS_CONFIG_NAME.service
sed '/#quiet_mode/{s/#//}' -i /etc/proxychains.conf sed "s/socks4 127.0.0.1 9050/\nsocks5 127.0.0.1 1080/g" -i /etc/proxychains.conf
sed 's/127.0.0.1:8118/0.0.0.0:8118/g' -i /etc/privoxy/config echo -e '\nforward-socks5 / 127.0.0.1:1080 .' >> /etc/privoxy/config systemctl enable privoxy.service systemctl start privoxy.service sleep 1s
export http_proxy=127.0.0.1:8118 export https_proxy=127.0.0.1:8118
cp install.sh /home/$USERNAME/ chown $USERNAME:$USERNAME /home/$USERNAME/install.sh cd /home/$USERNAME su $USERNAME -c "/home/$USERNAME/install.sh aur"
hostnamectl set-hostname $HOSTNAME
timedatectl set-timezone Asia/Shanghai
sed '/#en_US.UTF-8\|#zh_CN.UTF-8/{s/#//}' -i /etc/locale.gen locale-gen echo 'LANG=en_US.UTF-8' > /etc/locale.conf
su $USERNAME -c 'cd ~ && mkdir Data Documents Downloads Music Pictures Project Software Temp Videos'
echo 'export ANDROID_HOME=/opt/android-sdk' >> /etc/profile ln -s /opt/android-ndk /opt/android-sdk/ndk-bundle chown -R $USERNAME:$USERNAME /opt/android-sdk
su $USERNAME -c "mkdir -p /home/$USERNAME/.config/deepin/deepin-screen-recorder" su $USERNAME -c "echo -e \"[fileformat]\nsave_directory=/home/$USERNAME/Videos\" > ~/.config/deepin/deepin-screen-recorder/config.conf"
gpasswd -a $USERNAME docker mkdir /etc/systemd/system/docker.service.d echo -e '[Service]\nEnvironment="HTTP_PROXY=127.0.0.1:8118"\nEnvironment="HTTPS_PROXY=127.0.0.1:8118"' > /etc/systemd/system/docker.service.d/proxy.conf systemctl enable docker.service
su $USERNAME -c "echo -e 'export GTK_IM_MODULE=fcitx\nexport QT_IM_MODULE=fcitx\nexport XMODIFIERS=@im=fcitx' > /home/$USERNAME/.xprofile"
echo 'export JAVA_HOME=/usr/lib/jvm/java-8-jdk' >> /etc/profile
updatedb
sed '48s/# //' -i /etc/nanorc sed '262s/# //' -i /etc/nanorc
npm i -g cnpm --registry=https://registry.npm.taobao.org npm i -g hexo-cli
systemctl enable NetworkManager.service
sed 's/127.0.0.1:8118/0.0.0.0:8118/g' -i /etc/privoxy/config echo -e '\nforward-socks5 / 127.0.0.1:1080 .' >> /etc/privoxy/config systemctl enable privoxy.service systemctl start privoxy.service
su $USERNAME -c "genpac --format=pac --pac-proxy=\"SOCKS5 127.0.0.1:1080\" > /home/$USERNAME/.pac"
sddm --example-config > /etc/sddm.conf sed '/Current=/{s/=/=archlinux-simplyblack/}' -i /etc/sddm.conf systemctl enable sddm.service
systemctl enable teamviewerd.service
gpasswd -a $USERNAME vboxusers
gpasswd -a $USERNAME wireshark
echo $PASSWORD | sudo -S su $USERNAME -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" reboot -f }
$1
|