From 553d8c5b1e6b8c8c78fed856735a6e68c57318e9 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Mon, 13 May 2024 18:36:09 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=B0=8F=E6=A0=A1=E6=AD=A3=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install/linux/linux_minimal.sh | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 install/linux/linux_minimal.sh diff --git a/install/linux/linux_minimal.sh b/install/linux/linux_minimal.sh new file mode 100644 index 0000000..9f506ad --- /dev/null +++ b/install/linux/linux_minimal.sh @@ -0,0 +1,82 @@ +#!/bin/bash +loadkeys jp106 +#キーボードを日本語配列へ変更 +printf "Please enter your username\n" +read -r home_username +printf "Please enter your password\n" +read -r 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 "%s is selected as the disk to install. Are you sure you want to perform the partition operation? (yes or no) \n" "$installdisk" +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:+300M -t 1:ef00 -c 1:"EFI System" "$installdisk" + sgdisk -n 2:0: -t 2:8300 -c 2:"Linux filesystem" "$installdisk" + #パーティション操作 + mkfs.vfat -F32 "$d1" + mkfs.ext4 "$d2" + #フォーマット + 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 + pacstrap /mnt base base-devel linux linux-firmware linux-headers grub dosfstools efibootmgr networkmanager dialog nano intel-ucode + #パッケージインストール + 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_server.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