Support for real harddrive and Jmicron usb drives
This commit is contained in:
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
# we depend on a properly build rootfs
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
echo "you need to point to a disk (there is no security agains pointing to a parition)"
|
||||
echo "nvme won't work"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
disk=$1
|
||||
|
||||
CHIBRAX_MOUNT_POINT="/tmp/chibraxMountPoint"
|
||||
|
||||
#creating a msdos image for mbr boot
|
||||
parted $disk mklabel msdos || exit 1
|
||||
parted $disk mkpart primary ext4 0% 100% || exit 1
|
||||
|
||||
|
||||
|
||||
mkdir $CHIBRAX_MOUNT_POINT -p || exit 1
|
||||
|
||||
mkfs.ext4 ${disk}1 #|| exit 1
|
||||
mount ${disk}1 $CHIBRAX_MOUNT_POINT
|
||||
|
||||
echo "rebuilding C++ hooks"
|
||||
./clibs.sh || exit 1
|
||||
echo "done"
|
||||
|
||||
echo "coping rootfs"
|
||||
cp rootfs/* $CHIBRAX_MOUNT_POINT -r || exit 1
|
||||
echo "done"
|
||||
|
||||
echo "installing grub"
|
||||
mount --rbind /dev $CHIBRAX_MOUNT_POINT/dev || exit 1
|
||||
mount --make-rslave $CHIBRAX_MOUNT_POINT/dev || exit 1
|
||||
mount -t proc /proc $CHIBRAX_MOUNT_POINT/proc || exit 1
|
||||
mount --rbind /sys $CHIBRAX_MOUNT_POINT/sys || exit 1
|
||||
mount --make-rslave $CHIBRAX_MOUNT_POINT/sys || exit 1
|
||||
mount --rbind /tmp $CHIBRAX_MOUNT_POINT/tmp || exit 1
|
||||
|
||||
chroot $CHIBRAX_MOUNT_POINT /sbin/ldconfig -p || exit 1
|
||||
chroot $CHIBRAX_MOUNT_POINT /usr/sbin/grub-install --target=i386-pc $disk --modules=part_msdos || exit 1
|
||||
chroot $CHIBRAX_MOUNT_POINT /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
|
||||
PARTUUID=$(lsblk $LOOP --fs | awk '{print $4}' | grep -v LABEL)
|
||||
|
||||
echo "menuentry 'Chibrax OS' {" >> $CHIBRAX_MOUNT_POINT/boot/grub/grub.cfg
|
||||
echo " set root='hd0,msdos1'" >> $CHIBRAX_MOUNT_POINT/boot/grub/grub.cfg
|
||||
echo " linux /boot/vmlinuz rootfstype=ext4 root=/dev/sda1 rw quiet" >> $CHIBRAX_MOUNT_POINT/boot/grub/grub.cfg
|
||||
echo "}" >> $CHIBRAX_MOUNT_POINT/boot/grub/grub.cfg
|
||||
|
||||
umount $CHIBRAX_MOUNT_POINT/dev -l
|
||||
umount $CHIBRAX_MOUNT_POINT/proc -l
|
||||
umount $CHIBRAX_MOUNT_POINT/sys -l
|
||||
umount $CHIBRAX_MOUNT_POINT/tmp -l
|
||||
umount $CHIBRAX_MOUNT_POINT
|
||||
Reference in New Issue
Block a user