btrfsへのインストール時にサブボリュームにインストールするように

This commit is contained in:
suti7yk5032 2024-07-28 01:27:47 +09:00
parent 172018bf2a
commit 873a8614ad

View file

@ -1,23 +1,23 @@
#!/bin/bash
loadkeys jp106
#キーボードを日本語配列へ変更
printf "Please enter your username\n\n"
printf "\nPlease enter your username\n"
read -r home_username
printf "Please enter your password\n\n"
printf "Please enter your password\n"
read -sr home_password
printf "Please enter Hostname\n\n"
printf "Please enter Hostname\n"
read -r hostname1
fdisk -l
#ディスク一覧表示
printf "\nWhat disk do you want to install to? example:/dev/sda \n\n"
printf "\nWhat disk do you want to install to? example:/dev/sda \n"
read -r installdisk
printf "\nChoose the file system to use for your root partition. (ext4, btrfs)\n\n"
printf "Choose the file system to use for your root partition. (ext4, btrfs)\n"
read -r filesystem
printf "\nChoose the kernel you want to use. (linux, zen, lts)\n\n"
printf "Choose the kernel you want to use. (linux, zen, lts)\n"
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\n" "$installdisk" "$filesystem"
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
@ -40,13 +40,24 @@ if [ "$check1" == "yes" ]; then
mkfs.vfat -F32 "$d1"
if [ "$filesystem" == "ext4" ]; then
mkfs.ext4 "$d2"
mount "$d2" /mnt
elif [ "$filesystem" == "btrfs" ]; then
mkfs.btrfs -f "$d2"
mount "$d2" /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@swap
umount "$d2"
mount "$d2" /mnt -o subvol=@
mkdir /mnt/home
mkdir /mnt/swap
mount "$d2" /mnt/home -o subvol=@home
mount "$d2" /mnt/swap -o subvol=@swap
else
mkfs.ext4 "$d2"
mount "$d2" /mnt
fi
#フォーマット
mount "$d2" /mnt
mkdir /mnt/boot
mount "$d1" /mnt/boot
#マウント
@ -98,4 +109,4 @@ if [ "$check1" == "yes" ]; then
printf "\n\nInstallation is complete. Please reboot.\n"
else
printf "Installation canceled. \n"
fi
fi