Compare commits

4 Commits
v1.0 ... main

Author SHA1 Message Date
dabfe4025c y 2026-01-25 01:07:44 +03:00
4976ae08c4 FUCKING FUCK 2026-01-25 01:02:05 +03:00
9434b59c51 fucking no alpineclear! 2026-01-24 21:50:01 +03:00
74a103c807 minor changes 2026-01-24 21:40:53 +03:00

49
plct.sh
View File

@@ -1,13 +1,16 @@
#!/bin/bash
echo "welcome to portable linux creation tool v1.0"
printf "welcome to portable linux creation tool v1.0p2\n"
printf "available distros: debian\n\n"
while true; do
read -rp "disk (e.g. /dev/sdX): " disk
if [ -b "$disk" ]; then
read -rp "distro: " distro
distro=${distro,,}
if [ "$distro" = "debian" ] || \
[ "$distro" = "alpine" ]; then
break
fi
echo "$disk is incorrect or is not a disk"
echo "pls choose distro from list"
done
read -rp "choose mountpoint (/mnt/install): " mount
@@ -15,6 +18,8 @@ if [ ! -n "$mount" ]; then
mount="/mnt/install"
fi
read -rp "disk (e.g. /dev/sdX) or skip to install to $mount: " disk
while true; do
read -rp "gpt/mbr: " table
table=${table,,}
@@ -87,6 +92,7 @@ prepare_debian() {
exit 1
fi
if [ -n "$disk" ]; then
while true; do
read -rp "everything is ok, type 'no' to cancel or 'yes' to preceed installation of debian $choice to $disk with $table table (DATA ON $disk WILL BE LOST): " proceeding
if [ "$proceeding" = "no" ]; then
@@ -98,11 +104,25 @@ prepare_debian() {
break
fi
done
else
while true; do
read -rp "everything is ok, type 'no' to cancel or 'yes' to preceed installation of debian $choice to $mount with $table table: " proceeding
if [ "$proceeding" = "no" ]; then
echo "ok aborting"
exit
fi
if [ "$proceeding" = "yes" ]; then
echo "ok starting the installation"
break
fi
done
fi
install_debian
}
install_debian() {
if [ -n "$disk" ]; then
echo "unmounting $disk"
umount $disk*
@@ -114,6 +134,7 @@ install_debian() {
if [ $table = "mbr" ]; then
parted $disk --script mklabel msdos
fi
if [ $table = "gpt" ]; then
parted $disk --script mklabel gpt
fi
@@ -134,6 +155,7 @@ install_debian() {
mkdir $mount/boot
mount ${disk}${prefix}1 $mount/boot
fi
if [ $efi = "no" ]; then
parted $disk --script \
mkpart primary ext4 1MiB 100%
@@ -141,6 +163,7 @@ install_debian() {
mount ${disk}${prefix}1 $mount
fi
fi
debootstrap $choice $mount $mirror
@@ -171,23 +194,39 @@ install_debian() {
mkdir $mount/boot/efi
$RUN grub-install --target=x86_64-efi --efi-directory=/boot --removable
$RUN update-grub
if [ -n "$disk" ]; then
efi_uuid=$(blkid -s UUID -o value ${disk}${prefix}1)
root_uuid=$(blkid -s UUID -o value ${disk}${prefix}2)
echo "UUID=$efi_uuid /boot/ vfat umask=0077 0 1" >> $mount/etc/fstab
echo "UUID=$root_uuid / ext4 defaults,noatime 0 1" >> $mount/etc/fstab
fi
fi
if [ $efi = "no" ]; then
$RUN apt-get install -y grub-pc
$RUN grub-install $disk
$RUN update-grub
if [ -n "$disk" ]; then
root_uuid=$(blkid -s UUID -o value ${disk}${prefix}1)
echo "UUID=$root_uuid / ext4 defaults,noatime 0 1" >> $mount/etc/fstab
fi
fi
echo 'done! chrooted you into installed system. type "exit" to finish the installation'
if [ ! -n "$disk" ]; then
echo "pls generate fstab manually"
fi
$RUN /bin/bash
umount -R $mount
}
prepare_debian
if [ $distro = "debian" ]; then
prepare_debian
exit
fi
echo "bye!"