Compare commits
6
Commits
3f5aa6064b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7ccffccf0 | ||
|
|
c45f1362ed | ||
|
|
2fd5c0f094 | ||
|
|
4044a8e55e | ||
|
|
ad1fe22d1a | ||
|
|
aa9b97dc4f |
Regular → Executable
+2
@@ -1,3 +1,5 @@
|
|||||||
|
apt-get update
|
||||||
|
|
||||||
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
|
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
|
||||||
hwclock --systohc
|
hwclock --systohc
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+11
-2
@@ -3,6 +3,10 @@
|
|||||||
# assume that /mnt and /mnt/boot is mounted
|
# assume that /mnt and /mnt/boot is mounted
|
||||||
|
|
||||||
TARGET=/mnt
|
TARGET=/mnt
|
||||||
|
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/
|
debootstrap stable $TARGET http://deb.debian.org/debian/
|
||||||
|
|
||||||
@@ -17,8 +21,13 @@ mount --bind /sys/firmware/efi/efivars $TARGET/sys/firmware/efi/efivars
|
|||||||
echo "deb http://deb.debian.org/debian stable main non-free-firmware" >$TARGET/etc/apt/sources.list
|
echo "deb http://deb.debian.org/debian stable main non-free-firmware" >$TARGET/etc/apt/sources.list
|
||||||
echo "export PATH=$PATH:/sbin/" >>$TARGET/root/.bashrc
|
echo "export PATH=$PATH:/sbin/" >>$TARGET/root/.bashrc
|
||||||
|
|
||||||
cp ./chroot-commands.sh $TARGET/root/
|
cp $DIR/chroot-commands.sh $TARGET/root/
|
||||||
chmod +x $TARGET/root/chroot-commands.sh
|
chmod +x $TARGET/root/chroot-commands.sh
|
||||||
chroot $TARGET /root/chroot-commands.sh
|
chroot $TARGET /bin/bash -l -c '/root/chroot-commands.sh'
|
||||||
|
|
||||||
|
# fix systemd-boot
|
||||||
|
for ENTRY in $TARGET/boot/loader/entries/*.conf; do
|
||||||
|
sed -i "s/root=UUID=[a-zA-Z0-9-]*/root=UUID=${UUID}/" "${ENTRY}"
|
||||||
|
done
|
||||||
|
|
||||||
echo "Done! Should be good to reboot now and run post-install scripts."
|
echo "Done! Should be good to reboot now and run post-install scripts."
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#!/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 --prompt "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 "${TARGETDISK}2"
|
||||||
|
|
||||||
|
echo "Partitioning and formatting complete."
|
||||||
|
|
||||||
Reference in New Issue
Block a user