Skip to content

Instantly share code, notes, and snippets.

@alphaKAI
Created November 1, 2012 08:38
Show Gist options
  • Save alphaKAI/3992521 to your computer and use it in GitHub Desktop.
Save alphaKAI/3992521 to your computer and use it in GitHub Desktop.
Arch Linux Auto Install ShellScript Ver.0006_FIX_02 (開発途中)
#!/bin/sh
# Arch Linux Auto Install Shell Script
# COPYRIGHT (c) 2012 α改 @alpha_kai_NET http://alpha-kai-net.info
#=========================================================================================
# ==About==
# 日本語版Version
# 現バージョンはver.0006_FIX_02です
# このシェルスクリプトはGPLv3 LICENSEで公開しています
# いかなる保証もα改 @alpha_kai_NETは行いません
# ver.0001/2はバックアップがないため存在しません
# α改があくまでも自分のために書いたもの
# 事故っても責任取れません(大した事故は起きないはず)
# 著作権はα改 @alpha_kai_NETに帰属します
# 自分の環境向けに改変はおkです コレは無断でしていただいて結構です
# 改変したものを2次配布スル場合はα改 @alpha_kai_NETに一言いってくれるとうれしいです
# English Version
# The current version is Ver.0006_FIX_02
# This shell script has been published in GPLv3 LICENSE
# α改 alpha_kai_NET makes no warranty of any kind
# Ver.0001 / 2 does not exist because there is no backup
# These Shell Script write for me.
# I do not take responsibility even if the accident occurred.
# Modification is available for your environment.
# In this case is not required to contact alpha_kai_NET.
# If you plan to distribute the secondary ones modified, please contact the alpha_kai_NET.
# Version
#- 更新内容
# 0005
# ユーザーが任意のファイルシステムを使用出来るようにした
# 0006
# 新機能の搭載とbug fix
# 0006_FIX_01
# 0006のbug fix
# 0006_FIX_02
# 0006_FIX_01のbug fix
# カウントダウンつけてみた
#=========================================================================================
#===================ここより開始===================
#警告
#echoだと馬鹿らしいのでcatとヒアドキュメント
cat << EOT
COPYRIGHT alpha_kai_NET 2012
The current version is Ver.0006_FIX_02
Modification is available for your environment
In this case is not required to contact alpha_kai_NET
If you plan to distribute the secondary ones modified, please contact the alpha_kai_NET
!!WARNING!!
These Shell Script write for me.
Always read the ReadME
Please be sure to check the shell script once
I do not take responsibility even if the accident occurred.
EOT
#ここまで
#HDDのパーティション構成は変更することは出来ません
cat << EOT
Connect the HDD you want to install only one.
You can not change the configuration of the partition.
/dev/sda1 ... /boot
/dev/sda5 ... swap
/dev/sda6 ... /
/dev/sda7 ... /home
Enter a YES If you can agree to the terms of the above.
Enter the NO if you do not agree with.
>
EOT
#ここまで
#YEN or NOの入力
read select1
case $select1 in
YES)
#開始
#rootのpasswd
echo "Please set a password for the root."
echo ">"
read rootpass
#hostname設定
echo "Please set a hostname."
echo ">"
read host_name
#KeyMapのよみこみ
loadkeys jp106
#Internet 接続(有線)
ifconfig eth0
dhcpcd eth0
#パーティション表示
cat << EOT
Partition configuration is.
/dev/sda1 ... /boot
/dev/sda5 ... swap
/dev/sda6 ... /
/dev/sda7 ... /home
EOT
#ここまで
cat << EOT
start cfdisk
You must create partition as above.
please input any key.
EOT
#ここまで
read select02
case $select02 in
*)
cfdisk /dev/sda
;;
esac
#フォーマットの表示
cat << EOT
You can select file system format type is.
======================
Ext2
Ext3
Ext4
Reiser3
Reiser4
XFS
Btrfs
...
!!Other Fire system. You can use other file system.!!
=====================
EOT
#ここまで
#ファイルシステム選択
echo "Please set File System format of /dev/sda1"
read sda1_format
echo "Please set File System format of /dev/sda6"
read sda6_format
echo "Please set File System format of /dev/sda7"
read sda7_format
#HDDフォーマット
mkfs.$sda1_format /dev/sda1
mkfs.$sda6_format /dev/sda6
mkfs.$sda7_format /dev/sda7
#HDDマウント
mount /dev/sda6 /mnt
mkdir /mnt/home && mkdir /mnt/boot
mount /dev/sda7 /mnt/home
mount /dev/sda1 /mnt/boot
#swapの設定
mkswap /dev/sda5
swapon /dev/sda5
#ベースシステムのインストール
pacstrap /mnt base base-devel
pacstrap /mnt grub-bios
genfstab -p /mnt >> /mnt/etc/fstab
#ここから
#chroot環境突入
arch-chroot /mnt << EOT
#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
#rc.cnfの設定 なんかアレですな・・・
#とりあえず動く感じ
echo HARDWARECLOCK=\"localtime\"> /etc/rc.conf
echo USEDIRECTISA=\"UTC\" >> /etc/rc.conf
echo TIMEZONE=\"Asia/Tokyo\" >> /etc/rc.conf
echo KEYMAP=\"jp106\" >> /etc/rc.conf
echo CONSOLEFONT= >> /etc/rc.conf
echo CONSOLEMAP= >> /etc/rc.conf
echo USECOLOR=\"yes\" >> /etc/rc.conf
echo eth0=\"dhcp\" >> /etc/rc.conf
echo DAEMONS=() >> /etc/rc.conf
echo Network >> /etc/rc.conf
echo interface=\"eth0\" >> /etc/rc.conf
#/etc/locale.gen で必要なもののコメントを外す
#ja_JP.UTF-8 UTF-8の#を外してコメントアウトを解除
#コメントアウトさせたものを一旦locale2.genで吐かせて そして locale.senけしてリネーム
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
#grub をMBR にインストールする
grub-install /dev/sda
#grub の設定ファイルを作成する。
grub-mkconfig -o /boot/grub/grub.cfg
#root パスワードを設定する
passwd
$rootpass
$rootpass
#chroot 環境を抜けて/mnt 以下をアンマウントする。
exit
EOT
#swapの設定 (いろいろ場所変えてるからどうするか迷っててアレ・・・ とりあえずここに書いてる)
echo "/dev/sda5 swap swap defaults 0 0 >> /etc/fstab"
#アンマウント
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"
echo "reboot"
;;
esac
#再起動
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