Compare commits

..

No commits in common. "43c2e1ec8226c3cbbcfbde648e111d8b98537bb7" and "0657950327dbaec7e369277378873813add25856" have entirely different histories.

4 changed files with 6 additions and 60 deletions

View File

@ -1,5 +0,0 @@
#!/bin/env bash
TARGETDISK=$(lsblk -nrpo NAME,TYPE | grep ' disk' | awk '{print $1}' | gum choose)
echo "You have selected: $TARGETDISK"

View File

@ -1,14 +1,12 @@
#! /bin/env bash
# assume that /mnt and /mnt/boot is mounted
TARGET=/mnt
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
umount -R $TARGET
source $DIR/choosedisk.sh
source ./make-partition.sh
source ./mount-subvol.sh
UUID=$(blkid -s UUID -o value "${TARGETDISK}2")
DEVICE=$(findmnt -n -o SOURCE $TARGET | sed 's/\[.*//')
UUID=$(blkid -s UUID -o value ${DEVICE})
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
echo $DIR
debootstrap stable $TARGET http://deb.debian.org/debian/
@ -26,7 +24,6 @@ echo "export PATH=$PATH:/sbin/" >>$TARGET/root/.bashrc
cp $DIR/chroot-commands.sh $TARGET/root/
chmod +x $TARGET/root/chroot-commands.sh
chroot $TARGET /bin/bash -l -c '/root/chroot-commands.sh'
rm $TARGET/root/chroot-commands.sh
# fix systemd-boot
for ENTRY in $TARGET/boot/loader/entries/*.conf; do

View File

@ -1,31 +0,0 @@
#!/bin/bash
# 检查 TARGETDISK 变量是否已定义
if [ -z "$TARGETDISK" ]; then
echo "TARGETDISK is not set. Please run the disk selector script first."
exit 1
fi
# 使用 gum confirm 警告:这将删除目标硬盘上的所有数据
if ! gum confirm "Warning: This will erase all data on $TARGETDISK. Proceed?"; then
echo "Aborting."
exit 1
fi
# 使用 parted 工具创建新的 GPT 分区表
parted -s "$TARGETDISK" mklabel gpt
# 创建 EFI 分区,大小为 512M后面是系统分区占据剩余空间
parted -s "$TARGETDISK" mkpart primary fat32 1MiB 513MiB
parted -s "$TARGETDISK" set 1 esp on
# 计算起始点,为 513MiB 后的第一个 MiB
parted -s "$TARGETDISK" mkpart primary btrfs 513MiB 100%
# 格式化 EFI 分区为 FAT32
mkfs.fat -F32 "${TARGETDISK}1"
# 格式化系统分区为 Btrfs
mkfs.btrfs -f "${TARGETDISK}2"
echo "Partitioning and formatting complete."

View File

@ -1,15 +0,0 @@
mount "${TARGETDISK}2" $TARGET
btrfs subvolume create $TARGET/@
btrfs subvolume create $TARGET/@home
btrfs subvolume create $TARGET/@var_log
umount $TARGET
mount -o defaults,ssd,noatime,compress=zstd,subvol=@ "${TARGETDISK}2" $TARGET
mkdir -p $TARGET/{home,var/log,boot}
mount -o defaults,ssd,noatime,compress=zstd,subvol=@home "${TARGETDISK}2" $TARGET/home
mount -o defaults,ssd,noatime,compress=zstd,subvol=@var_log "${TARGETDISK}2" $TARGET/var/log
mount "${TARGETDISK}1" $TARGET/boot