diff options
Diffstat (limited to 'bootstrap/install.old')
-rwxr-xr-x | bootstrap/install.old | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bootstrap/install.old b/bootstrap/install.old new file mode 100755 index 00000000..013a1287 --- /dev/null +++ b/bootstrap/install.old @@ -0,0 +1,65 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +#After partitioning /dev/vda1 as efi and /dev/vda2 as btrfs, installation is as simple as: + +available_disks="$(mktmp)"; +lsblk -J | jq '.[] | map(.name) | [foreach .[] as $item ({item: null, index: -1}; {$item, index: (.index + 1)})]' > $available_disks; +#"$(lsblk -J | jq '.[]| .[]| {name: .name, children: (.children | map(.name))} | .name')" + + +[ "$(jq '.[]' "$available_disks" | wc -l)" -eq 0 ] && die "No disks found" +msg "Select a disk to format:\n" + +i=9999; # nobody will have so many disks attached + +while ! jq -e --argjson i "$i" '.[$i]' "$available_disks" > /dev/null ; do + for disk in $(jq -c '.[]' "$available_disks" ); do + printf "%4s) %s \n" "$(echo "$disk" | jq '.index')" "$(echo "$disk" | jq '.item' | tr -d "\"")"; + done + printf "%4s) Exit\n" "q" + readp "Enter a option: " disk + + if [ $disk = "q" ];then + exit 1 + else + i="$disk" + fi + jq -e --argjson i "$i" '.[$i]' "$available_disks" || warning "\nNo disk selected. Select a disk to continue.\n" +done + +exit 0; +#disk=$((disk-1)) +#read -p "Do you want to delete all in ${Disk_Array[$disk]}? [N/y]" -n 1 -r result +#[[ $result =~ ^[Yy]$ ]] && echo || exit 1 +#sgdisk -Z "${Disk_Array[$disk]}" > /dev/null || dien "Zapping" +#sgdisk -n 1:0:+300M -n 2:0:"$ENDSECTOR" -t 1:ef00 -t 2:8300 "${Disk_Array[$disk]}" > /dev/null || dien "Partitioning" +# +#if [[ ${Disk_Array[$disk]} == *"nvme"* ]];then +# export DISK_EFI=${Disk_Array[$disk]}p1 && echo "${Disk_Array[$disk]}p1" > /root/efi-disk +# export DISK_ROOT=${Disk_Array[$disk]}p2 && echo "${Disk_Array[$disk]}p2" > /root/root-disk +#else +# export DISK_EFI=${Disk_Array[$disk]}1 && echo "${Disk_Array[$disk]}1" > /root/efi-disk +# export DISK_ROOT=${Disk_Array[$disk]}2 && echo "${Disk_Array[$disk]}2" > /root/root-disk +#fi +# +# +#mount -t btrfs /dev/vda2 /mnt +#btrfs subvolume create /mnt/{nix,storage} +#btrfs subvolume create /mnt/storage/{networkmanager,nixos-server} +#umount /mnt +#mount -t tmpfs none /mnt +#mkdir -p /mnt/{nix,etc/nixos,etc/NetworkManager,srv,boot} +#mount /dev/vda1 /mnt/boot +#mount -t btrfs -o subvol=nix /dev/vda2 /mnt/nix +#mount -t btrfs -o subvol=storage /dev/vda2 /mnt/srv +#mount -o bind /mnt/srv/nixos-server /mnt/etc/nixos +#mount -o bind /mnt/srv/networkmanager /mnt/etc/NetworkManager +#nixos-generate-config --root /mnt +#nixos-install --no-root-passwd +#reboot +# +# +#if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi |