progress
This commit is contained in:
parent
ed5bc28ec5
commit
b2cc80a615
39
main.sh
39
main.sh
|
@ -19,7 +19,7 @@ target_phy_disk() {
|
||||||
header "Choose target disk"
|
header "Choose target disk"
|
||||||
local DISKS_DETAILS
|
local DISKS_DETAILS
|
||||||
local output
|
local output
|
||||||
DISKS_DETAILS=$(lsblk -l -o KNAME,TYPE,SIZE,MODEL,WWN|grep disk)
|
DISKS_DETAILS=$(lsblk -l -o KNAME,TYPE,SIZE,MODEL|grep disk)
|
||||||
echo "$DISKS_DETAILS"
|
echo "$DISKS_DETAILS"
|
||||||
multiplechoice $(echo "${DISKS_DETAILS}"|awk '{print $1}')
|
multiplechoice $(echo "${DISKS_DETAILS}"|awk '{print $1}')
|
||||||
TARGET_PHY_DISK="/dev/${output}"
|
TARGET_PHY_DISK="/dev/${output}"
|
||||||
|
@ -27,15 +27,10 @@ target_phy_disk() {
|
||||||
|
|
||||||
target_phy_id() {
|
target_phy_id() {
|
||||||
local i
|
local i
|
||||||
local f1
|
|
||||||
local f2
|
local f2
|
||||||
for i in $(find /dev/disk/by-id|grep -v part); do
|
for i in $(find /dev/disk/by-id|grep -v part); do
|
||||||
if realpath "$i" | grep -q -i "$TARGET_PHY_DISK"; then
|
if realpath "$i" | grep -q -i "$TARGET_PHY_DISK"; then
|
||||||
if echo "$i" | grep -q "wwn"; then
|
if echo "$i" | grep -q -v "wwn" | grep -q -v "eui"; then
|
||||||
TARGET_PHY_WWN="$i"
|
|
||||||
f1=1
|
|
||||||
fi
|
|
||||||
if echo "$i" | grep -q -v "wwn"; then
|
|
||||||
TARGET_PHY_ID="$i"
|
TARGET_PHY_ID="$i"
|
||||||
f2=1
|
f2=1
|
||||||
fi
|
fi
|
||||||
|
@ -93,36 +88,36 @@ do_partition() {
|
||||||
header "do partition"
|
header "do partition"
|
||||||
start=1
|
start=1
|
||||||
if [ "$EFI" == "1" ]; then
|
if [ "$EFI" == "1" ]; then
|
||||||
parted -a optimal $TARGET_PHY_WWN -s -- mklabel gpt
|
parted -a optimal $TARGET_PHY_ID -s -- mklabel gpt
|
||||||
size=500
|
size=500
|
||||||
parted -a optimal $TARGET_PHY_WWN unit mib -s -- mkpart EFI fat32 $start $(( start + size ))
|
parted -a optimal $TARGET_PHY_ID unit mib -s -- mkpart EFI fat32 $start $(( start + size ))
|
||||||
sleep 2
|
sleep 2
|
||||||
start=$(( start + size ))
|
start=$(( start + size ))
|
||||||
parted -a optimal $TARGET_PHY_WWN unit mib -s -- mkpart root $start -1s
|
parted -a optimal $TARGET_PHY_ID unit mib -s -- mkpart root $start -1s
|
||||||
mkfs.vfat -F32 ${TARGET_PHY_WWN}-part1
|
mkfs.vfat -F32 ${TARGET_PHY_ID}-part1
|
||||||
TARGET_PART="2"
|
TARGET_PART="2"
|
||||||
else
|
else
|
||||||
parted -a optimal $TARGET_PHY_WWN -s -- mklabel msdos
|
parted -a optimal $TARGET_PHY_ID -s -- mklabel msdos
|
||||||
TARGET_PART="1"
|
TARGET_PART="1"
|
||||||
if [ "$ENCRYPTION_STYLE" == "b" ] || [ "$ENCRYPTION_STYLE" == "e" ]; then
|
if [ "$ENCRYPTION_STYLE" == "b" ] || [ "$ENCRYPTION_STYLE" == "e" ]; then
|
||||||
size=2048
|
size=2048
|
||||||
parted -a optimal $TARGET_PHY_WWN unit mib -s -- mkpart primary ext4 $start $(( start + size ))
|
parted -a optimal $TARGET_PHY_ID unit mib -s -- mkpart primary ext4 $start $(( start + size ))
|
||||||
sleep 2
|
sleep 2
|
||||||
start=$(( start + size ))
|
start=$(( start + size ))
|
||||||
mkfs.btrfs -f "${TARGET_PHY_WWN}-part1"
|
mkfs.btrfs -f "${TARGET_PHY_ID}-part1"
|
||||||
TARGET_PART="2"
|
TARGET_PART="2"
|
||||||
fi
|
fi
|
||||||
parted -a optimal $TARGET_PHY_WWN unit mib -s -- mkpart primary ext4 $start -1s
|
parted -a optimal $TARGET_PHY_ID unit mib -s -- mkpart primary ext4 $start -1s
|
||||||
fi
|
fi
|
||||||
sleep 2
|
sleep 2
|
||||||
TARGETNAME=$(basename ${TARGET_PHY_WWN}-part${TARGET_PART})
|
TARGETNAME=$(basename ${TARGET_PHY_ID}-part${TARGET_PART})
|
||||||
TARGETNAME_UNDERSCORE=${TARGETNAME//-/_}
|
TARGETNAME_UNDERSCORE=${TARGETNAME//-/_}
|
||||||
T=/dev/disk/by-id/${TARGET_PHY_WWN}-part${TARGET_PART}
|
T=/dev/disk/by-id/${TARGET_PHY_ID}-part${TARGET_PART}
|
||||||
if [ "$ENCRYPTION_STYLE" == "a" ]; then
|
if [ "$ENCRYPTION_STYLE" == "a" ]; then
|
||||||
T=/dev/mapper/luks_${TARGETNAME_UNDERSCORE}
|
T=/dev/mapper/luks_${TARGETNAME_UNDERSCORE}
|
||||||
echo -n $pass | cryptsetup luksFormat ${TARGET_PHY_WWN}-part${TARGET_PART} -d -
|
echo -n $pass | cryptsetup luksFormat ${TARGET_PHY_ID}-part${TARGET_PART} -d -
|
||||||
#echo -n $pass | sudo cryptsetup luksOpen /dev/sdc1 sdc1 -d -
|
#echo -n $pass | sudo cryptsetup luksOpen /dev/sdc1 sdc1 -d -
|
||||||
echo -n $pass | cryptsetup luksOpen ${TARGET_PHY_WWN}-part${TARGET_PART} "luks_${TARGETNAME_UNDERSCORE}" -d -
|
echo -n $pass | cryptsetup luksOpen ${TARGET_PHY_ID}-part${TARGET_PART} "luks_${TARGETNAME_UNDERSCORE}" -d -
|
||||||
fi
|
fi
|
||||||
vgcreate vg_${TARGETNAME_UNDERSCORE} $T
|
vgcreate vg_${TARGETNAME_UNDERSCORE} $T
|
||||||
lvcreate --name swap -L ${SWAPSIZE}G vg_${TARGETNAME_UNDERSCORE}
|
lvcreate --name swap -L ${SWAPSIZE}G vg_${TARGETNAME_UNDERSCORE}
|
||||||
|
@ -136,11 +131,11 @@ do_partition() {
|
||||||
mount /dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root $target -o subvol=root
|
mount /dev/mapper/vg_${TARGETNAME_UNDERSCORE}-root $target -o subvol=root
|
||||||
if [ "$EFI" == "1" ]; then
|
if [ "$EFI" == "1" ]; then
|
||||||
mkdir -p ${target}/boot/efi
|
mkdir -p ${target}/boot/efi
|
||||||
mount ${TARGET_PHY_WWN}-part1 ${target}/boot/efi
|
mount ${TARGET_PHY_ID}-part1 ${target}/boot/efi
|
||||||
else
|
else
|
||||||
if [ "$ENCRYPTION_STYLE" == "b" ] || [ "$ENCRYPTION_STYLE" == "e" ]; then
|
if [ "$ENCRYPTION_STYLE" == "b" ] || [ "$ENCRYPTION_STYLE" == "e" ]; then
|
||||||
mkdir -p ${target}/boot
|
mkdir -p ${target}/boot
|
||||||
mount ${TARGET_PHY_WWN}-part1 ${target}/boot
|
mount ${TARGET_PHY_ID}-part1 ${target}/boot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -342,7 +337,7 @@ do_chroot() {
|
||||||
echo "HOSTNAME=$HOSTNAME" >> ${target}/tmp/vinstaller/vars
|
echo "HOSTNAME=$HOSTNAME" >> ${target}/tmp/vinstaller/vars
|
||||||
echo "EFI=$EFI" >> ${target}/tmp/vinstaller/vars
|
echo "EFI=$EFI" >> ${target}/tmp/vinstaller/vars
|
||||||
echo "LANGUAGE=$LANGUAGE" >> ${target}/tmp/vinstaller/vars
|
echo "LANGUAGE=$LANGUAGE" >> ${target}/tmp/vinstaller/vars
|
||||||
echo "TARGET_PHY_WWN=$TARGET_PHY_WWN" >> ${target}/tmp/vinstaller/vars
|
echo "TARGET_PHY_ID=$TARGET_PHY_ID" >> ${target}/tmp/vinstaller/vars
|
||||||
echo "TARGET_PART=$TARGET_PART" >> ${target}/tmp/vinstaller/vars
|
echo "TARGET_PART=$TARGET_PART" >> ${target}/tmp/vinstaller/vars
|
||||||
echo "TARGETNAME_UNDERSCORE=$TARGETNAME_UNDERSCORE" >> ${target}/tmp/vinstaller/vars
|
echo "TARGETNAME_UNDERSCORE=$TARGETNAME_UNDERSCORE" >> ${target}/tmp/vinstaller/vars
|
||||||
echo "ENCRYPTION_STYLE=$ENCRYPTION_STYLE" >> ${target}/tmp/vinstaller/vars
|
echo "ENCRYPTION_STYLE=$ENCRYPTION_STYLE" >> ${target}/tmp/vinstaller/vars
|
||||||
|
|
Loading…
Reference in New Issue
Block a user