Skip to content

Instantly share code, notes, and snippets.

@hiroyuki12
Last active May 28, 2020 16:26
Show Gist options
  • Save hiroyuki12/7a342b0f05330870636a20c6341d17a4 to your computer and use it in GitHub Desktop.
Save hiroyuki12/7a342b0f05330870636a20c6341d17a4 to your computer and use it in GitHub Desktop.
#!/bin/sh
# archlinux-2020.05.01-x86_64.iso
# 2020/05/28
cat << EOT
Enter a
>
EOT
#a の入力
read select1
case $select1 in
a)
#開始
#rootのpasswd
echo "Please set a password for the root."
echo ">"
read rootpass
#hostname設定
echo "Please set a hostname.(arch)"
echo ">"
read host_name
#KeyMapのよみこみ
loadkeys jp106
#Internet 接続(有線) 設定ではない
ifconfig eth0
dhcpcd eth0
#HDDフォーマット
mkfs -t ext4 /dev/sda1
mkfs -t reiserfs /dev/sda2
mkfs -t ext2 /dev/sda3
mkfs -t ext4 /dev/sda5
#HDDマウント
mount -t ext4 /dev/sda1 /mnt
mkdir /mnt/{var,boot,home}
mount -t reiserfs /dev/sda2 /mnt/var
mount -t ext2 /dev/sda3 /mnt/boot
mount -t ext4 /dev/sda5 /mnt/home
#日本のサーバをリストの一番上に持ってくる
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.org
echo Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/\$repo/os/\$arch > /etc/pacman.d/mirrorlist
#ベースシステムのインストール
pacstrap /mnt linux linux-firmware mkinitcpio base base-devel grub-bios networkmanager wireless_tools git zsh vim tmux openssh sudo xorg xorg-xinit xterm ttf-droid leafpad uim anthy flashplugin wget fcitx-mozc fcitx-gtk2 fcitx-gtk3 fcitx-configtool tint2
genfstab -p /mnt >> /mnt/etc/fstab
#ここから
#chroot
arch-chroot /mnt << SETTING
#hostnameの設定(識別名)
echo "$host_name" > /etc/hostname
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
#locale の設定を/etc/locale.conf でする。
echo LANG=\"ja_JP.UTF-8\" > /etc/locale.conf
echo KEYMAP=\"jp106\" >> /etc/locale.conf
echo KEYMAP=\"jp106\" >> /etc/rc.conf
#/etc/locale.gen で必要なもののコメントを外す
#ja_JP.UTF-8 UTF-8の#を外してコメントアウトを解除
#コメントアウトさせたものを一旦locale2.genで吐かせて そして locale.genけしてリネーム
sed -e "s/#ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/" /etc/locale.gen >> /etc/locale2.gen
rm /etc/locale.gen
mv /etc/locale2.gen /etc/locale.gen
locale-gen
mkinitcpio -p linux
#grub をMBR にインストールする
grub-install --target=i386-pc --recheck --debug /dev/sda
mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg
#root パスワードを設定する
passwd
$rootpass
$rootpass
systemctl start NetworkManager.service
systemctl enable NetworkManager.service
useradd -m -g users -s /bin/bash hiroyuki
passwd hiroyuki
$rootpass
$rootpass
# alias
echo alias sea=\'sudo pacman -Ss\' >> /home/hiroyuki/.bashrc
echo alias s=\'sudo pacman -Ss\' >> /home/hiroyuki/.bashrc
echo alias ss=\'packer -Ss\' >> /home/hiroyuki/.bashrc
echo alias a=\'sudo pacman -S\' >> /home/hiroyuki/.bashrc
echo alias bb=\'sudo pacman -Syu\' >> /home/hiroyuki/.bashrc
echo alias i=\'pacman -Si\' >> /home/hiroyuki/.bashrc
echo alias q=\'pacman -Qi\' >> /home/hiroyuki/.bashrc
echo alias l=\'pacman -Ql\' >> /home/hiroyuki/.bashrc
echo alias r=\'sudo pacman -Rsn\' >> /home/hiroyuki/.bashrc
echo alias le=\'leafpad\' >> /home/hiroyuki/.bashrc
echo alias vi=\'vim\' >> /home/hiroyuki/.bashrc
echo alias ..=\'cd ..\' >> /home/hiroyuki/.bashrc
echo alias list=\'pacman -Qqe \> pkglist\' >> /home/hiroyuki/.bashrc
echo alias c=\'sudo pacman -Sc\' >> /home/hiroyuki/.bashrc
echo alias d=\'cd /home/hiroyuki/Downloads\' >> /home/hiroyuki/.bashrc
echo alias df=\'df -h\' >> /home/hiroyuki/.bashrc
echo alias paco=\'sudo paco -lD+ \"make install\"\' >> /home/hiroyuki/.bashrc
#chroot 環境を抜けて/mnt 以下をアンマウントする。
exit
SETTING
#アンマウント
umount /mnt/{boot,home,}
#インストール完了通知
#Enter
cat << EOT
Install was completed !!!.
You enter the any key to be reboot.
Press Enter \"Enterkey\".
To reboot after 10 sec .
EOT
read select03
case $select03 in
*)
#10秒カウントダウン
i=0
while [ "$i" -le 10]
do
h=10-$i
echo "$h"
sleep 1
done
echo "done"
;;
esac
echo "reject"
reject
echo "reboot"
#再起動
reboot
#ここまで
;;
#NOを入力した場合
NO)
echo "You was enter the \"NO\""
echo "Perform a restart after 10 seconds."
while [ "$i" -le 10]
do
h=10-$i
echo"$h"
sleep 1
done
echo "done"
echo "reboot"
#再起動
reboot
#ここまで
;;
*)
echo "You must enter \"YSE\" or \"NO\""
exit
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment