ArchInstall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function main() { | |
if curl www.google.com > /dev/null ; then | |
echo net OK | |
else | |
echo no net && exit 3 | |
fi | |
if mount | grep /mnt; then | |
echo mnt OK | |
else | |
echo no mnt && exit 3 | |
fi | |
sed -i 's/^[^#]/#&/g' /etc/pacman.d/mirrorlist | |
sed -i 's/\(#\)\(.*\.tw\/\)/\2/g' /etc/pacman.d/mirrorlist | |
pacstrap /mnt base | |
genfstab -U /mnt >> /mnt/etc/fstab | |
cp $0 /mnt/script | |
chmod +x /mnt/script | |
arch-chroot /mnt /script chroot | |
} | |
function chroot() { | |
echo "arch" >> /etc/hostname | |
echo "arch.localdomain myhostname" >> /etc/hosts | |
#echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen | |
#echo "zh_TW.UTF-8 UTF-8" >> /etc/locale.gen | |
sed 's/\(#\)\(en_US.UTF-8\)/\2/g' -i /etc/locale.gen | |
sed 's/\(#\)\(zh_TW.UTF-8\)/\2/g' -i /etc/locale.gen | |
locale-gen | |
echo "LANG=zh_TW.UTF-8" > /etc/locale.conf | |
useradd -m dd-han | |
echo 'dd-han:arch' | chpasswd | |
sed -i 's/\(#\)\(.*\.tw\/\)/\2/g' /etc/pacman.d/mirrorlist | |
pacman --noconfirm -S sudo | |
usermod -a -G sudo dd-han | |
usermod -a -G wheel dd-han | |
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
ln -s /etc/usr/share/zoneinfo/Asis/Taipei /etc/localtime | |
pacman --noconfirm -S gnome noto-fonts-cjk grub os-prober | |
ln -s /usr/lib/systemd/system/gdm.service /etc/systemd/system/display-manager.service | |
mkinitcpio -p linux | |
grub-install --target=i386-pc /dev/sda | |
grub-mkconfig -o /boot/grub/grub.cfg | |
} | |
if [ "$1" == "chroot" ]; then | |
chroot | |
else | |
main | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment