Compare commits

..

3 commits

3 changed files with 117 additions and 8 deletions

View file

@ -42,7 +42,7 @@ function install_zsh () {
function setup_swapfile () { function setup_swapfile () {
printf "Swapfile setup\n" printf "Swapfile setup\n"
printf "Please enter swapfile capacity (example : ~ M)\n" printf "Please enter swapfile capacity (example : ~ M)\n"
read swapcap read -r swapcap
if [ "$1" == "btrfs" ]; then if [ "$1" == "btrfs" ]; then
sudo truncate -s 0 /swapfile sudo truncate -s 0 /swapfile
sudo chattr +C /swapfile sudo chattr +C /swapfile
@ -73,13 +73,13 @@ function setup_time () {
function install_yay () { function install_yay () {
printf "AUR setup (yay)\n" printf "AUR setup (yay)\n"
cd "$HOME"/Temp cd "$HOME"/Temp || exit
sudo pacman -Sy sudo pacman -Sy
sudo pacman -S --noconfirm git sudo pacman -S --noconfirm git
git clone https://aur.archlinux.org/yay.git git clone https://aur.archlinux.org/yay.git
cd yay cd yay || exit
makepkg -si makepkg -si
cd "$HOME" cd "$HOME" || exit
} }
function install_fonts () { function install_fonts () {
@ -87,12 +87,19 @@ function install_fonts () {
sudo pacman -S --noconfirm noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra sudo pacman -S --noconfirm noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra
} }
function install_ca () {
printf "Install CA\n"
cd "$HOME"/Temp || exit
curl -OLk https://192.168.1.64:8443/www/suti7/tx1310m3_CA.pem
sudo trust anchor ./tx1310m3_CA.pem
}
printf "Do you want to the initial setup? (yes or no)\n" printf "Do you want to the initial setup? (yes or no)\n"
read temp read -r temp
if [ "$temp" == "yes" ]; then if [ "$temp" == "yes" ]; then
printf "What is the file system of the root directory? (ext4 or btrfs)\n" printf "What is the file system of the root directory? (ext4 or btrfs)\n"
read filesystem read -r filesystem
if [ "$filesystem" == "btrfs" ]; then if [ "$filesystem" == "btrfs" ]; then
setup_swapfile btrfs setup_swapfile btrfs
@ -105,6 +112,7 @@ if [ "$temp" == "yes" ]; then
install_fonts install_fonts
install_yay install_yay
install_zsh install_zsh
install_ca
printf "Finished.\n" printf "Finished.\n"
else else

View file

@ -1,8 +1,8 @@
#!/usr/bin/bash #!/usr/bin/bash
printf "Do you want to install KDE Plasma? (yes or no)\n" printf "Do you want to install KDE Plasma? (yes or no)\n"
read temp read -r temp
if [ $temp == "yes" ]; then if [ "$temp" == "yes" ]; then
sudo pacman -Syu --noconfirm sudo pacman -Syu --noconfirm
sudo pacman -S plasma-meta sddm sddm-kcm packagekit-qt5 fcitx5-im konsole dolphin spectacle ark flatpak xdg-desktop-portal-gtk --noconfirm sudo pacman -S plasma-meta sddm sddm-kcm packagekit-qt5 fcitx5-im konsole dolphin spectacle ark flatpak xdg-desktop-portal-gtk --noconfirm
curl -OLk https://192.168.1.64:8443/www/suti7/arch/package/fcitx5-mozc-ext-neologd-2.30.5432.102.g441b11c-1-x86_64.pkg.tar.zst curl -OLk https://192.168.1.64:8443/www/suti7/arch/package/fcitx5-mozc-ext-neologd-2.30.5432.102.g441b11c-1-x86_64.pkg.tar.zst

101
install/linux/linux.sh Normal file
View file

@ -0,0 +1,101 @@
#!/bin/bash
loadkeys jp106
#キーボードを日本語配列へ変更
printf "Please enter your username\n"
read -r home_username
printf "Please enter your password\n"
read -sr home_password
printf "Please enter Hostname\n"
read -r hostname1
fdisk -l
#ディスク一覧表示
printf "\nWhat disk do you want to install to? example:/dev/sda \n\n"
read -r installdisk
printf "\nChoose the file system to use for your root partition. (ext4, btrfs)"
read -r filesystem
printf "\nChoose the kernel you want to use. (linux, zen, lts)"
read -r kernel
#インストールするディスクを入力
printf "%s (%s) is selected as the disk to install. Are you sure you want to perform the partition operation? (yes or no) \n" "$installdisk" "$filesystem"
read -r check1
#インストールするディスクを確認
if [ "$check1" == "yes" ]; then
printf "%s" "$installdisk" >> ./installdisk.txt
if [ "$(grep "nvme" -rl ./installdisk.txt)" == "./installdisk.txt" ]; then
d1="${installdisk}p1"
d2="${installdisk}p2"
elif [ "$(grep "mmcblk" -rl ./installdisk.txt)" == "./installdisk.txt" ]; then
d1="${installdisk}p1"
d2="${installdisk}p2"
else
d1="${installdisk}1"
d2="${installdisk}2"
fi
#1,2の番号をつけるのとディスクの種類を判断
sgdisk -o "$installdisk" -g
sgdisk -n 1:0:+1024M -t 1:ef00 -c 1:"EFI System" "$installdisk"
sgdisk -n 2:0: -t 2:8300 -c 2:"Linux filesystem" "$installdisk"
#パーティション操作
mkfs.vfat -F32 "$d1"
if [ "$filesystem" == "ext4" ]; then
mkfs.ext4 "$d2"
elif [ "$filesystem" == "btrfs" ]; then
mkfs.btrfs -f "$d2"
else
mkfs.ext4 "$d2"
fi
#フォーマット
mount "$d2" /mnt
mkdir /mnt/boot
mount "$d1" /mnt/boot
#マウント
reflector --sort rate --country jp --latest 10 --save /etc/pacman.d/mirrorlist
#ミラーリストかえたい!!
pacman -Sy
pacman -S --noconfirm archlinux-keyring
if [ "$kernel" == "linux" ]; then
pacstrap /mnt base base-devel linux linux-firmware linux-headers btrfs-progs ntfs-3g exfatprogs grub dosfstools efibootmgr networkmanager dialog vi nano intel-ucode
elif [ "$kernel" == "zen" ]; then
pacstrap /mnt base base-devel linux-zen linux-firmware linux-zen-headers btrfs-progs ntfs-3g exfatprogs grub dosfstools efibootmgr networkmanager dialog vi nano intel-ucode
elif [ "$kernel" == "lts" ]; then
pacstrap /mnt base base-devel linux-lts linux-firmware linux-lts-headers btrfs-progs ntfs-3g exfatprogs grub dosfstools efibootmgr networkmanager dialog vi nano intel-ucode
else
pacstrap /mnt base base-devel linux linux-firmware linux-headers btrfs-progs ntfs-3g exfatprogs grub dosfstools efibootmgr networkmanager dialog vi nano intel-ucode
fi
#パッケージインストール
genfstab -U /mnt >> /mnt/etc/fstab
#fstab作成
arch-chroot /mnt /usr/bin/sed -i -e 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
arch-chroot /mnt /usr/bin/sed -i -e 's/#ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/g' /etc/locale.gen
#localeの設定
arch-chroot /mnt /usr/bin/locale-gen
#localeの設定適用
printf "LANG=en_US.UTF-8" > /mnt/etc/locale.conf
#LANG環境変数設定
printf "[Time]\nNTP=ntp.nict.jp" > /mnt/etc/systemd/timesyncd.conf
#NTPサーバー書き込み
arch-chroot /mnt /usr/bin/grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --recheck
arch-chroot /mnt /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
#grubインストール
arch-chroot /mnt /usr/bin/systemctl enable NetworkManager.service
#NetworkManager有効化
printf "KEYMAP=jp106" > /mnt/etc/vconsole.conf
#日本語配列の設定
printf "%s" "$hostname1" > /mnt/etc/hostname
#ホストネームを変更
arch-chroot /mnt /usr/bin/useradd -d /home/"$home_username" -m "$home_username"
printf "%s" "$home_password" | arch-chroot /mnt /usr/bin/passwd --stdin "$home_username"
#ユーザー作成とパスワード設定
arch-chroot /mnt /usr/bin/usermod -aG wheel "$home_username"
#wheelグループへ所属
arch-chroot /mnt /usr/bin/sed -i -e 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/g' /etc/sudoers
curl -Lk 'https://192.168.1.64:8443/www/suti7/arch/initial.sh' -o "/mnt/home/$home_username/initial.sh"
chown 1000:1000 "/mnt/home/$home_username/initial.sh"
chmod 700 "/mnt/home/$home_username/initial.sh"
#visudo設定
printf "\n\nInstallation is complete. Please reboot.\n"
else
printf "Installation canceled. \n"
fi