Add live-installer
This commit is contained in:
parent
74d2f4c1db
commit
329e93fbd2
@ -1 +0,0 @@
|
|||||||
live-boot
|
|
2
modlists/live
Normal file
2
modlists/live
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
live-boot
|
||||||
|
live-installer
|
128
mods/live-installer/data/bin/login
Executable file
128
mods/live-installer/data/bin/login
Executable file
@ -0,0 +1,128 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
export PATH="/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
|
||||||
|
|
||||||
|
function wdvn-chroot {
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
mount -o bind "/dev" "$1/dev"
|
||||||
|
mount -o bind "/dev/pts" "$1/dev/pts"
|
||||||
|
mount -o bind "/sys" "$1/sys"
|
||||||
|
mount -t proc none "$1/proc"
|
||||||
|
chroot "$1" ${@:2}
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
wdvn-chroot-end "$1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
wdvn-chroot-end "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function wdvn-chroot-end {
|
||||||
|
umount -l "$1/proc"
|
||||||
|
umount -l "$1/sys"
|
||||||
|
umount -l "$1/dev/pts"
|
||||||
|
umount -l "$1/dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
CHOICE=1
|
||||||
|
while true; do
|
||||||
|
echo "Welcome to windvn!"
|
||||||
|
echo "1: Fast install"
|
||||||
|
echo "2: Open bash"
|
||||||
|
echo "3: Shut down"
|
||||||
|
read -p "Choice: " CHOICE
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ "$CHOICE" == "1" ]; then
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
dpkg-reconfigure keyboard-configuration
|
||||||
|
udevadm trigger --subsystem-match=input --action=change
|
||||||
|
|
||||||
|
lsblk
|
||||||
|
read -p "Device (ALL DATA WILL BE ERASED): " DEVICE
|
||||||
|
|
||||||
|
# Create partitions
|
||||||
|
echo "Creating partitions ..."
|
||||||
|
(
|
||||||
|
echo n
|
||||||
|
echo e
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo +256M
|
||||||
|
echo t
|
||||||
|
echo swap
|
||||||
|
echo n
|
||||||
|
echo p
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo t
|
||||||
|
echo
|
||||||
|
echo linux
|
||||||
|
echo w
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
) | fdisk "$DEVICE"
|
||||||
|
|
||||||
|
# Format partitions
|
||||||
|
echo "Formatting partitions ..."
|
||||||
|
mkswap "${DEVICE}1"
|
||||||
|
mkfs.ext4 "${DEVICE}2"
|
||||||
|
|
||||||
|
# Mount target partition
|
||||||
|
echo "Mounting partitions ..."
|
||||||
|
mkdir -p "/media/install"
|
||||||
|
mount "${DEVICE}2" "/media/install"
|
||||||
|
|
||||||
|
# Add files
|
||||||
|
echo "Adding files ..."
|
||||||
|
unsquashfs -f -d "/media/install" "/lib/live/mount/medium/live/filesystem.squashfs"
|
||||||
|
|
||||||
|
# Write fstab
|
||||||
|
echo "Writing fstab ..."
|
||||||
|
echo "UUID=$(blkid -o value -s UUID "${DEVICE}1") none swap sw 0 0" >"/media/install/etc/fstab"
|
||||||
|
echo "UUID=$(blkid -o value -s UUID "${DEVICE}2") / ext4 errors=remount-ro 0 1" >>"/media/install/etc/fstab"
|
||||||
|
|
||||||
|
# Remove live-specific packages
|
||||||
|
echo "Removing live-specific packages ..."
|
||||||
|
wdvn-chroot "/media/install" apt autoremove --purge live-boot live-boot-initramfs-tools
|
||||||
|
rm "/media/install/bin/login"
|
||||||
|
mv "/media/install/bin/login.oobe" "/media/install/bin/login"
|
||||||
|
|
||||||
|
# Install GRUB
|
||||||
|
echo "Installing grub ..."
|
||||||
|
#echo "GRUB_DISABLE_OS_PROBER=true" >>"/media/install/etc/default/grub"
|
||||||
|
wdvn-chroot "/media/install" grub-install --boot-directory="/boot" --modules=part_msdos "$DEVICE"
|
||||||
|
wdvn-chroot "/media/install" update-grub
|
||||||
|
#sed -i 's/GRUB_DISABLE_OS_PROBER=true/# GRUB_DISABLE_OS_PROBER=true/' "/media/install/etc/default/grub"
|
||||||
|
|
||||||
|
# Unmount
|
||||||
|
echo "Unmounting ..."
|
||||||
|
umount -l "/media/install"
|
||||||
|
rmdir "/media/install"
|
||||||
|
|
||||||
|
echo Done.
|
||||||
|
read
|
||||||
|
)
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo ERROR. Cleaning up...
|
||||||
|
umount -l "/media/install"
|
||||||
|
echo An error occured.
|
||||||
|
read
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CHOICE" == "2" ]; then
|
||||||
|
bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CHOICE" == "3" ]; then
|
||||||
|
poweroff
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
done
|
4
mods/live-installer/modscript
Normal file
4
mods/live-installer/modscript
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
export WDVN_PACKAGES="$WDVN_PACKAGES squashfs-tools"
|
||||||
|
export WDVN_REMOVE="$WDVN_REMOVE squashfs-tools"
|
||||||
|
cp "$1/bin/login" "$1/bin/login.oobe"
|
Loading…
Reference in New Issue
Block a user